page coloring for the 2.2.20 kernel
Subsystems (4)
PATCH 1/1 page coloring for the 2.2.20 kernel
Hello. The following patch modifies the free list handling in the 2.2.20 kernel so that round-robin page coloring is performed.
The code seems to be stable. It's fast, handles allocation of contiguous pages by color, and uses the hierarchical nature of the free list to manufacture pages of the correct color when they are not queued up already.
On an Alpha with a 2MB L2 cache, kernel compiles are 1-2% faster and number crunching code that allocates big arrays runs much faster and more reliably.
If somebody can try out the patch on other than an Alpha, or can throw benchmarks at it, I'd be grateful. The 2.4 series kernel seems to use the same methods to allocate pages, so in principle the same modifications apply.
Please copy responses to this address, since I'm not subscribed to LKML.
Thanks,
jasonp
-------------------------------------------------------------------
diff -ruN linux-2.2.20/drivers/char/Config.in
linux-2.2.20a/drivers/char/Config.in
drivers/char/Config.in +1 -0
@@ -118,6 +118,7 @@ endmenu fi +tristate 'Page Coloring' CONFIG_PAGE_COLORING tristate '/dev/nvram support' CONFIG_NVRAM bool 'Enhanced Real Time Clock Support' CONFIG_RTC
diff -ruN linux-2.2.20/drivers/char/Makefile
linux-2.2.20a/drivers/char/Makefile
drivers/char/Makefile +5 -0
@@ -729,6 +729,11 @@ M_OBJS += $(sort $(filter $(module-list), $(obj-m))) +ifeq ($(CONFIG_PAGE_COLORING),m) + CONFIG_PAGE_COLORING_MODULE=y + M_OBJS += page_color.o +endif + include $(TOPDIR)/Rules.make fastdep:
diff -ruN linux-2.2.20/drivers/char/page_color.clinux-2.2.20a/drivers/char/page_color.c
drivers/char/page_color.c +166 -0
166 lines not on this page · raw message
diff -ruN linux-2.2.20/include/linux/sched.hlinux-2.2.20a/include/linux/sched.h
include/linux/sched.h +5 -0
@@ -353,6 +353,11 @@/* oom handling */ int oom_kill_try; + +#ifdef CONFIG_PAGE_COLORING_MODULE +unsigned int color_init; +unsigned int color_offset; +#endif };/*
kernel/ksyms.c +20 -0
@@ -447,4 +447,24 @@EXPORT_SYMBOL (_etext);EXPORT_SYMBOL (module_list); +#ifdef CONFIG_PAGE_COLORING_MODULE +extern unsigned int page_coloring; +extern unsigned int page_miss_count; +extern unsigned int page_hit_count; +extern unsigned int page_colors; +extern unsigned long *page_color_table; +extern spinlock_t page_alloc_lock; +void fill_color_pool (void ); +void empty_color_pool (void ); +unsigned int page_color_alloc (void ); +EXPORT_SYMBOL_NOVERS (page_coloring); +EXPORT_SYMBOL_NOVERS (page_miss_count); +EXPORT_SYMBOL_NOVERS (page_hit_count); +EXPORT_SYMBOL_NOVERS (page_colors); +EXPORT_SYMBOL_NOVERS (page_color_table); +EXPORT_SYMBOL_NOVERS (page_alloc_lock); +EXPORT_SYMBOL_NOVERS (fill_color_pool); +EXPORT_SYMBOL_NOVERS (empty_color_pool); +EXPORT_SYMBOL_NOVERS (page_color_alloc); +#endif
mm/page_alloc.c +280 -0
304 lines not on this page · raw message