From: "Wang, Yalin" <Yalin.Wang@sonymobile.com>
To: 'Minchan Kim' <minchan@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
Michal Hocko <mhocko@suse.cz>,
Johannes Weiner <hannes@cmpxchg.org>,
Mel Gorman <mgorman@suse.de>, Rik van Riel <riel@redhat.com>,
Shaohua Li <shli@kernel.org>
Subject: [RFC ] mm: don't ignore file map pages for madvise_free( )
Date: Wed, 11 Mar 2015 17:05:46 +0800 [thread overview]
Message-ID: <35FD53F367049845BC99AC72306C23D10458D6173C0B@CNBJMBX05.corpusers.net> (raw)
In-Reply-To: <1426036838-18154-3-git-send-email-minchan@kernel.org>
Hi
I just want to explain my ideas about file map pages for madvise_free() syscall.
As the following patch,
For file map vma, there is 2 types:
1. private file map
In this type, the pages of this vma are file map pages or anon page (when COW happened),
2. shared file map
In this type, the pages of this vma are all file map pages.
No matter which type file map,
We can handle file map vma as the following:
If the page is file map pages,
We just clear its pte young bit(pte_mkold()),
This will have some advantages, it will make page
Reclaim path move this file map page into inactive
lru list aggressively.
If the page is anon map page, we just handle it in the
Same way as for the pages in anon vma.
---
diff --git a/mm/madvise.c b/mm/madvise.c
index 6d0fcb8..8fdc82f 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -322,7 +322,8 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr,
ptent = ptep_get_and_clear_full(mm, addr, pte,
tlb->fullmm);
ptent = pte_mkold(ptent);
- ptent = pte_mkclean(ptent);
+ if (PageAnon(page))
+ ptent = pte_mkclean(ptent);
set_pte_at(mm, addr, pte, ptent);
tlb_remove_tlb_entry(tlb, pte, addr);
}
@@ -364,10 +365,6 @@ static int madvise_free_single_vma(struct vm_area_struct *vma,
if (vma->vm_flags & (VM_LOCKED|VM_HUGETLB|VM_PFNMAP))
return -EINVAL;
- /* MADV_FREE works for only anon vma at the moment */
- if (vma->vm_file)
- return -EINVAL;
-
start = max(vma->vm_start, start_addr);
if (start >= vma->vm_end)
return -EINVAL;
--
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:[~2015-03-11 9:06 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-11 1:20 [PATCH 1/4] mm: free swp_entry in madvise_free Minchan Kim
2015-03-11 1:20 ` [PATCH 2/4] mm: change deactivate_page with deactivate_file_page Minchan Kim
2015-03-11 1:20 ` [PATCH 3/4] mm: move lazy free pages to inactive list Minchan Kim
2015-03-11 2:14 ` Wang, Yalin
2015-03-11 4:30 ` Minchan Kim
2015-04-01 20:38 ` Rik van Riel
2015-03-11 9:05 ` Wang, Yalin [this message]
2015-03-11 9:47 ` [RFC] mm:do recheck for freeable page in reclaim path Wang, Yalin
2015-03-20 22:43 ` [PATCH 3/4] mm: move lazy free pages to inactive list Andrew Morton
2015-03-30 5:35 ` Minchan Kim
2015-03-30 21:20 ` Andrew Morton
2015-03-31 4:45 ` Minchan Kim
2015-03-31 5:28 ` Andrew Morton
2015-03-31 5:57 ` Minchan Kim
2015-03-11 1:20 ` [PATCH 4/4] mm: make every pte dirty on do_swap_page Minchan Kim
2015-03-30 5:22 ` Minchan Kim
2015-03-30 8:51 ` Cyrill Gorcunov
2015-03-30 8:59 ` Minchan Kim
2015-03-30 21:14 ` Cyrill Gorcunov
2015-03-31 4:38 ` Minchan Kim
2015-04-08 23:50 ` Minchan Kim
2015-04-09 20:59 ` Andrew Morton
2015-04-10 0:08 ` Minchan Kim
2015-04-10 0:14 ` Rik van Riel
2015-04-11 21:40 ` Hugh Dickins
2015-04-12 14:48 ` Minchan Kim
2015-04-15 6:49 ` Minchan Kim
2015-03-19 0:46 ` [PATCH 1/4] mm: free swp_entry in madvise_free 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=35FD53F367049845BC99AC72306C23D10458D6173C0B@CNBJMBX05.corpusers.net \
--to=yalin.wang@sonymobile.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.cz \
--cc=minchan@kernel.org \
--cc=riel@redhat.com \
--cc=shli@kernel.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