Index: linux-2.6-git/kernel/sysctl.c =================================================================== --- linux-2.6-git.orig/kernel/sysctl.c 2010-02-05 16:48:27.000000000 +0100 +++ linux-2.6-git/kernel/sysctl.c 2010-02-05 16:48:58.000000000 +0100 @@ -259,6 +259,9 @@ #endif extern unsigned long perf_count_congestion_wait; +extern unsigned long perf_count_pages_direct_reclaim; +extern unsigned long perf_count_failed_pages_direct_reclaim; +extern unsigned long perf_count_failed_pages_direct_reclaim_but_progress; static struct ctl_table perf_table[] = { { .ctl_name = CTL_UNNUMBERED, @@ -268,6 +271,30 @@ .maxlen = sizeof(unsigned long), .proc_handler = &proc_doulongvec_minmax, }, + { + .ctl_name = CTL_UNNUMBERED, + .procname = "perf_count_pages_direct_reclaim", + .data = &perf_count_pages_direct_reclaim, + .maxlen = sizeof(unsigned long), + .mode = 0666, + .proc_handler = &proc_doulongvec_minmax, + }, + { + .ctl_name = CTL_UNNUMBERED, + .procname = "perf_count_failed_pages_direct_reclaim", + .data = &perf_count_failed_pages_direct_reclaim, + .maxlen = sizeof(unsigned long), + .mode = 0666, + .proc_handler = &proc_doulongvec_minmax, + }, + { + .ctl_name = CTL_UNNUMBERED, + .procname = "perf_count_failed_pages_direct_reclaim_but_progress", + .data = &perf_count_failed_pages_direct_reclaim_but_progress, + .maxlen = sizeof(unsigned long), + .mode = 0666, + .proc_handler = &proc_doulongvec_minmax, + }, { .ctl_name = 0 } }; Index: linux-2.6-git/mm/page_alloc.c =================================================================== --- linux-2.6-git.orig/mm/page_alloc.c 2010-02-05 16:48:07.000000000 +0100 +++ linux-2.6-git/mm/page_alloc.c 2010-02-05 16:48:58.000000000 +0100 @@ -1661,6 +1661,9 @@ return page; } +unsigned long perf_count_pages_direct_reclaim = 0; +unsigned long perf_count_failed_pages_direct_reclaim = 0; + /* The really slow allocator path where we enter direct reclaim */ static inline struct page * __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order, @@ -1697,6 +1700,13 @@ zonelist, high_zoneidx, alloc_flags, preferred_zone, migratetype); + + perf_count_pages_direct_reclaim++; + if (!page) + perf_count_failed_pages_direct_reclaim++; + if (!page && !(*did_some_progress)) + perf_count_failed_pages_direct_reclaim_but_progress++ + return page; }