[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20131015203540.460D7F91@viggo.jf.intel.com>
Date: Tue, 15 Oct 2013 13:35:40 -0700
From: Dave Hansen <dave@...1.net>
To: linux-mm@...ck.org
Cc: linux-kernel@...r.kernel.org,
Cody P Schafer <cody@...ux.vnet.ibm.com>,
Andi Kleen <ak@...ux.intel.com>, cl@...two.org,
Andrew Morton <akpm@...ux-foundation.org>,
Mel Gorman <mel@....ul.ie>, Dave Hansen <dave@...1.net>
Subject: [RFC][PATCH 2/8] mm: pcp: consolidate percpu_pagelist_fraction code
From: Dave Hansen <dave.hansen@...ux.intel.com>
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 <dave.hansen@...ux.intel.com>
---
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;
}
_
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists