Skip to contentSkip to conversation

lazy_buddy-2.5.25-4

PATCH William Lee Irwin III 1 participant 1 message Jul 13, 2002

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

After still more prodding here is yet another release of my lazy buddy algorithm -based deferred coalescing patch for the Linux page allocator. Basically, other people saw the bugs I postponed fixing on my TODO list and said "fix it" so here are the TODO items addressed.

At some point I'll be able to let this sit for a while and go back to finding ways to make highpte_chain not look like a train wreck.

This release features conversion of /proc/fraginfo to seq_file and the fix for the theoretical bug (never seen in practice) where spurious allocation failures are reported due to higher-order pages trapped on deferred queues.

Testboot, kernel compile, tbench, and netperf tested on a 16 cpu i386 machine with 16GB of RAM.

TODO:
(1) make the buddy and deferred lists singly-linked
(2) find a better home for /proc/fraginfo somewhere in /proc/
(3) analyze cache performance
(4) get real benchmark numbers out of the thing as opposed to the one-shot few-rounds stuff I've done thus far. Thus far benefits for local network bandwidth and latency have been seen in lmbench and netperf.
(5) collect statistics on the allocation rates for various orders
(6) collect statistics on the allocation failures for various orders
(7) collect statistics on allocation failures due to frgamentation
(8) collect qualitative information on long-term fragmentation

Follow-on patch TODO item:
(9) integration with upcoming gang allocation patches
(10) gang preassembly and bulk transfer to and from per-cpu pools.

This patch is also available from:
ftp://ftp.kernel.org/pub/linux/kernel/people/wli/vm/lazy_buddy/lazy_buddy-2.5.25-4 bk://linux-wli.bkbits.net/lazy_buddy/

Cheers,
Bill

fs/proc/proc_misc.c +21 -2
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.5/fs/proc/proc_misc.c lazy_buddy/fs/proc/proc_misc.c
@@ -132,6 +132,7 @@
 	struct sysinfo i;
 	int len;
 	struct page_state ps;
+	extern unsigned long nr_deferred_pages(void);
 
 	get_page_state(&ps);
 /*
@@ -159,7 +160,8 @@
 		"SwapTotal:    %8lu kB\n"
 		"SwapFree:     %8lu kB\n"
 		"Dirty:        %8lu kB\n"
-		"Writeback:    %8lu kB\n",
+		"Writeback:    %8lu kB\n"
+		"Deferred:     %8lu kB\n",
 		K(i.totalram),
 		K(i.freeram),
 		K(i.sharedram),
@@ -174,13 +176,29 @@
 		K(i.totalswap),
 		K(i.freeswap),
 		K(ps.nr_dirty),
-		K(ps.nr_writeback)
+		K(ps.nr_writeback),
+		K(nr_deferred_pages())
 		);
 
 	return proc_calc_metrics(page, start, off, count, eof, len);
 #undef K
 }
 
+extern struct seq_operations fragmentation_op;
+static int fragmentation_open(struct inode *inode, struct file *file)
+{
+	(void)inode;
+	return seq_open(file, &fragmentation_op);
+}
+
+static struct file_operations fragmentation_file_operations = {
+	open:		fragmentation_open,
+	read:		seq_read,
+	llseek:		seq_lseek,
+	release:	seq_release,
+};
+
+
 static int version_read_proc(char *page, char **start, off_t off,
 				 int count, int *eof, void *data)
 {
@@ -585,6 +603,7 @@
 	create_seq_entry("partitions", 0, &proc_partitions_operations);
 	create_seq_entry("interrupts", 0, &proc_interrupts_operations);
 	create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations);
+	create_seq_entry("fraginfo",S_IRUGO, &fragmentation_file_operations);
 #ifdef CONFIG_MODULES
 	create_seq_entry("modules", 0, &proc_modules_operations);
 	create_seq_entry("ksyms", 0, &proc_ksyms_operations);
include/linux/mmzone.h +3 -2
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.5/include/linux/mmzone.h lazy_buddy/include/linux/mmzone.h
@@ -20,8 +20,9 @@
 #endif
 
 typedef struct free_area_struct {
-	struct list_head	free_list;
-	unsigned long		*map;
+	unsigned long	globally_free, active, locally_free;
+	list_t		free_list, deferred_pages;
+	unsigned long	*map;
 } free_area_t;
 
 struct pglist_data;
mm/bootmem.c +4 -0
diff -Nur --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.5/mm/bootmem.c lazy_buddy/mm/bootmem.c
@@ -242,6 +242,7 @@
 	return ret;
 }
 
+extern void forced_coalesce(zone_t *zone);
 static unsigned long __init free_all_bootmem_core(pg_data_t *pgdat)
 {
 	struct page *page = pgdat->node_mem_map;
@@ -288,6 +289,9 @@
 	}
 	total += count;
 	bdata->node_bootmem_map = NULL;
+
+	for (i = 0; i < MAX_NR_ZONES; ++i)
+		forced_coalesce(&pgdat->node_zones[i]);
 
 	return total;
 }
mm/page_alloc.c +286 -23

442 lines not on this page · raw message