From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail138.messagelabs.com (mail138.messagelabs.com [216.82.249.35]) by kanga.kvack.org (Postfix) with ESMTP id C4A026B006A for ; Sun, 22 Feb 2009 18:16:29 -0500 (EST) From: Mel Gorman Subject: [PATCH 07/20] Simplify the check on whether cpusets are a factor or not Date: Sun, 22 Feb 2009 23:17:16 +0000 Message-Id: <1235344649-18265-8-git-send-email-mel@csn.ul.ie> In-Reply-To: <1235344649-18265-1-git-send-email-mel@csn.ul.ie> References: <1235344649-18265-1-git-send-email-mel@csn.ul.ie> Sender: owner-linux-mm@kvack.org To: Mel Gorman , Linux Memory Management List Cc: Pekka Enberg , Rik van Riel , KOSAKI Motohiro , Christoph Lameter , Johannes Weiner , Nick Piggin , Linux Kernel Mailing List , Lin Ming , Zhang Yanmin List-ID: The check whether cpuset contraints need to be checked or not is complex and often repeated. This patch makes the check in advance to the comparison is simplier to compute. Signed-off-by: Mel Gorman --- mm/page_alloc.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 503d692..dc50c47 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1400,6 +1400,7 @@ get_page_from_freelist(gfp_t gfp_mask, nodemask_t *nodemask, unsigned int order, nodemask_t *allowednodes = NULL;/* zonelist_cache approximation */ int zlc_active = 0; /* set if using zonelist_cache */ int did_zlc_setup = 0; /* just call zlc_setup() one time */ + int alloc_cpuset = 0; (void)first_zones_zonelist(zonelist, high_zoneidx, nodemask, &preferred_zone); @@ -1410,6 +1411,12 @@ get_page_from_freelist(gfp_t gfp_mask, nodemask_t *nodemask, unsigned int order, VM_BUG_ON(order >= MAX_ORDER); +#ifdef CONFIG_CPUSETS + /* Determine in advance if the cpuset checks will be needed */ + if ((alloc_flags & ALLOC_CPUSET) && unlikely(number_of_cpusets > 1)) + alloc_cpuset = 1; +#endif + zonelist_scan: /* * Scan zonelist, looking for a zone with enough free. @@ -1420,8 +1427,8 @@ zonelist_scan: if (NUMA_BUILD && zlc_active && !zlc_zone_worth_trying(zonelist, z, allowednodes)) continue; - if ((alloc_flags & ALLOC_CPUSET) && - !cpuset_zone_allowed_softwall(zone, gfp_mask)) + if (alloc_cpuset) + if (!cpuset_zone_allowed_softwall(zone, gfp_mask)) goto try_next_zone; if (!(alloc_flags & ALLOC_NO_WATERMARKS)) { -- 1.5.6.5 -- 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