Skip to contentSkip to conversation

noninterfering drop_page()

PATCH William Lee Irwin III 2 participants 3 messages May 22, 2002 – May 23, 2002

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Brewed this up a while ago as part of the rmap_locking project, though the forward port itself hasn't gone through much more than a test boot. Let me know how it goes.

Cheers,
Bill

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:

#	           ChangeSet	1.423   -> 1.424  
#	include/linux/swap.h	1.34    -> 1.35   
#	  include/linux/mm.h	1.43    -> 1.44   
#	         mm/vmscan.c	1.69    -> 1.70   
#	           mm/swap.c	1.20    -> 1.21   

#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/05/21 [email protected] 1.424
# Noninterfering drop_page(). Doesn't grab at the global lock, but rather sets a per-page flag

# signalling to VM scanning that the page should be aggressively reclaimed.
# --------------------------------------------
#
diff --minimal -Nru a/include/linux/mm.h b/include/linux/mm.h
--- a/include/linux/mm.h	Tue May 21 22:08:14 2002
+++ b/include/linux/mm.h	Tue May 21 22:08:14 2002
@@ -306,6 +306,7 @@
 #define PG_reserved		14
 #define PG_launder		15	/* written out by VM pressure.. */
 #define PG_chainlock		16	/* lock bit for ->pte_chain */
+#define PG_drop			17	/* hint bit to drop a page */

/* Make it prettier to test the above... */
#define UnlockPage(page) unlock_page(page)
@@ -322,6 +323,9 @@
#define SetPageChecked(page) set_bit(PG_checked, &(page)->flags)
#define PageLaunder(page) test_bit(PG_launder, &(page)->flags)
#define SetPageLaunder(page) set_bit(PG_launder, &(page)->flags)
+#define PageDrop(page) test_bit(PG_drop, &(page)->flags)
+#define SetPageDrop(page) set_bit(PG_drop, &(page)->flags)
+#define ClearPageDrop(page) clear_bit(PG_drop, &(page)->flags)

/*
* inlines for acquisition and release of PG_chainlock

include/linux/swap.h +1 -0
diff --minimal -Nru a/include/linux/swap.h b/include/linux/swap.h
@@ -123,6 +123,7 @@
 extern void FASTCALL(deactivate_page(struct page *));
 extern void FASTCALL(deactivate_page_nolock(struct page *));
 extern void FASTCALL(drop_page(struct page *));
+extern void FASTCALL(deactivate_dropped_page(struct page *));
 
 extern void swap_setup(void);
 
mm/swap.c +32 -18

67 lines not on this page · raw message

mm/vmscan.c +2 -2
diff --minimal -Nru a/mm/vmscan.c b/mm/vmscan.c
@@ -506,10 +506,10 @@
 		 * both PG_locked and the pte_chain_lock are held.
 		 */
 		pte_chain_lock(page);
-		if (!page_mapping_inuse(page)) {
+		if (PageDrop(page) || !page_mapping_inuse(page)) {
+			deactivate_dropped_page(page);
 			pte_chain_unlock(page);
 			UnlockPage(page);
-			drop_page(page);
 			continue;
 		}
 

--
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/

#1 lore raw
Quoted 6 lines · William Lee Irwin III

Brewed this up a while ago as part of the rmap_locking project, though the forward port itself hasn't gone through much more than a test boot.

# 02/05/21 [email protected] 1.424
# Noninterfering drop_page(). Doesn't grab at the global lock, but rather sets a per-page flag

# signalling to VM scanning that the page should be aggressively reclaimed.

This means we would reclaim normal inactive pages before looking at the "dropped" pages that still linger on the active list.

I'm not sure what this patch achieves except for disabling drop-behind (you'll end up reclaiming non-mapped pagecache pages in something resembling FIFO order).

regards,

Rik

Signature · 8 lines
Bravely reimplemented by the knights who say "NIH".

http://www.surriel.com/		http://distro.conectiva.com/

--
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/
#2 lore raw
In reply to William Lee Irwin III
Quoted 5 lines · William Lee Irwin III
Quoted 5 lines

Brewed this up a while ago as part of the rmap_locking project, though
the forward port itself hasn't gone through much more than a test boot.
# 02/05/21 [email protected] 1.424
# Noninterfering drop_page(). Doesn't grab at the global lock, but rather sets a per-page flag

# signalling to VM scanning that the page should be aggressively reclaimed.
Quoted 6 lines · Rik van Riel

This means we would reclaim normal inactive pages before looking at the "dropped" pages that still linger on the active list.
I'm not sure what this patch achieves except for disabling drop-behind (you'll end up reclaiming non-mapped pagecache pages in something resembling FIFO order).

Okay, I didn't want to do semantic damage but it happened anyway. There seems to be some kind of unexpected (by me) dependency on list ordering. There are other ways to mitigate the grabbing at the global lock (which I've in fact already implemented), although none quite so effective as the per-page business. Which doesn't mean much as a lock grab is not going to cost anywhere near as much as inaccurate page replacement, so drop this one.

Cheers,
Bill
--
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/