Index: linux-2.6-git-2.6.31-bisect2/kernel/sysctl.c =================================================================== --- linux-2.6-git-2.6.31-bisect2.orig/kernel/sysctl.c +++ linux-2.6-git-2.6.31-bisect2/kernel/sysctl.c @@ -253,6 +253,8 @@ static int max_wakeup_granularity_ns = N #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; static struct ctl_table perf_table[] = { { .ctl_name = CTL_UNNUMBERED, @@ -262,6 +264,22 @@ static struct ctl_table perf_table[] = { .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 = 0 } }; Index: linux-2.6-git-2.6.31-bisect2/mm/page_alloc.c =================================================================== --- linux-2.6-git-2.6.31-bisect2.orig/mm/page_alloc.c +++ linux-2.6-git-2.6.31-bisect2/mm/page_alloc.c @@ -1605,6 +1605,9 @@ out: 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, @@ -1645,6 +1648,11 @@ __alloc_pages_direct_reclaim(gfp_t gfp_m zonelist, high_zoneidx, alloc_flags, preferred_zone, migratetype); + + perf_count_pages_direct_reclaim++; + if (!page) + perf_count_failed_pages_direct_reclaim++; + return page; }