Re: USB hangs

From: Matthew Dharm
Date: Sat Jan 10 2004 - 19:24:11 EST


Where is USB kmalloc'ing with GFP_KERNEL? I thought we tracked all those
down and eliminated them.

Matt

On Sun, Jan 11, 2004 at 12:07:17AM +0000, Alan Cox wrote:
> With the various fixes people had been posting USB storage
> writing was still hanging repeatedly when doing a 20Gb rsync
> to usb-storage disks with a low memory system. Doing things
> like while(true) sync() made it hang even more often.
>
> After a bit of digging the following seems to fix it
>
> Not sure if 2.6 needs this as well.
>
> The failure path seems to be
>
> ->scsi_done in the USB storage thread
> issues a new command
> causes USB to kmalloc GFP_KERNEL
> causes a page out
> queues a page out to the USB storage thread
> Deadlock.
>
> Setting PF_MEMALLOC should stop the storage thread ever causing pageout
> itself so deadlocking.
>

> --- drivers/usb/storage/usb.c~ 2004-01-09 02:06:35.000000000 +0000
> +++ drivers/usb/storage/usb.c 2004-01-09 02:06:35.000000000 +0000
> @@ -332,6 +332,8 @@
>
> /* set our name for identification purposes */
> sprintf(current->comm, "usb-storage-%d", us->host_number);
> +
> + current->flags |= PF_MEMALLOC;
>
> unlock_kernel();
>


--
Matthew Dharm Home: mdharm-usb@xxxxxxxxxxxxxxxxxx
Maintainer, Linux USB Mass Storage Driver

Your lips are twitching. You're playing Quake aren't you.
-- Stef to Greg
User Friendly, 8/11/1998

Attachment: pgp00000.pgp
Description: PGP signature