Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1393426

Re: [PATCH RESEND] rtsx_usb_ms: Use msleep_interruptible() in polling loop

From Oleg Nesterov <oleg@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH RESEND] rtsx_usb_ms: Use msleep_interruptible() in polling loop
Date 2016-05-03 15:50 +0200
Message-ID <ruIS7-Hw-25@gated-at.bofh.it> (permalink)
References <rusDD-1Qt-1@gated-at.bofh.it> <rut6G-24A-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH RESEND] rtsx_usb_ms: Use msleep_interruptible() in polling  loop Oleksandr Natalenko <oleksandr@natalenko.name> - 2016-05-02 22:30 +0200
  Re: [PATCH RESEND] rtsx_usb_ms: Use msleep_interruptible() in  polling loop Andrew Morton <akpm@linux-foundation.org> - 2016-05-02 23:00 +0200
    Re: [PATCH RESEND] rtsx_usb_ms: Use msleep_interruptible() in  polling loop Oleg Nesterov <oleg@redhat.com> - 2016-05-03 15:50 +0200
      Re: [PATCH RESEND] rtsx_usb_ms: Use msleep_interruptible() in  polling loop Ben Hutchings <ben@decadent.org.uk> - 2016-05-03 17:30 +0200

csiph-web