From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751312AbXBUPc1 (ORCPT ); Wed, 21 Feb 2007 10:32:27 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751310AbXBUPc0 (ORCPT ); Wed, 21 Feb 2007 10:32:26 -0500 Received: from mx1.redhat.com ([66.187.233.31]:54814 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751312AbXBUPcY (ORCPT ); Wed, 21 Feb 2007 10:32:24 -0500 Message-Id: <20070221144842.202934000@taijtu.programming.kicks-ass.net> References: <20070221144304.512721000@taijtu.programming.kicks-ass.net> User-Agent: quilt/0.46-1 Date: Wed, 21 Feb 2007 15:43:11 +0100 From: Peter Zijlstra To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org Cc: Peter Zijlstra , Trond Myklebust , Thomas Graf , David Miller Subject: [PATCH 07/29] mm: allow mempool to fall back to memalloc reserves Content-Disposition: inline; filename=mm-mempool_fixup.patch Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Allow the mempool to use the memalloc reserves when all else fails and the allocation context would otherwise allow it. Signed-off-by: Peter Zijlstra --- mm/mempool.c | 10 ++++++++++ 1 file changed, 10 insertions(+) Index: linux-2.6-git/mm/mempool.c =================================================================== --- linux-2.6-git.orig/mm/mempool.c 2007-01-12 08:03:44.000000000 +0100 +++ linux-2.6-git/mm/mempool.c 2007-01-12 10:38:57.000000000 +0100 @@ -14,6 +14,7 @@ #include #include #include +#include "internal.h" static void add_element(mempool_t *pool, void *element) { @@ -229,6 +230,15 @@ repeat_alloc: } spin_unlock_irqrestore(&pool->lock, flags); + /* if we really had right to the emergency reserves try those */ + if (gfp_to_alloc_flags(gfp_mask) & ALLOC_NO_WATERMARKS) { + if (gfp_temp & __GFP_NOMEMALLOC) { + gfp_temp &= ~(__GFP_NOMEMALLOC|__GFP_NOWARN); + goto repeat_alloc; + } else + gfp_temp |= __GFP_NOMEMALLOC|__GFP_NOWARN; + } + /* We must not sleep in the GFP_ATOMIC case */ if (!(gfp_mask & __GFP_WAIT)) return NULL; --