Skip to contentSkip to conversation

Do not disable interrupts when reading min_free_kbytes

PATCH New Mel Gorman 1 participant 1 message Mar 26, 2007

Subsystems (2)
lore
Share & tools
lore

Mel Gorman

author
#0 lore raw

PATCH 1/1 Do not disable interrupts when reading min_free_kbytes

The sysctl handler for min_free_kbytes calls setup_per_zone_pages_min() on read or write. This function iterates through every zone and calls spin_lock_irqsave() on the zone LRU lock. When reading min_free_kbytes, this is a total waste of time that disables interrupts on the local processor. It might even be noticable machines with large numbers of zones if a process started constantly reading min_free_kbytes.

This patch only calls setup_per_zone_pages_min() only on write. Tested on an x86 laptop and it did the right thing.

---

 page_alloc.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
mm/page_alloc.c +2 -1
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.21-rc4-mm1-norsdl/mm/page_alloc.c linux-2.6.21-rc4-mm1-nodisable_on_read_minfree/mm/page_alloc.c
@@ -3956,7 +3956,8 @@ int min_free_kbytes_sysctl_handler(ctl_t
 	struct file *file, void __user *buffer, size_t *length, loff_t *ppos)
 {
 	proc_dointvec(table, write, file, buffer, length, ppos);
-	setup_per_zone_pages_min();
+	if (write)
+		setup_per_zone_pages_min();
 	return 0;
 }
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>