Skip to contentSkip to conversation

mm: single pcp lists

RFC PATCH In review Nick Piggin 3 participants 4 messages Feb 22, 2006 – Feb 23, 2006

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 mm: single pcp lists

Having a hot and a cold pcp list means that:

- cold pages are overlooked when when a hot page is needed but none available.
- when the hot list spills, it doesn't fill the cold list if it is low.

Use a single pcp list to solve both these problems. Disallow cold page allocation from taking hot pages though.

include/linux/mmzone.h +3 -5
Index: linux-2.6/include/linux/mmzone.h
===================================================================
@@ -44,15 +44,13 @@ struct zone_padding {
 #define ZONE_PADDING(name)
 #endif
 
-struct per_cpu_pages {
+struct per_cpu_pageset {
+	struct list_head list;	/* the list of pages */
 	int count;		/* number of pages in the list */
+	int cold_count;		/* number of cold pages in the list */
 	int high;		/* high watermark, emptying needed */
 	int batch;		/* chunk size for buddy add/remove */
-	struct list_head list;	/* the list of pages */
-};
 
-struct per_cpu_pageset {
-	struct per_cpu_pages pcp[2];	/* 0: hot.  1: cold */
 #ifdef CONFIG_NUMA
 	unsigned long numa_hit;		/* allocated in intended node */
 	unsigned long numa_miss;	/* allocated in non intended node */
mm/page_alloc.c +78 -97

268 lines not on this page · raw message

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw

PATCH 1/1 mm: pcp stats

Following patch offers some stats about pageset activity.

mm/page_alloc.c +8 -0
Index: linux-2.6/mm/page_alloc.c
===================================================================
@@ -720,6 +720,7 @@ static void fastcall free_hot_cold_page(
 	pset = zone_pcp(zone, get_cpu());
 	local_irq_save(flags);
 	__inc_page_state(pgfree);
+	__inc_page_state(pcpfree);
 	pset->count++;
 	if (cold) {
 		pset->cold_count++;
@@ -733,6 +734,7 @@ static void fastcall free_hot_cold_page(
 		free_pages_bulk(zone, count, &pset->list, 0);
 		pset->cold_count -= min(count, pset->cold_count);
 		pset->count -= count;
+		__mod_page_state(pcpspill, count);
 	}
 	local_irq_restore(flags);
 	put_cpu();
@@ -794,8 +796,10 @@ again:
 				goto failed;
 			pset->count += count;
 			pset->cold_count += count;
+			__mod_page_state(pcpfill, count);
 		}
 
+		__inc_page_state(pcpalloc);
 		pset->count--;
 		if (cold) {
 			page = list_entry(pset->list.prev, struct page, lru);
@@ -2319,6 +2323,10 @@ static char *vmstat_text[] = {
 	"pgalloc_dma",
 
 	"pgfree",
+	"pcpalloc",
+	"pcpfree",
+	"pcpfill",
+	"pcpspill",
 	"pgactivate",
 	"pgdeactivate",
 
include/linux/page-flags.h +4 -0
Index: linux-2.6/include/linux/page-flags.h
===================================================================
@@ -117,6 +117,10 @@ struct page_state {
 	unsigned long pgalloc_dma;
 
 	unsigned long pgfree;		/* page freeings */
+	unsigned long pcpalloc;		/* pages allocated from pcp lists */
+	unsigned long pcpfree;		/* pages freed into pcp lists */
+	unsigned long pcpfill;		/* pages allocated into pcp lists */
+	unsigned long pcpspill;		/* pages freed from pcp lists */
 	unsigned long pgactivate;	/* pages moved inactive->active */
 	unsigned long pgdeactivate;	/* pages moved active->inactive */
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
In reply to Nick Piggin

include/linux/mmzone.h struct zone_padding { · line 52

Quoted 9 lines
include/linux/mmzone.h +3 -3
-struct per_cpu_pages {
+struct per_cpu_pageset {
+	struct list_head list;	/* the list of pages */
 	int count;		/* number of pages in the list */
+	int cold_count;		/* number of cold pages in the list */
 	int high;		/* high watermark, emptying needed */
 	int batch;		/* chunk size for buddy add/remove */
-	struct list_head list;	/* the list of pages */
-};

Any particular reason to move the list_head to the front?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
Quoted 4 lines · Joel Schopp
Quoted 4 lines
include/linux/mmzone.h +2 -1
-struct per_cpu_pages {
+struct per_cpu_pageset {
+    struct list_head list;    /* the list of pages */
     int count;        /* number of pages in the list */
Quoted 9 lines

include/linux/mmzone.h struct zone_padding { · line 52

Quoted 5 lines
include/linux/mmzone.h +1 -2
+    int cold_count;        /* number of cold pages in the list */
     int high;        /* high watermark, emptying needed */
     int batch;        /* chunk size for buddy add/remove */
-    struct list_head list;    /* the list of pages */
-};

Any particular reason to move the list_head to the front?

Nothing particular. I think it was for alignment at one stage before cold_count was added.

Signature · 8 lines
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>