From: Ying Han <yinghan@google.com>
To: linux-mm@kvack.org
Cc: Rik van Riel <riel@redhat.com>, Hugh Dickins <hughd@google.com>,
Minchan Kim <minchan.kim@gmail.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] mm: don't flush TLB when propagate PTE access bit to struct page.
Date: Wed, 27 Oct 2010 10:21:30 -0700 [thread overview]
Message-ID: <1288200090-23554-1-git-send-email-yinghan@google.com> (raw)
kswapd's use case of hardware PTE accessed bit is to approximate page LRU. The
ActiveLRU demotion to InactiveLRU are not base on accessed bit, while it is only
used to promote when a page is on inactive LRU list. All of the state transitions
are triggered by memory pressure and thus has weak relationship with respect to
time. In addition, hardware already transparently flush tlb whenever CPU context
switch processes and given limited hardware TLB resource, the time period in
which a page is accessed but not yet propagated to struct page is very small
in practice. With the nature of approximation, kernel really don't need to flush TLB
for changing PTE's access bit. This commit removes the flush operation from it.
Signed-off-by: Ying Han <yinghan@google.com>
Singed-off-by: Ken Chen <kenchen@google.com>
---
include/linux/mmu_notifier.h | 12 ++++++++++++
mm/rmap.c | 2 +-
2 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index 4e02ee2..be32c51 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -254,6 +254,17 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
__young; \
})
+#define ptep_clear_young_notify(__vma, __address, __ptep) \
+({ \
+ int __young; \
+ struct vm_area_struct *___vma = __vma; \
+ unsigned long ___address = __address; \
+ __young = ptep_test_and_clear_young(___vma, ___address, __ptep);\
+ __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \
+ ___address); \
+ __young; \
+})
+
#define set_pte_at_notify(__mm, __address, __ptep, __pte) \
({ \
struct mm_struct *___mm = __mm; \
@@ -304,6 +315,7 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
{
}
+#define ptep_clear_young_notify ptep_test_and_clear_young
#define ptep_clear_flush_young_notify ptep_clear_flush_young
#define ptep_clear_flush_notify ptep_clear_flush
#define set_pte_at_notify set_pte_at
diff --git a/mm/rmap.c b/mm/rmap.c
index 92e6757..96f2553 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -506,7 +506,7 @@ int page_referenced_one(struct page *page, struct vm_area_struct *vma,
goto out_unmap;
}
- if (ptep_clear_flush_young_notify(vma, address, pte)) {
+ if (ptep_clear_young_notify(vma, address, pte)) {
/*
* Don't treat a reference through a sequentially read
* mapping as such. If the page has been used in
--
1.7.1
--
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:[~2010-10-27 17:21 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-27 17:21 Ying Han [this message]
2010-10-27 18:05 ` Rik van Riel
2010-10-27 18:22 ` Nick Piggin
2010-10-27 18:37 ` Nick Piggin
2010-10-27 19:13 ` Hugh Dickins
2010-10-27 20:35 ` Ying Han
2010-10-28 0:11 ` KAMEZAWA Hiroyuki
2010-10-29 1:30 ` Ken Chen
2010-10-29 2:45 ` KAMEZAWA Hiroyuki
2010-10-29 3:43 ` Rik van Riel
2010-10-29 4:27 ` Minchan Kim
2010-10-29 12:31 ` Rik van Riel
2010-10-29 13:03 ` Minchan Kim
2010-10-29 13:15 ` Rik van Riel
2010-10-30 0:20 ` Minchan Kim
2010-10-27 20:19 ` Ying Han
2010-10-28 11:53 ` Rik van Riel
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=1288200090-23554-1-git-send-email-yinghan@google.com \
--to=yinghan@google.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=minchan.kim@gmail.com \
--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