All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Hugh Dickins <hughd@google.com>, Rik van Riel <riel@redhat.com>,
	Mel Gorman <mgorman@suse.de>, Michal Hocko <mhocko@suse.cz>,
	Johannes Weiner <hannes@cmpxchg.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Minchan Kim <minchan@kernel.org>
Subject: [RFC 2/6] mm: keep dirty bit on anonymous page migration
Date: Wed,  3 Jun 2015 15:15:41 +0900	[thread overview]
Message-ID: <1433312145-19386-3-git-send-email-minchan@kernel.org> (raw)
In-Reply-To: <1433312145-19386-1-git-send-email-minchan@kernel.org>

Currently, If VM migrates anonymous page, we lose dirty bit of
page table entry. Instead, VM translates dirty bit of page table
as PG_dirty of page flags. It was okay because dirty bit of
page table for anonymous page was no matter to swap out.
Instead, VM took care of PG_dirty.

However, with introducing MADV_FREE, it's important to keep
page table's dirty bit because It could make MADV_FREE handling
logics more straighforward without taking care of PG_dirty.

This patch aims for preparing to remove PG_dirty check for MADV_FREE.

Signed-off-by: Minchan Kim <minchan@kernel.org>
---
 mm/migrate.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/migrate.c b/mm/migrate.c
index 236ee25e79d9..add30c3aaaa9 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -151,6 +151,10 @@ static int remove_migration_pte(struct page *new, struct vm_area_struct *vma,
 	if (is_write_migration_entry(entry))
 		pte = maybe_mkwrite(pte, vma);
 
+	/* MADV_FREE relies on pte_dirty. */
+	if (PageAnon(new))
+		pte = pte_mkdirty(pte);
+
 #ifdef CONFIG_HUGETLB_PAGE
 	if (PageHuge(new)) {
 		pte = pte_mkhuge(pte);
-- 
1.9.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>

WARNING: multiple messages have this Message-ID (diff)
From: Minchan Kim <minchan@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Hugh Dickins <hughd@google.com>, Rik van Riel <riel@redhat.com>,
	Mel Gorman <mgorman@suse.de>, Michal Hocko <mhocko@suse.cz>,
	Johannes Weiner <hannes@cmpxchg.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Minchan Kim <minchan@kernel.org>
Subject: [RFC 2/6] mm: keep dirty bit on anonymous page migration
Date: Wed,  3 Jun 2015 15:15:41 +0900	[thread overview]
Message-ID: <1433312145-19386-3-git-send-email-minchan@kernel.org> (raw)
In-Reply-To: <1433312145-19386-1-git-send-email-minchan@kernel.org>

Currently, If VM migrates anonymous page, we lose dirty bit of
page table entry. Instead, VM translates dirty bit of page table
as PG_dirty of page flags. It was okay because dirty bit of
page table for anonymous page was no matter to swap out.
Instead, VM took care of PG_dirty.

However, with introducing MADV_FREE, it's important to keep
page table's dirty bit because It could make MADV_FREE handling
logics more straighforward without taking care of PG_dirty.

This patch aims for preparing to remove PG_dirty check for MADV_FREE.

Signed-off-by: Minchan Kim <minchan@kernel.org>
---
 mm/migrate.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/migrate.c b/mm/migrate.c
index 236ee25e79d9..add30c3aaaa9 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -151,6 +151,10 @@ static int remove_migration_pte(struct page *new, struct vm_area_struct *vma,
 	if (is_write_migration_entry(entry))
 		pte = maybe_mkwrite(pte, vma);
 
+	/* MADV_FREE relies on pte_dirty. */
+	if (PageAnon(new))
+		pte = pte_mkdirty(pte);
+
 #ifdef CONFIG_HUGETLB_PAGE
 	if (PageHuge(new)) {
 		pte = pte_mkhuge(pte);
-- 
1.9.1


  parent reply	other threads:[~2015-06-03  6:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-03  6:15 [RFC 0/6] MADV_FREE: respect pte_dirty, not PG_dirty Minchan Kim
2015-06-03  6:15 ` Minchan Kim
2015-06-03  6:15 ` [RFC 1/6] mm: keep dirty bit on KSM page Minchan Kim
2015-06-03  6:15   ` Minchan Kim
2015-06-03  6:15 ` Minchan Kim [this message]
2015-06-03  6:15   ` [RFC 2/6] mm: keep dirty bit on anonymous page migration Minchan Kim
2015-06-03  6:15 ` [RFC 3/6] mm: mark dirty bit on swapped-in page Minchan Kim
2015-06-03  6:15   ` Minchan Kim
2015-06-09 19:07   ` Cyrill Gorcunov
2015-06-09 19:07     ` Cyrill Gorcunov
2015-06-09 23:52     ` Minchan Kim
2015-06-09 23:52       ` Minchan Kim
2015-06-10  7:23       ` Cyrill Gorcunov
2015-06-10  7:23         ` Cyrill Gorcunov
2015-06-10  8:00         ` Minchan Kim
2015-06-10  8:00           ` Minchan Kim
2015-06-10  8:05           ` Cyrill Gorcunov
2015-06-10  8:05             ` Cyrill Gorcunov
2015-06-03  6:15 ` [RFC 4/6] mm: mark dirty bit on unuse_pte Minchan Kim
2015-06-03  6:15   ` Minchan Kim
2015-06-03  6:15 ` [RFC 5/6] mm: decouple PG_dirty from MADV_FREE Minchan Kim
2015-06-03  6:15   ` Minchan Kim
2015-06-03  6:15 ` [RFC 6/6] mm: MADV_FREE refactoring Minchan Kim
2015-06-03  6:15   ` Minchan Kim

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=1433312145-19386-3-git-send-email-minchan@kernel.org \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.cz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.