mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Lameter <clameter@sgi.com>
To: linux-kernel@vger.kernel.org
Cc: Christoph Lameter <clameter@sgi.com>, lhms-devel@lists.sourceforge.net
Subject: [PATCH 6/6] Direct Migration V3: SWAP_REFERENCE for try_to_unmap()
Date: Fri, 18 Nov 2005 12:31:36 -0800 (PST)	[thread overview]
Message-ID: <20051118203136.27780.51903.sendpatchset@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20051118203105.27780.9782.sendpatchset@schroedinger.engr.sgi.com>

Distinguish in try_to_umap_one between the case when the page is truly
unswappable from the case when the page was recently referenced.

The page migration code uses try_to_unmap_one and can avoid calling
try_to_unmap again if there was a persistent failure.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.15-rc1-mm2/include/linux/rmap.h
===================================================================
--- linux-2.6.15-rc1-mm2.orig/include/linux/rmap.h	2005-11-18 12:28:37.000000000 -0800
+++ linux-2.6.15-rc1-mm2/include/linux/rmap.h	2005-11-18 12:28:44.000000000 -0800
@@ -122,6 +122,7 @@ unsigned long page_address_in_vma(struct
  */
 #define SWAP_SUCCESS	0
 #define SWAP_AGAIN	1
-#define SWAP_FAIL	2
+#define SWAP_REFERENCE	2
+#define SWAP_FAIL	3
 
 #endif	/* _LINUX_RMAP_H */
Index: linux-2.6.15-rc1-mm2/mm/rmap.c
===================================================================
--- linux-2.6.15-rc1-mm2.orig/mm/rmap.c	2005-11-18 12:28:37.000000000 -0800
+++ linux-2.6.15-rc1-mm2/mm/rmap.c	2005-11-18 12:28:44.000000000 -0800
@@ -552,15 +552,20 @@ static int try_to_unmap_one(struct page 
 
 	/*
 	 * If the page is mlock()d, we cannot swap it out.
-	 * If it's recently referenced (perhaps page_referenced
-	 * skipped over this mm) then we should reactivate it.
 	 */
-	if ((vma->vm_flags & VM_LOCKED) ||
-			ptep_clear_flush_young(vma, address, pte)) {
+	if (vma->vm_flags & VM_LOCKED) {
 		ret = SWAP_FAIL;
 		goto out_unmap;
 	}
 
+	/* If the page is recently referenced (perhaps page_referenced
+	 * skipped over this mm) then we should reactivate it.
+ 	 */
+	if (ptep_clear_flush_young(vma, address, pte)) {
+		ret = SWAP_REFERENCE;
+		goto out_unmap;
+	}
+
 	/* Nuke the page table entry. */
 	flush_cache_page(vma, address, page_to_pfn(page));
 	pteval = ptep_clear_flush(vma, address, pte);
@@ -710,7 +715,9 @@ static int try_to_unmap_anon(struct page
 
 	list_for_each_entry(vma, &anon_vma->head, anon_vma_node) {
 		ret = try_to_unmap_one(page, vma);
-		if (ret == SWAP_FAIL || !page_mapped(page))
+		if (ret == SWAP_FAIL ||
+		    ret == SWAP_REFERENCE ||
+		    !page_mapped(page))
 			break;
 	}
 	spin_unlock(&anon_vma->lock);
@@ -741,7 +748,9 @@ static int try_to_unmap_file(struct page
 	spin_lock(&mapping->i_mmap_lock);
 	vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) {
 		ret = try_to_unmap_one(page, vma);
-		if (ret == SWAP_FAIL || !page_mapped(page))
+		if (ret == SWAP_FAIL ||
+		    ret == SWAP_REFERENCE ||
+		    !page_mapped(page))
 			goto out;
 	}
 
@@ -823,7 +832,9 @@ out:
  *
  * SWAP_SUCCESS	- we succeeded in removing all mappings
  * SWAP_AGAIN	- we missed a mapping, try again later
+ * SWAP_REFERENCE - the page was recently referenced
  * SWAP_FAIL	- the page is unswappable
+ *
  */
 int try_to_unmap(struct page *page)
 {
Index: linux-2.6.15-rc1-mm2/mm/vmscan.c
===================================================================
--- linux-2.6.15-rc1-mm2.orig/mm/vmscan.c	2005-11-18 12:28:41.000000000 -0800
+++ linux-2.6.15-rc1-mm2/mm/vmscan.c	2005-11-18 12:28:44.000000000 -0800
@@ -470,6 +470,7 @@ static int shrink_list(struct list_head 
 		 */
 		if (page_mapped(page) && mapping) {
 			switch (try_to_unmap(page)) {
+			case SWAP_REFERENCE:
 			case SWAP_FAIL:
 				goto activate_locked;
 			case SWAP_AGAIN:
@@ -709,8 +710,9 @@ int migrate_page_remove_references(struc
 	for(i = 0; i < 10 && page_mapped(page); i++) {
 		int rc = try_to_unmap(page);
 
-		if (rc == SWAP_SUCCESS)
+		if (rc == SWAP_SUCCESS || rc == SWAP_FAIL)
 			break;
+
 		/*
 		 * If there are other runnable processes then running
 		 * them may make it possible to unmap the page

      parent reply	other threads:[~2005-11-18 20:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-18 20:31 [PATCH 0/6] Direct Migration V4: Overview Christoph Lameter
2005-11-18 20:31 ` [PATCH 1/6] Direct Migration V4: PageSwapCache checks Christoph Lameter
2005-11-18 20:31 ` [PATCH 2/6] Direct Migration V4: migrate_pages() extension Christoph Lameter
2005-11-18 20:31 ` [PATCH 3/6] Direct Migration V4: remove_from_swap() to remove swap ptes Christoph Lameter
2005-11-18 20:31 ` [PATCH 4/6] Direct Migration V4: upgrade MPOL_MF_MOVE and sys_migrate_pages() Christoph Lameter
2005-11-18 20:31 ` [PATCH 5/6] Direct Migration V4: Avoid writeback / page_migrate() method Christoph Lameter
2005-11-18 20:31 ` Christoph Lameter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051118203136.27780.51903.sendpatchset@schroedinger.engr.sgi.com \
    --to=clameter@sgi.com \
    --cc=lhms-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome