[PATCH 16 of 16] avoid some lock operation in vm fast path

Andrea Arcangeli
2007-06-08T20:08:16Z

# HG changeset patch
# User Andrea Arcangeli <andrea@suse.de>
# Date 1181332962 -7200
# Node ID 19fb832beb3c83b7bed13c1a2f54ec4e077cfc0d
# Parent 31ef5d0bf924fb47da144321f692f4fefebf5cf5
avoid some lock operation in vm fast path

Let's not bloat the kernel for numa. Not nice, but at least this way
perhaps somebody will clean it up instead of hiding the inefficiency in
there.

Signed-off-by: Andrea Arcangeli <andrea@suse.de>

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -223,8 +223,10 @@ struct zone {
unsigned long pages_scanned; /* since last reclaim */
int all_unreclaimable; /* All pages pinned */

+#ifdef CONFIG_NUMA
/* A count of how many reclaimers are scanning this zone */
atomic_t reclaim_in_progress;
+#endif

/* Zone statistics */
atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2650,7 +2650,9 @@ static void __meminit free_area_init_cor
INIT_LIST_HEAD(&zone->active_list);
INIT_LIST_HEAD(&zone->inactive_list);
zap_zone_vm_stats(zone);
+#ifdef CONFIG_NUMA
atomic_set(&zone->reclaim_in_progress, 0);
+#endif
if (!size)
continue;

diff --git a/mm/vmscan.c b/mm/vmscan.c
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -909,7 +909,9 @@ static unsigned long shrink_zone(int pri
unsigned long nr_to_scan;
unsigned long nr_reclaimed = 0;

+#ifdef CONFIG_NUMA
atomic_inc(&zone->reclaim_in_progress);
+#endif

/*
* Add one to `nr_to_scan' just to make sure that the kernel will
@@ -945,7 +947,9 @@ static unsigned long shrink_zone(int pri

throttle_vm_writeout(sc->gfp_mask);

+#ifdef CONFIG_NUMA
atomic_dec(&zone->reclaim_in_progress);
+#endif
return nr_reclaimed;
}