[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200921125237.GA24776@duo.ucw.cz>
Date: Mon, 21 Sep 2020 14:52:37 +0200
From: Pavel Machek <pavel@...x.de>
To: Oliver Neukum <oneukum@...e.com>
Cc: Pavel Machek <pavel@...x.de>, gregkh@...uxfoundation.org,
stern@...land.harvard.edu, johan@...nel.org, gustavoars@...nel.org,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: yurex: Rearrange code not to need GFP_ATOMIC
Hi!
> > Move prepare to wait around, so that normal GFP_KERNEL allocation can
> > be used.
> >
> > Signed-off-by: Pavel Machek (CIP) <pavel@...x.de>
> > Acked-by: Alan Stern <stern@...land.harvard.edu>
>
> Ehm. Please recheck.
Sorry about that.
> > +++ b/drivers/usb/misc/yurex.c
> > @@ -489,10 +489,10 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
> > }
> >
> > /* send the data as the control msg */
> > - prepare_to_wait(&dev->waitq, &wait, TASK_INTERRUPTIBLE);
> > dev_dbg(&dev->interface->dev, "%s - submit %c\n", __func__,
> > dev->cntl_buffer[0]);
> > - retval = usb_submit_urb(dev->cntl_urb, GFP_ATOMIC);
> > + retval = usb_submit_urb(dev->cntl_urb, GFP_KERNEL);
>
> URB completes here. wake_up() returns the task to RUNNING.
>
> > + prepare_to_wait(&dev->waitq, &wait, TASK_INTERRUPTIBLE);
>
> Task goes to TASK_INTERRUPTIBLE
>
> > if (retval >= 0)
> > timeout = schedule_timeout(YUREX_WRITE_TIMEOUT);
>
> Task turns into Sleeping Beauty until timeout
Is there way to do the allocations for submit_urb before the
prepare_to_wait? GFP_ATOMIC would be nice to avoid... and doing
GFP_ATOMIC from normal process context just because of task_state
seems ... wrong.
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists