Skip to contentSkip to conversation

false NUMA OOM

PATCH William Lee Irwin III 2 participants 3 messages Sep 17, 2002 Memory management

lore
Share & tools
lore
#0 lore raw

Well, there's an obvious problem. shrink_caches() hammers out_of_memory() when it has only looked at a single node. Something like this might help.

Totally untested. Problem discovered during 2 simultaneous dbench 512's on separate 12GB tmpfs fs's on a 32x NUMA-Q with 32GB of RAM.

Against 2.5.35.

Bill

vmscan.c renamed from vmscan.c.orig +13 -7
@@ -519,18 +519,24 @@
 shrink_caches(struct zone *classzone, int priority,
 		int gfp_mask, int nr_pages)
 {
+	pg_data_t *pgdat;
 	struct zone *first_classzone;
 	struct zone *zone;
+	int type;
 
 	first_classzone = classzone->zone_pgdat->node_zones;
-	zone = classzone;
-	while (zone >= first_classzone && nr_pages > 0) {
-		if (zone->free_pages <= zone->pages_high) {
-			nr_pages = shrink_zone(zone, priority,
-					gfp_mask, nr_pages);
+	for (type = classzone - first_classzone; type >= 0; --type)
+		for_each_pgdat(pgdat) {
+			zone = pgdat->node_zones + type;
+			if (!zone->size)
+				continue;
+			if (zone->free_pages <= zone->pages_high)
+				nr_pages = shrink_zone(zone, priority,
+							gfp_mask, nr_pages);
+			if (nr_pages <= 0)
+				return nr_pages;
 		}
-		zone--;
-	}
+
 	return nr_pages;
 }
 
#1 lore raw

vmscan.c line 530

Quoted 5 lines · William Lee Irwin III

...

vmscan.c renamed from vmscan.c.orig +3 -0
+       for (type = classzone - first_classzone; type >= 0; --type)
+               for_each_pgdat(pgdat) {
+                       zone = pgdat->node_zones + type;

Well you'd want to start with (and prefer) the local node's zones?

I'm also wondering whether one shouldn't just poke a remote kswapd and wait.

#2 lore raw

William Lee Irwin III wrote:
+ for (type = classzone - first_classzone; type >= 0; --type)
+ for_each_pgdat(pgdat) {
+ zone = pgdat->node_zones + type;

Quoted 3 lines · Andrew Morton

Well you'd want to start with (and prefer) the local node's zones? I'm also wondering whether one shouldn't just poke a remote kswapd and wait.

I just sort of rearranged what was already there so it wouldn't die quite so blatantly (i.e. minimal fix). Those are also sound methods.

Cheers,
Bill