Messages in this thread | | | Date | Tue, 3 May 2016 15:40:09 +0200 | From | Oleg Nesterov <> | Subject | Re: [PATCH RESEND] rtsx_usb_ms: Use msleep_interruptible() in polling loop |
| |
On 05/02, Andrew Morton wrote: > > On Mon, 02 May 2016 23:17:41 +0300 Oleksandr Natalenko <oleksandr@natalenko.name> wrote: > > > rtsx_usb_ms creates a task that mostly sleeps, but tasks in > > uninterruptible sleep still contribute to the load average (for > > bug-compatibility with Unix).
We have TASK_NOLOAD/TASK_IDLE, you can just use schedule_timeout_idle(HZ).
but msleep_interruptible(1000) is fine too.
> > --- a/drivers/memstick/host/rtsx_usb_ms.c > > +++ b/drivers/memstick/host/rtsx_usb_ms.c > > @@ -706,7 +706,8 @@ poll_again: > > if (host->eject) > > break; > > > > - msleep(1000); > > + if (msleep_interruptible(1000)) > > + flush_signals(current); > > } > > > > complete(&host->detect_ms_exit); > > flush_signals() is a bit scary. ... > But this isn't a userspace task - it's a kthread. So I don't *think* > it can get any signals anyway?
Agreed, it is not needed and only adds some confusion, so I think rtsx_usb_ms-use-msleep_interruptible-in-polling-loop.patch should be updated.
A kernel thread ignores all signals unless it does allow_signal(), so you can safely remove flush_signals().
Oleg.
| |