From: Johannes Weiner <hannes@saeurebad.de>
To: Rik van Riel <riel@redhat.com>, Nick Piggin <npiggin@suse.de>,
Andrew Morton <akpm@linux-foundation.org>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Linux MM Mailing List <linux-mm@kvack.org>
Subject: [rfc] mm: more likely reclaim MADV_SEQUENTIAL mappings
Date: Tue, 21 Oct 2008 12:32:25 +0200 [thread overview]
Message-ID: <87d4hugrwm.fsf@saeurebad.de> (raw)
File pages mapped only in sequentially read mappings are perfect
reclaim canditates.
This makes MADV_SEQUENTIAL mappings behave like weak references, its
pages will be reclaimed unless they have a strong reference from a
normal mapping as well.
The patch changes the reclaim and the unmap path where they check if
the page has been referenced. In both cases, accesses through
sequentially read mappings will be ignored.
Signed-off-by: Johannes Weiner <hannes@saeurebad.de>
---
I'm afraid this is now quite a bit more aggressive than the earlier
version. When the fault path did a mark_page_access(), we wouldn't
reclaim a page when it has been faulted into several MADV_SEQUENTIAL
mappings but now we ignore *every* activity through such a mapping.
What do you think?
Perhaps we should note a reference if there are two or more accesses
through sequentially read mappings?
mm/memory.c | 3 ++-
mm/rmap.c | 13 +++++++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -337,8 +337,17 @@ static int page_referenced_one(struct pa
goto out_unmap;
}
- if (ptep_clear_flush_young_notify(vma, address, pte))
- referenced++;
+ if (ptep_clear_flush_young_notify(vma, address, pte)) {
+ /*
+ * Don't treat a reference through a sequentially read
+ * mapping as such. If the page has been used in
+ * another mapping, we will catch it; if this other
+ * mapping is already gone, the unmap path will have
+ * set PG_referenced or activated the page.
+ */
+ if (!VM_SequentialReadHint(vma))
+ referenced++;
+ }
/* Pretend the page is referenced if the task has the
swap token and is in the middle of a page fault. */
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -759,7 +759,8 @@ static unsigned long zap_pte_range(struc
else {
if (pte_dirty(ptent))
set_page_dirty(page);
- if (pte_young(ptent))
+ if (pte_young(ptent) &&
+ !VM_SequentialReadHint(vma))
mark_page_accessed(page);
file_rss--;
}
--
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 reply other threads:[~2008-10-21 10:32 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-21 10:32 Johannes Weiner [this message]
2008-10-21 10:43 ` Nick Piggin
2008-10-21 11:33 ` [patch] mm: more likely reclaim MADV_SEQUENTIAL mappings II Johannes Weiner
2008-10-21 22:13 ` Andrew Morton
2008-10-22 0:09 ` Johannes Weiner
2008-10-22 0:51 ` Johannes Weiner
2008-10-22 6:39 ` KOSAKI Motohiro
2008-10-22 7:15 ` Johannes Weiner
2008-10-22 7:41 ` Andrew Morton
2008-10-24 0:21 ` Johannes Weiner
2008-10-24 12:55 ` KOSAKI Motohiro
2008-10-24 14:02 ` Johannes Weiner
2008-10-24 14:31 ` Rik van Riel
2008-10-24 16:15 ` Johannes Weiner
2008-10-24 23:48 ` Johannes Weiner
2008-10-24 18:59 ` KOSAKI Motohiro
2008-10-21 14:40 ` [rfc] mm: more likely reclaim MADV_SEQUENTIAL mappings Rik van Riel
2008-10-21 15:20 ` Johannes Weiner
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=87d4hugrwm.fsf@saeurebad.de \
--to=hannes@saeurebad.de \
--cc=akpm@linux-foundation.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=npiggin@suse.de \
--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