From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx138.postini.com [74.125.245.138]) by kanga.kvack.org (Postfix) with SMTP id 0B2B06B0075 for ; Mon, 29 Oct 2012 11:44:03 -0400 (EDT) Date: Mon, 29 Oct 2012 11:44:03 -0400 (EDT) From: Alan Stern Subject: Re: [PATCH v3 4/6] net/core: apply pm_runtime_set_memalloc_noio on network devices In-Reply-To: <1351513440-9286-5-git-send-email-ming.lei@canonical.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Ming Lei Cc: linux-kernel@vger.kernel.org, Oliver Neukum , Minchan Kim , Greg Kroah-Hartman , "Rafael J. Wysocki" , Jens Axboe , "David S. Miller" , Andrew Morton , netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-pm@vger.kernel.org, linux-mm@kvack.org, Eric Dumazet , David Decotigny , Tom Herbert , Ingo Molnar On Mon, 29 Oct 2012, Ming Lei wrote: > Deadlock might be caused by allocating memory with GFP_KERNEL in > runtime_resume callback of network devices in iSCSI situation, so > mark network devices and its ancestor as 'memalloc_noio_resume' > with the introduced pm_runtime_set_memalloc_noio(). > @@ -1411,6 +1414,8 @@ int netdev_register_kobject(struct net_device *net) > *groups++ = &netstat_group; > #endif /* CONFIG_SYSFS */ > > + pm_runtime_set_memalloc_noio(dev, true); > + > error = device_add(dev); > if (error) > return error; This is an example of what I described earlier. The pm_runtime_set_memalloc_noio() call should come after device_add(), not before. (Not to mention that this version of the code doesn't correctly handle the case where device_add() fails.) Alan Stern -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org