From: Christoph Lameter <clameter@sgi.com>
To: linux-mm@kvack.org
Cc: akpm@osdl.org, Christoph Hellwig <hch@infradead.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
"Martin J. Bligh" <mbligh@mbligh.org>,
Arjan van de Ven <arjan@infradead.org>,
Nick Piggin <nickpiggin@yahoo.com.au>,
Matt Mackall <mpm@selenic.com>,
Christoph Lameter <clameter@sgi.com>,
Nigel Cunningham <nigel@nigel.suspend2.net>,
Rik van Riel <riel@redhat.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: [RFC 5/7] Consolidate new anonymous page code paths
Date: Mon, 5 Feb 2007 12:53:01 -0800 (PST) [thread overview]
Message-ID: <20070205205301.4500.41661.sendpatchset@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20070205205235.4500.54958.sendpatchset@schroedinger.engr.sgi.com>
Consolidate code to add an anonymous page in memory.c
There are two location in which we add anonymous pages. Both
implement the same logic. Create a new function add_anon_page()
to have a common code path.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: current/mm/memory.c
===================================================================
--- current.orig/mm/memory.c 2007-02-05 12:31:49.000000000 -0800
+++ current/mm/memory.c 2007-02-05 12:32:34.000000000 -0800
@@ -900,6 +900,17 @@ unsigned long zap_page_range(struct vm_a
}
/*
+ * Add a new anonymous page
+ */
+static void add_anon_page(struct vm_area_struct *vma, struct page *page,
+ unsigned long address)
+{
+ inc_mm_counter(vma->vm_mm, anon_rss);
+ lru_cache_add_active(page);
+ page_add_new_anon_rmap(page, vma, address);
+}
+
+/*
* Do a quick page-table lookup for a single page.
*/
struct page *follow_page(struct vm_area_struct *vma, unsigned long address,
@@ -2103,9 +2114,7 @@ static int do_anonymous_page(struct mm_s
page_table = pte_offset_map_lock(mm, pmd, address, &ptl);
if (!pte_none(*page_table))
goto release;
- inc_mm_counter(mm, anon_rss);
- lru_cache_add_active(page);
- page_add_new_anon_rmap(page, vma, address);
+ add_anon_page(vma, page, address);
} else {
/* Map the ZERO_PAGE - vm_page_prot is readonly */
page = ZERO_PAGE(address);
@@ -2249,11 +2258,9 @@ retry:
if (write_access)
entry = maybe_mkwrite(pte_mkdirty(entry), vma);
set_pte_at(mm, address, page_table, entry);
- if (anon) {
- inc_mm_counter(mm, anon_rss);
- lru_cache_add_active(new_page);
- page_add_new_anon_rmap(new_page, vma, address);
- } else {
+ if (anon)
+ add_anon_page(vma, new_page, address);
+ else {
inc_mm_counter(mm, file_rss);
page_add_file_rmap(new_page);
if (write_access) {
--
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>
next prev parent reply other threads:[~2007-02-05 20:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-05 20:52 [RFC 0/7] Move mlocked pages off the LRU and track them Christoph Lameter
2007-02-05 20:52 ` [RFC 1/7] Make try_to_unmap return a special exit code Christoph Lameter
2007-02-05 20:52 ` [RFC 2/7] Add PageMlocked() page state bit and lru infrastructure Christoph Lameter
2007-02-05 20:52 ` [RFC 3/7] Add NR_MLOCK ZVC Christoph Lameter
2007-02-05 20:52 ` [RFC 4/7] Logic to move mlocked pages Christoph Lameter
2007-02-05 20:53 ` Christoph Lameter [this message]
2007-02-05 20:53 ` [RFC 6/7] Avoid putting new mlocked anonymous pages on LRU Christoph Lameter
2007-02-05 20:53 ` [RFC 7/7] Opportunistically move mlocked pages off the LRU Christoph Lameter
2007-02-06 16:04 ` [RFC 0/7] Move mlocked pages off the LRU and track them Lee Schermerhorn
2007-02-06 16:50 ` Larry Woodman
2007-02-06 19:51 ` Andrew Morton
2007-02-07 10:51 ` Larry Woodman
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=20070205205301.4500.41661.sendpatchset@schroedinger.engr.sgi.com \
--to=clameter@sgi.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@osdl.org \
--cc=arjan@infradead.org \
--cc=hch@infradead.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=mbligh@mbligh.org \
--cc=mpm@selenic.com \
--cc=nickpiggin@yahoo.com.au \
--cc=nigel@nigel.suspend2.net \
--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;
as well as URLs for NNTP newsgroup(s).