From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [PATCH v7 0/6] solve deadlock caused by memory allocation with I/O Date: Wed, 16 Jan 2013 15:37:44 -0800 Message-ID: <20130116153744.70210fa3.akpm@linux-foundation.org> References: <1357352744-8138-1-git-send-email-ming.lei@canonical.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Received: from mail.linuxfoundation.org ([140.211.169.12]:42441 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755308Ab3APXhp (ORCPT ); Wed, 16 Jan 2013 18:37:45 -0500 In-Reply-To: <1357352744-8138-1-git-send-email-ming.lei@canonical.com> Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: Ming Lei Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-pm@vger.kernel.org, linux-mm@kvack.org, Alan Stern , Oliver Neukum , Minchan Kim , "Rafael J. Wysocki" , Jens Axboe , "David S. Miller" On Sat, 5 Jan 2013 10:25:38 +0800 Ming Lei wrote: > This patchset try to solve one deadlock problem which might be caused > by memory allocation with block I/O during runtime PM and block device > error handling path. Traditionly, the problem is addressed by passing > GFP_NOIO statically to mm, but that is not a effective solution, see > detailed description in patch 1's commit log. > > This patch set introduces one process flag and trys to fix the deadlock > problem on block device/network device during runtime PM or usb bus reset. The patchset doesn't look like the worst thing I've ever applied ;) One thing I'm wondering: during suspend and resume, why are GFP_KERNEL allocation attempts even getting down to the device layer? Presumably the page scanner is encountering dirty pagecache or dirty swapcache pages? If so, I wonder if we could avoid the whole problem by appropriately syncing all dirty memory back to storage before starting to turn devices off?