From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933749Ab3JOUfz (ORCPT ); Tue, 15 Oct 2013 16:35:55 -0400 Received: from mga11.intel.com ([192.55.52.93]:5534 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932499Ab3JOUfv (ORCPT ); Tue, 15 Oct 2013 16:35:51 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,502,1378882800"; d="scan'208";a="417342781" Subject: [RFC][PATCH 8/8] mm: pcp: create setup_boot_pageset() To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Cody P Schafer , Andi Kleen , cl@gentwo.org, Andrew Morton , Mel Gorman , Dave Hansen From: Dave Hansen Date: Tue, 15 Oct 2013 13:35:50 -0700 References: <20131015203536.1475C2BE@viggo.jf.intel.com> In-Reply-To: <20131015203536.1475C2BE@viggo.jf.intel.com> Message-Id: <20131015203550.AF0B233E@viggo.jf.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Hansen pageset_setup_from_batch_size() has one remaining call path: __build_all_zonelists() -> setup_pageset() -> pageset_setup_from_batch_size() And that one path is specialized. It is meant to essentially turn off the per-cpu-pagelists. It's also questionably buggy. It sets up a ->batch=1, but ->high=0, when called with batch=0 which is contrary to the comments in there that say: ->batch must never be higher then ->high. This patch creates a new function, setup_boot_pageset(). This just (more) directly sets ->high=1 and ->batch=1. It is functionally equiavlent to the existing (->high=0 and ->batch=1) code since high is really only used like this: pcp->count++; if (pcp->count >= pcp->high) { free_pcppages_bulk(zone, batch, pcp); pcp->count -= batch; } Looking at that if() above, if pcp->count=1, then if (pcp->count >= 1) and if (pcp->count >= 0) are equivalent, so it does not matter whether we set ->high=0 or ->high=1. I just find it much more intuitive to have ->high=1 since ->high=0 _looks_ invalid at first. Also note that this ends up net removing code. Signed-off-by: Dave Hansen --- linux.git-davehans/mm/page_alloc.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff -puN mm/page_alloc.c~setup_pageset-specialize mm/page_alloc.c --- linux.git/mm/page_alloc.c~setup_pageset-specialize 2013-10-15 09:57:07.869700754 -0700 +++ linux.git-davehans/mm/page_alloc.c 2013-10-15 09:57:07.874700976 -0700 @@ -3703,7 +3703,7 @@ static void build_zonelist_cache(pg_data * not check if the processor is online before following the pageset pointer. * Other parts of the kernel may not check if the zone is available. */ -static void setup_pageset(struct per_cpu_pageset *p, unsigned long batch); +static void setup_boot_pageset(struct per_cpu_pageset *p); static DEFINE_PER_CPU(struct per_cpu_pageset, boot_pageset); static void setup_zone_pageset(struct zone *zone); @@ -3750,7 +3750,7 @@ static int __build_all_zonelists(void *d * (a chicken-egg dilemma). */ for_each_possible_cpu(cpu) { - setup_pageset(&per_cpu(boot_pageset, cpu), 0); + setup_boot_pageset(&per_cpu(boot_pageset, cpu)); #ifdef CONFIG_HAVE_MEMORYLESS_NODES /* @@ -4125,20 +4125,6 @@ static void pageset_update(struct per_cp pcp->batch = batch; } -/* - * Set the batch size for hot per_cpu_pagelist, and derive - * the high water mark from the batch size. - */ -static void pageset_setup_from_batch_size(struct per_cpu_pageset *p, - unsigned long batch) -{ - unsigned long high; - high = pcp_high_to_batch_ratio * batch; - if (!batch) - batch = 1; - pageset_update(&p->pcp, high, batch); -} - static void pageset_init(struct per_cpu_pageset *p) { struct per_cpu_pages *pcp; @@ -4152,10 +4138,17 @@ static void pageset_init(struct per_cpu_ INIT_LIST_HEAD(&pcp->lists[migratetype]); } -static void setup_pageset(struct per_cpu_pageset *p, unsigned long batch) +/* + * Turn off per-cpu-pages until we have a the + * full percpu allocator up. + */ +static void setup_boot_pageset(struct per_cpu_pageset *p) { + unsigned long batch = 1; + unsigned long high = 1; + pageset_init(p); - pageset_setup_from_batch_size(p, batch); + pageset_update(&p->pcp, high, batch); } /* _