Re: [PATCH 01/34] mm, vmstat: add infrastructure for per-node vmstats

From: Reza Arbab
Date: Wed Aug 03 2016 - 16:48:23 EST


On Fri, Jul 08, 2016 at 10:34:37AM +0100, Mel Gorman wrote:
void refresh_zone_stat_thresholds(void)
{
[...]
+ /* Zero current pgdat thresholds */
+ for_each_online_pgdat(pgdat) {
+ for_each_online_cpu(cpu) {
+ per_cpu_ptr(pgdat->per_cpu_nodestats, cpu)->stat_threshold = 0;
+ }
+ }

I am oopsing here, for a node whose pgdat->per_cpu_nodestats is NULL.

The node in question is memoryless, so in setup_per_cpu_pageset(), the loop over its populated zones doesn't run, and the per_cpu_nodestat struct isn't allocated.

This patch fixes things for me:

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ea759b9..5221e17 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5271,9 +5271,17 @@ static void __meminit setup_zone_pageset(struct zone *zone)
void __init setup_per_cpu_pageset(void)
{
struct zone *zone;
+ struct pglist_data *pgdat;
for_each_populated_zone(zone)
setup_zone_pageset(zone);
+
+ for_each_online_pgdat(pgdat) {
+ if (!pgdat->per_cpu_nodestats) {
+ pgdat->per_cpu_nodestats =
+ alloc_percpu(struct per_cpu_nodestat);
+ }
+ }
}
static noinline __init_refok


--
Reza Arbab