linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Rik van Riel <riel@redhat.com>,
	Lee Schermerhorn <lee.schermerhorn@hp.com>,
	Nick Piggin <nickpiggin@yahoo.com.au>,
	linux-mm@kvack.org
Subject: [PATCH 8/7] mm: further cleanup page_add_new_anon_rmap
Date: Sun, 23 Nov 2008 21:51:26 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0811232148430.3617@blonde.site> (raw)
In-Reply-To: <Pine.LNX.4.64.0811200120160.19216@blonde.site>

Moving lru_cache_add_active_or_unevictable() into page_add_new_anon_rmap()
was good but done stupidly: we should SetPageSwapBacked() there too; and
we know for sure that this anonymous, swap-backed page is not file cache.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
---
I suspect Nick might like to change it to __SetPageSwapBacked later.

 mm/memory.c |    3 ---
 mm/rmap.c   |    6 +++---
 2 files changed, 3 insertions(+), 6 deletions(-)

--- mmclean7/mm/memory.c	2008-11-19 15:26:28.000000000 +0000
+++ mmclean8/mm/memory.c	2008-11-22 19:02:35.000000000 +0000
@@ -1919,7 +1919,6 @@ gotten:
 		 * thread doing COW.
 		 */
 		ptep_clear_flush_notify(vma, address, page_table);
-		SetPageSwapBacked(new_page);
 		page_add_new_anon_rmap(new_page, vma, address);
 		set_pte_at(mm, address, page_table, entry);
 		update_mmu_cache(vma, address, entry);
@@ -2415,7 +2414,6 @@ static int do_anonymous_page(struct mm_s
 	if (!pte_none(*page_table))
 		goto release;
 	inc_mm_counter(mm, anon_rss);
-	SetPageSwapBacked(page);
 	page_add_new_anon_rmap(page, vma, address);
 	set_pte_at(mm, address, page_table, entry);
 
@@ -2563,7 +2561,6 @@ static int __do_fault(struct mm_struct *
 			entry = maybe_mkwrite(pte_mkdirty(entry), vma);
 		if (anon) {
 			inc_mm_counter(mm, anon_rss);
-			SetPageSwapBacked(page);
 			page_add_new_anon_rmap(page, vma, address);
 		} else {
 			inc_mm_counter(mm, file_rss);
--- mmclean7/mm/rmap.c	2008-11-19 15:26:33.000000000 +0000
+++ mmclean8/mm/rmap.c	2008-11-22 19:02:35.000000000 +0000
@@ -47,7 +47,6 @@
 #include <linux/rmap.h>
 #include <linux/rcupdate.h>
 #include <linux/module.h>
-#include <linux/mm_inline.h>
 #include <linux/kallsyms.h>
 #include <linux/memcontrol.h>
 #include <linux/mmu_notifier.h>
@@ -673,10 +672,11 @@ void page_add_new_anon_rmap(struct page 
 	struct vm_area_struct *vma, unsigned long address)
 {
 	VM_BUG_ON(address < vma->vm_start || address >= vma->vm_end);
-	atomic_set(&page->_mapcount, 0); /* elevate count by 1 (starts at -1) */
+	SetPageSwapBacked(page);
+	atomic_set(&page->_mapcount, 0); /* increment count (starts at -1) */
 	__page_set_anon_rmap(page, vma, address);
 	if (page_evictable(page, vma))
-		lru_cache_add_lru(page, LRU_ACTIVE + page_is_file_cache(page));
+		lru_cache_add_lru(page, LRU_ACTIVE);
 	else
 		add_page_to_unevictable_list(page);
 }

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

  parent reply	other threads:[~2008-11-23 21:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-20  1:10 [PATCH 0/7] mm: cleanups Hugh Dickins
2008-11-20  1:11 ` [PATCH 1/7] mm: remove cgroup_mm_owner_callbacks Hugh Dickins
2008-11-20  1:23   ` Paul Menage
2008-11-20  1:26     ` Hugh Dickins
2008-11-20 16:41       ` Balbir Singh
2008-11-20  1:14 ` [PATCH 2/7] mm: remove AOP_WRITEPAGE_ACTIVATE Hugh Dickins
2008-11-20  1:16 ` [PATCH 3/7] mm: remove GFP_HIGHUSER_PAGECACHE Hugh Dickins
2008-11-20 16:43   ` Mel Gorman
2008-11-20 18:58     ` Hugh Dickins
2008-11-21 10:46       ` Mel Gorman
2008-11-20  1:17 ` [PATCH 4/7] mm: add Set,ClearPageSwapCache stubs Hugh Dickins
2008-11-20 18:08   ` Christoph Lameter
2008-11-20  1:20 ` [PATCH 5/7] mm: replace some BUG_ONs by VM_BUG_ONs Hugh Dickins
2008-11-20 18:09   ` Christoph Lameter
2008-11-20  1:22 ` [PATCH 6/7] mm: add_active_or_unevictable into rmap Hugh Dickins
2008-11-20  2:08   ` Rik van Riel
2008-11-20 15:18     ` Lee Schermerhorn
2008-11-23 21:51   ` Hugh Dickins [this message]
2008-11-23 21:56     ` [PATCH 8/7] mm: further cleanup page_add_new_anon_rmap Rik van Riel
2008-11-23 22:18       ` Hugh Dickins
2008-11-23 22:41         ` Rik van Riel
2008-11-20  1:24 ` [PATCH 7/7] mm: make page_lock_anon_vma static Hugh Dickins
2008-11-21  8:29   ` KOSAKI Motohiro

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=Pine.LNX.4.64.0811232148430.3617@blonde.site \
    --to=hugh@veritas.com \
    --cc=akpm@linux-foundation.org \
    --cc=lee.schermerhorn@hp.com \
    --cc=linux-mm@kvack.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=riel@redhat.com \
    /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