Skip to contentSkip to conversation

ramdisk/VM fix

PATCH New Philipp Rumpf 1 participant 1 message Mar 8, 2001 MM swap

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ramdisk/VM fix

With the current rd.c code, we can get into a situation where there is a buffer-only page for data which is also in a page cache page with page->buffers != NULL. The current vmscan.c code never frees the page cache page in this scenario, effectively doubling ramdisk memory requirements.

Linus, I think this is a bugfix (tested against -ac kernels):

include/linux/swap.h +1 -1
diff -ur linux/include/linux/swap.h linux-prumpf/include/linux/swap.h
@@ -284,7 +284,7 @@
 #endif
 
 #define page_ramdisk(page) \
-	(page->buffers && (MAJOR(page->buffers->b_dev) == RAMDISK_MAJOR))
+	(page->buffers && (MAJOR(page->buffers->b_dev) == RAMDISK_MAJOR) && buffer_protected(page->buffers))
 
 extern spinlock_t swaplock;
 

I don't think I'm missing anything important ...