lkml.org 
[lkml]   [2016]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.

\
 
 \ /
  Last update: 2016-05-03 16:01    [W:0.047 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site