From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Christoph Lameter <clameter@sgi.com>
Cc: Nick Piggin <piggin@cyberone.com.au>,
Linus Torvalds <torvalds@osdl.org>, Andi Kleen <ak@suse.de>,
Rohit Seth <rohitseth@google.com>, Andrew Morton <akpm@osdl.org>,
mbligh@google.com, hugh@veritas.com, riel@redhat.com,
andrea@suse.de, arjan@infradead.org, apw@shadowen.org,
mel@csn.ul.ie, marcelo@kvack.org, anton@samba.org,
paulmck@us.ibm.com, linux-mm <linux-mm@kvack.org>
Subject: [RFC][PATCH 3/3] optimize follow_pages()
Date: Tue, 09 May 2006 22:44:22 +0200 [thread overview]
Message-ID: <1147207462.27680.21.camel@lappy> (raw)
In-Reply-To: <Pine.LNX.4.64.0605082234180.23795@schroedinger.engr.sgi.com>
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
Christoph Lameter suggested I pull set_page_dirty() out from under the
pte lock.
I reviewed the current calls and found the one in follow_page() a candidate
for the same treatment.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
include/linux/mm.h | 1 +
mm/memory.c | 12 +++++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
Index: linux-2.6/include/linux/mm.h
===================================================================
--- linux-2.6.orig/include/linux/mm.h 2006-05-08 18:53:34.000000000 +0200
+++ linux-2.6/include/linux/mm.h 2006-05-09 17:48:36.000000000 +0200
@@ -1015,6 +1015,7 @@ struct page *follow_page(struct vm_area_
#define FOLL_TOUCH 0x02 /* mark page accessed */
#define FOLL_GET 0x04 /* do get_page on page */
#define FOLL_ANON 0x08 /* give ZERO_PAGE if no pgtable */
+#define FOLL_DIRTY 0x10 /* the page was dirtied */
#ifdef CONFIG_PROC_FS
void vm_stat_account(struct mm_struct *, unsigned long, struct file *, long);
Index: linux-2.6/mm/memory.c
===================================================================
--- linux-2.6.orig/mm/memory.c 2006-05-09 09:17:12.000000000 +0200
+++ linux-2.6/mm/memory.c 2006-05-09 17:52:02.000000000 +0200
@@ -962,16 +962,22 @@ struct page *follow_page(struct vm_area_
if (unlikely(!page))
goto unlock;
- if (flags & FOLL_GET)
+ if (flags & (FOLL_GET | FOLL_TOUCH))
get_page(page);
if (flags & FOLL_TOUCH) {
if ((flags & FOLL_WRITE) &&
!pte_dirty(pte) && !PageDirty(page))
- set_page_dirty(page);
- mark_page_accessed(page);
+ flags |= FOLL_DIRTY;
}
unlock:
pte_unmap_unlock(ptep, ptl);
+ if (flags & FOLL_TOUCH) {
+ if (flags & FOLL_DIRTY)
+ set_page_dirty(page);
+ mark_page_accessed(page);
+ }
+ if (!(flags & FOLL_GET))
+ put_page(page);
out:
return 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>
next prev parent reply other threads:[~2006-05-09 20:44 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-05 20:35 [RFC][PATCH] tracking dirty pages in shared mappings Peter Zijlstra
2006-05-06 13:18 ` Nick Piggin
2006-05-06 13:34 ` Peter Zijlstra
2006-05-06 13:47 ` Nick Piggin
2006-05-06 15:29 ` Peter Zijlstra
2006-05-07 0:40 ` Nick Piggin
2006-05-07 3:43 ` Nick Piggin
2006-05-08 6:43 ` Christoph Lameter
2006-05-08 7:23 ` Peter Zijlstra
2006-05-08 19:20 ` [RFC][PATCH 1/2] tracking dirty pages in shared mappings -V3 Peter Zijlstra
2006-05-09 5:41 ` Christoph Lameter
2006-05-09 6:06 ` Peter Zijlstra
2006-05-09 20:44 ` [RFC][PATCH 1/3] tracking dirty pages in shared mappings -V4 Peter Zijlstra
2006-05-09 20:52 ` Peter Chubb
2006-05-09 20:55 ` Martin Bligh
2006-05-09 22:56 ` Brian Twichell
2006-05-10 0:24 ` Linus Torvalds
2006-05-10 0:29 ` Nick Piggin
2006-05-10 1:24 ` Linus Torvalds
2006-05-11 15:02 ` Andrew Morton
2006-05-11 16:39 ` Andy Whitcroft
2006-05-11 22:52 ` Christoph Lameter
2006-05-11 23:30 ` Linus Torvalds
2006-05-11 23:44 ` Andrew Morton
2006-05-12 0:10 ` Linus Torvalds
2006-05-12 8:07 ` Andy Whitcroft
2006-05-12 14:25 ` Martin J. Bligh
2006-05-14 15:58 ` Andy Whitcroft
2006-05-12 1:51 ` Nick Piggin
2006-05-12 4:30 ` Andrew Morton
2006-05-12 5:05 ` Nick Piggin
2006-05-12 7:06 ` Peter Zijlstra
2006-05-12 8:04 ` Nick Piggin
2006-05-12 8:52 ` Peter Zijlstra
2006-05-12 8:07 ` Nick Piggin
2006-05-12 4:51 ` Christoph Lameter
2006-05-09 20:44 ` [RFC][PATCH 2/3] throttle writers of shared mappings Peter Zijlstra
2006-05-09 22:54 ` Nick Piggin
2006-05-09 22:55 ` Nick Piggin
2006-05-10 6:25 ` Peter Zijlstra
2006-05-09 20:44 ` Peter Zijlstra [this message]
2006-05-10 6:30 ` [RFC][PATCH 3/3] optimize follow_pages() Peter Zijlstra
2006-05-08 19:24 ` [RFC][PATCH 2/2] throttle writers of shared mappings Peter Zijlstra
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=1147207462.27680.21.camel@lappy \
--to=a.p.zijlstra@chello.nl \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=andrea@suse.de \
--cc=anton@samba.org \
--cc=apw@shadowen.org \
--cc=arjan@infradead.org \
--cc=clameter@sgi.com \
--cc=hugh@veritas.com \
--cc=linux-mm@kvack.org \
--cc=marcelo@kvack.org \
--cc=mbligh@google.com \
--cc=mel@csn.ul.ie \
--cc=paulmck@us.ibm.com \
--cc=piggin@cyberone.com.au \
--cc=riel@redhat.com \
--cc=rohitseth@google.com \
--cc=torvalds@osdl.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;
as well as URLs for NNTP newsgroup(s).