From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933652Ab3JOUfo (ORCPT ); Tue, 15 Oct 2013 16:35:44 -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 S932802Ab3JOUfn (ORCPT ); Tue, 15 Oct 2013 16:35:43 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,502,1378882800"; d="scan'208";a="417342688" Subject: [RFC][PATCH 2/8] mm: pcp: consolidate percpu_pagelist_fraction code 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:40 -0700 References: <20131015203536.1475C2BE@viggo.jf.intel.com> In-Reply-To: <20131015203536.1475C2BE@viggo.jf.intel.com> Message-Id: <20131015203540.460D7F91@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_set_high_and_batch() and percpu_pagelist_fraction_sysctl_handler() both do the same calculation for establishing pcp->high: high = zone->managed_pages / percpu_pagelist_fraction; pageset_set_high_and_batch() also knows when it should be using the sysctl-provided value or the boot-time default behavior. There's no reason to keep percpu_pagelist_fraction_sysctl_handler()'s copy separate. So, consolidate them. The only bummer here is that pageset_set_high_and_batch() is currently __meminit. So, axe that and make it available at runtime. Signed-off-by: Dave Hansen --- linux.git-davehans/mm/page_alloc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff -puN mm/page_alloc.c~consolidate-percpu_pagelist_fraction-code mm/page_alloc.c --- linux.git/mm/page_alloc.c~consolidate-percpu_pagelist_fraction-code 2013-10-15 09:57:06.143624213 -0700 +++ linux.git-davehans/mm/page_alloc.c 2013-10-15 09:57:06.148624435 -0700 @@ -4183,7 +4183,7 @@ static void pageset_setup_from_high_mark pageset_update(&p->pcp, high, batch); } -static void __meminit pageset_set_high_and_batch(struct zone *zone, +static void pageset_set_high_and_batch(struct zone *zone, struct per_cpu_pageset *pcp) { if (percpu_pagelist_fraction) @@ -5785,14 +5785,10 @@ int percpu_pagelist_fraction_sysctl_hand return ret; mutex_lock(&pcp_batch_high_lock); - for_each_populated_zone(zone) { - unsigned long high; - high = zone->managed_pages / percpu_pagelist_fraction; + for_each_populated_zone(zone) for_each_possible_cpu(cpu) - pageset_setup_from_high_mark( - per_cpu_ptr(zone->pageset, cpu), - high); - } + pageset_set_high_and_batch(zone, + per_cpu_ptr(zone->pageset, cpu)); mutex_unlock(&pcp_batch_high_lock); return 0; } _