From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Wed, 15 Nov 2006 14:24:37 -0800 From: Andrew Morton Subject: Re: [PATCH] mm: call into direct reclaim without PF_MEMALLOC set Message-Id: <20061115142437.87c4cbe4.akpm@osdl.org> In-Reply-To: <1163628739.31358.164.camel@laptopd505.fenrus.org> References: <1163618703.5968.50.camel@twins> <20061115124228.db0b42a6.akpm@osdl.org> <1163625058.5968.64.camel@twins> <20061115132340.3cbf4008.akpm@osdl.org> <1163626378.5968.74.camel@twins> <20061115140049.c835fbfd.akpm@osdl.org> <1163628739.31358.164.camel@laptopd505.fenrus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org Return-Path: To: Arjan van de Ven Cc: Peter Zijlstra , linux-mm List-ID: On Wed, 15 Nov 2006 23:12:19 +0100 Arjan van de Ven wrote: > On Wed, 2006-11-15 at 14:00 -0800, Andrew Morton wrote: > > On Wed, 15 Nov 2006 22:32:58 +0100 > > Peter Zijlstra wrote: > > > > > + current->flags |= PF_MEMALLOC; > > > try_to_free_pages(zones, GFP_NOFS); > > > + current->flags &= ~PF_MEMALLOC; > > > > Sometime, later, in a different patch, we might as well suck that into > > try_to_free_pages() itself. Along with nice comment explaining > > what it means and WARN_ON(current->flags & PF_MEMALLOC). > > also I've seen a few cases where this will break. > If you already *have* PF_MEMALLOC you'd lose it here; it's generally a > mistake to do so. It's a lot safer to save the old value and restore > it... it does: + if (*zones && !(current->flags & PF_MEMALLOC)) { + current->flags |= PF_MEMALLOC; try_to_free_pages(zones, GFP_NOFS); + current->flags &= ~PF_MEMALLOC; + } -- 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