* [PATCH] mm: make faultaround produce old ptes
@ 2016-05-17 12:32 Kirill A. Shutemov
2016-05-18 1:22 ` Minchan Kim
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Kirill A. Shutemov @ 2016-05-17 12:32 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, Kirill A. Shutemov, Mel Gorman, Rik van Riel,
Michal Hocko, Vinayak Menon, Minchan Kim
Currently, faultaround code produces young pte. This can screw up vmscan
behaviour[1], as it makes vmscan think that these pages are hot and not
push them out on first round.
Let modify faultaround to produce old pte, so they can easily be
reclaimed under memory pressure.
This can to some extend defeat purpose of faultaround on machines
without hardware accessed bit as it will not help up with reducing
number of minor page faults.
We may want to disable faultaround on such machines altogether, but
that's subject for separate patchset.
[1] https://lkml.kernel.org/r/1460992636-711-1-git-send-email-vinmenon@codeaurora.org
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Vinayak Menon <vinmenon@codeaurora.org>
Cc: Minchan Kim <minchan@kernel.org>
---
include/linux/mm.h | 2 +-
mm/filemap.c | 2 +-
mm/memory.c | 23 ++++++++++++++++++-----
3 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 573dfebddcca..a0e773204be0 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -591,7 +591,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
}
void do_set_pte(struct vm_area_struct *vma, unsigned long address,
- struct page *page, pte_t *pte, bool write, bool anon);
+ struct page *page, pte_t *pte, bool write, bool anon, bool old);
#endif
/*
diff --git a/mm/filemap.c b/mm/filemap.c
index b366a9902f1c..dd789e159a77 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2196,7 +2196,7 @@ repeat:
if (file->f_ra.mmap_miss > 0)
file->f_ra.mmap_miss--;
addr = address + (page->index - vmf->pgoff) * PAGE_SIZE;
- do_set_pte(vma, addr, page, pte, false, false);
+ do_set_pte(vma, addr, page, pte, false, false, true);
unlock_page(page);
goto next;
unlock:
diff --git a/mm/memory.c b/mm/memory.c
index d79c6db41502..67c03b2fe20c 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2855,7 +2855,7 @@ static int __do_fault(struct vm_area_struct *vma, unsigned long address,
* vm_ops->map_pages.
*/
void do_set_pte(struct vm_area_struct *vma, unsigned long address,
- struct page *page, pte_t *pte, bool write, bool anon)
+ struct page *page, pte_t *pte, bool write, bool anon, bool old)
{
pte_t entry;
@@ -2863,6 +2863,8 @@ void do_set_pte(struct vm_area_struct *vma, unsigned long address,
entry = mk_pte(page, vma->vm_page_prot);
if (write)
entry = maybe_mkwrite(pte_mkdirty(entry), vma);
+ if (old)
+ entry = pte_mkold(entry);
if (anon) {
inc_mm_counter_fast(vma->vm_mm, MM_ANONPAGES);
page_add_new_anon_rmap(page, vma, address, false);
@@ -3000,9 +3002,20 @@ static int do_read_fault(struct mm_struct *mm, struct vm_area_struct *vma,
*/
if (vma->vm_ops->map_pages && fault_around_bytes >> PAGE_SHIFT > 1) {
pte = pte_offset_map_lock(mm, pmd, address, &ptl);
- do_fault_around(vma, address, pte, pgoff, flags);
if (!pte_same(*pte, orig_pte))
goto unlock_out;
+ do_fault_around(vma, address, pte, pgoff, flags);
+ /* Check if the fault is handled by faultaround */
+ if (!pte_same(*pte, orig_pte)) {
+ /*
+ * Faultaround produce old pte, but the pte we've
+ * handler fault for should be young.
+ */
+ pte_t entry = pte_mkyoung(*pte);
+ if (ptep_set_access_flags(vma, address, pte, entry, 0))
+ update_mmu_cache(vma, address, pte);
+ goto unlock_out;
+ }
pte_unmap_unlock(pte, ptl);
}
@@ -3017,7 +3030,7 @@ static int do_read_fault(struct mm_struct *mm, struct vm_area_struct *vma,
put_page(fault_page);
return ret;
}
- do_set_pte(vma, address, fault_page, pte, false, false);
+ do_set_pte(vma, address, fault_page, pte, false, false, false);
unlock_page(fault_page);
unlock_out:
pte_unmap_unlock(pte, ptl);
@@ -3069,7 +3082,7 @@ static int do_cow_fault(struct mm_struct *mm, struct vm_area_struct *vma,
}
goto uncharge_out;
}
- do_set_pte(vma, address, new_page, pte, true, true);
+ do_set_pte(vma, address, new_page, pte, true, true, false);
mem_cgroup_commit_charge(new_page, memcg, false, false);
lru_cache_add_active_or_unevictable(new_page, vma);
pte_unmap_unlock(pte, ptl);
@@ -3126,7 +3139,7 @@ static int do_shared_fault(struct mm_struct *mm, struct vm_area_struct *vma,
put_page(fault_page);
return ret;
}
- do_set_pte(vma, address, fault_page, pte, true, false);
+ do_set_pte(vma, address, fault_page, pte, true, false, false);
pte_unmap_unlock(pte, ptl);
if (set_page_dirty(fault_page))
--
2.8.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>
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] mm: make faultaround produce old ptes
2016-05-17 12:32 [PATCH] mm: make faultaround produce old ptes Kirill A. Shutemov
@ 2016-05-18 1:22 ` Minchan Kim
2016-05-18 1:27 ` Minchan Kim
2016-05-18 7:25 ` Michal Hocko
2016-05-19 4:27 ` Rik van Riel
2 siblings, 1 reply; 9+ messages in thread
From: Minchan Kim @ 2016-05-18 1:22 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: Andrew Morton, linux-mm, Mel Gorman, Rik van Riel, Michal Hocko,
Vinayak Menon
On Tue, May 17, 2016 at 03:32:46PM +0300, Kirill A. Shutemov wrote:
> Currently, faultaround code produces young pte. This can screw up vmscan
> behaviour[1], as it makes vmscan think that these pages are hot and not
> push them out on first round.
>
> Let modify faultaround to produce old pte, so they can easily be
> reclaimed under memory pressure.
>
> This can to some extend defeat purpose of faultaround on machines
> without hardware accessed bit as it will not help up with reducing
> number of minor page faults.
>
> We may want to disable faultaround on such machines altogether, but
> that's subject for separate patchset.
>
> [1] https://lkml.kernel.org/r/1460992636-711-1-git-send-email-vinmenon@codeaurora.org
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Rik van Riel <riel@redhat.com>
> Cc: Michal Hocko <mhocko@kernel.org>
> Cc: Vinayak Menon <vinmenon@codeaurora.org>
> Cc: Minchan Kim <minchan@kernel.org>
I tested 512M mmap sequential word read test on non-HW access bit system
(i.e., ARM) and confirmed it doesn't increase minor fault any more.
= old =
minor fault: 131291
elapsed time: 6747645 usec
= new =
minor fault: 131291
elapsed time: 6709263 usec
0.56% benefit
Acked-by: Minchan Kim <minchan@kernel.org>
--
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>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mm: make faultaround produce old ptes
2016-05-18 1:22 ` Minchan Kim
@ 2016-05-18 1:27 ` Minchan Kim
0 siblings, 0 replies; 9+ messages in thread
From: Minchan Kim @ 2016-05-18 1:27 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: Andrew Morton, linux-mm, Mel Gorman, Rik van Riel, Michal Hocko,
Vinayak Menon
On Wed, May 18, 2016 at 10:22:59AM +0900, Minchan Kim wrote:
> On Tue, May 17, 2016 at 03:32:46PM +0300, Kirill A. Shutemov wrote:
> > Currently, faultaround code produces young pte. This can screw up vmscan
> > behaviour[1], as it makes vmscan think that these pages are hot and not
> > push them out on first round.
> >
> > Let modify faultaround to produce old pte, so they can easily be
> > reclaimed under memory pressure.
> >
> > This can to some extend defeat purpose of faultaround on machines
> > without hardware accessed bit as it will not help up with reducing
> > number of minor page faults.
> >
> > We may want to disable faultaround on such machines altogether, but
> > that's subject for separate patchset.
> >
> > [1] https://lkml.kernel.org/r/1460992636-711-1-git-send-email-vinmenon@codeaurora.org
> >
> > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > Cc: Mel Gorman <mgorman@suse.de>
> > Cc: Rik van Riel <riel@redhat.com>
> > Cc: Michal Hocko <mhocko@kernel.org>
> > Cc: Vinayak Menon <vinmenon@codeaurora.org>
> > Cc: Minchan Kim <minchan@kernel.org>
>
> I tested 512M mmap sequential word read test on non-HW access bit system
> (i.e., ARM) and confirmed it doesn't increase minor fault any more.
>
> = old =
> minor fault: 131291
> elapsed time: 6747645 usec
>
> = new =
> minor fault: 131291
> elapsed time: 6709263 usec
>
> 0.56% benefit
>
> Acked-by: Minchan Kim <minchan@kernel.org>
Oops, label was wrong.
I meant
old : 4096 fault_around
new : 65536 fault_around
--
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>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mm: make faultaround produce old ptes
2016-05-17 12:32 [PATCH] mm: make faultaround produce old ptes Kirill A. Shutemov
2016-05-18 1:22 ` Minchan Kim
@ 2016-05-18 7:25 ` Michal Hocko
2016-05-18 8:04 ` Kirill A. Shutemov
2016-05-19 4:27 ` Rik van Riel
2 siblings, 1 reply; 9+ messages in thread
From: Michal Hocko @ 2016-05-18 7:25 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: Andrew Morton, linux-mm, Mel Gorman, Rik van Riel, Vinayak Menon,
Minchan Kim
On Tue 17-05-16 15:32:46, Kirill A. Shutemov wrote:
> Currently, faultaround code produces young pte. This can screw up vmscan
> behaviour[1], as it makes vmscan think that these pages are hot and not
> push them out on first round.
>
> Let modify faultaround to produce old pte, so they can easily be
> reclaimed under memory pressure.
Could you be more specific about what was the original issue that led to
this patch? I can understand that marking all those pages new might be
too optimistic but when does it matter actually? Sparsely access file
mmap?
> This can to some extend defeat purpose of faultaround on machines
> without hardware accessed bit as it will not help up with reducing
> number of minor page faults.
>
> We may want to disable faultaround on such machines altogether, but
> that's subject for separate patchset.
>
> [1] https://lkml.kernel.org/r/1460992636-711-1-git-send-email-vinmenon@codeaurora.org
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Rik van Riel <riel@redhat.com>
> Cc: Michal Hocko <mhocko@kernel.org>
> Cc: Vinayak Menon <vinmenon@codeaurora.org>
> Cc: Minchan Kim <minchan@kernel.org>
> ---
> include/linux/mm.h | 2 +-
> mm/filemap.c | 2 +-
> mm/memory.c | 23 ++++++++++++++++++-----
> 3 files changed, 20 insertions(+), 7 deletions(-)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 573dfebddcca..a0e773204be0 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -591,7 +591,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
> }
>
> void do_set_pte(struct vm_area_struct *vma, unsigned long address,
> - struct page *page, pte_t *pte, bool write, bool anon);
> + struct page *page, pte_t *pte, bool write, bool anon, bool old);
> #endif
>
> /*
> diff --git a/mm/filemap.c b/mm/filemap.c
> index b366a9902f1c..dd789e159a77 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -2196,7 +2196,7 @@ repeat:
> if (file->f_ra.mmap_miss > 0)
> file->f_ra.mmap_miss--;
> addr = address + (page->index - vmf->pgoff) * PAGE_SIZE;
> - do_set_pte(vma, addr, page, pte, false, false);
> + do_set_pte(vma, addr, page, pte, false, false, true);
> unlock_page(page);
> goto next;
> unlock:
> diff --git a/mm/memory.c b/mm/memory.c
> index d79c6db41502..67c03b2fe20c 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -2855,7 +2855,7 @@ static int __do_fault(struct vm_area_struct *vma, unsigned long address,
> * vm_ops->map_pages.
> */
> void do_set_pte(struct vm_area_struct *vma, unsigned long address,
> - struct page *page, pte_t *pte, bool write, bool anon)
> + struct page *page, pte_t *pte, bool write, bool anon, bool old)
> {
> pte_t entry;
>
> @@ -2863,6 +2863,8 @@ void do_set_pte(struct vm_area_struct *vma, unsigned long address,
> entry = mk_pte(page, vma->vm_page_prot);
> if (write)
> entry = maybe_mkwrite(pte_mkdirty(entry), vma);
> + if (old)
> + entry = pte_mkold(entry);
> if (anon) {
> inc_mm_counter_fast(vma->vm_mm, MM_ANONPAGES);
> page_add_new_anon_rmap(page, vma, address, false);
> @@ -3000,9 +3002,20 @@ static int do_read_fault(struct mm_struct *mm, struct vm_area_struct *vma,
> */
> if (vma->vm_ops->map_pages && fault_around_bytes >> PAGE_SHIFT > 1) {
> pte = pte_offset_map_lock(mm, pmd, address, &ptl);
> - do_fault_around(vma, address, pte, pgoff, flags);
> if (!pte_same(*pte, orig_pte))
> goto unlock_out;
> + do_fault_around(vma, address, pte, pgoff, flags);
> + /* Check if the fault is handled by faultaround */
> + if (!pte_same(*pte, orig_pte)) {
> + /*
> + * Faultaround produce old pte, but the pte we've
> + * handler fault for should be young.
> + */
> + pte_t entry = pte_mkyoung(*pte);
> + if (ptep_set_access_flags(vma, address, pte, entry, 0))
> + update_mmu_cache(vma, address, pte);
> + goto unlock_out;
> + }
> pte_unmap_unlock(pte, ptl);
> }
>
> @@ -3017,7 +3030,7 @@ static int do_read_fault(struct mm_struct *mm, struct vm_area_struct *vma,
> put_page(fault_page);
> return ret;
> }
> - do_set_pte(vma, address, fault_page, pte, false, false);
> + do_set_pte(vma, address, fault_page, pte, false, false, false);
> unlock_page(fault_page);
> unlock_out:
> pte_unmap_unlock(pte, ptl);
> @@ -3069,7 +3082,7 @@ static int do_cow_fault(struct mm_struct *mm, struct vm_area_struct *vma,
> }
> goto uncharge_out;
> }
> - do_set_pte(vma, address, new_page, pte, true, true);
> + do_set_pte(vma, address, new_page, pte, true, true, false);
> mem_cgroup_commit_charge(new_page, memcg, false, false);
> lru_cache_add_active_or_unevictable(new_page, vma);
> pte_unmap_unlock(pte, ptl);
> @@ -3126,7 +3139,7 @@ static int do_shared_fault(struct mm_struct *mm, struct vm_area_struct *vma,
> put_page(fault_page);
> return ret;
> }
> - do_set_pte(vma, address, fault_page, pte, true, false);
> + do_set_pte(vma, address, fault_page, pte, true, false, false);
> pte_unmap_unlock(pte, ptl);
>
> if (set_page_dirty(fault_page))
> --
> 2.8.1
--
Michal Hocko
SUSE Labs
--
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>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mm: make faultaround produce old ptes
2016-05-18 7:25 ` Michal Hocko
@ 2016-05-18 8:04 ` Kirill A. Shutemov
2016-05-18 8:22 ` Michal Hocko
0 siblings, 1 reply; 9+ messages in thread
From: Kirill A. Shutemov @ 2016-05-18 8:04 UTC (permalink / raw)
To: Michal Hocko
Cc: Kirill A. Shutemov, Andrew Morton, linux-mm, Mel Gorman,
Rik van Riel, Vinayak Menon, Minchan Kim
On Wed, May 18, 2016 at 09:25:50AM +0200, Michal Hocko wrote:
> On Tue 17-05-16 15:32:46, Kirill A. Shutemov wrote:
> > Currently, faultaround code produces young pte. This can screw up vmscan
> > behaviour[1], as it makes vmscan think that these pages are hot and not
> > push them out on first round.
> >
> > Let modify faultaround to produce old pte, so they can easily be
> > reclaimed under memory pressure.
>
> Could you be more specific about what was the original issue that led to
> this patch? I can understand that marking all those pages new might be
> too optimistic but when does it matter actually? Sparsely access file
> mmap?
Yes, sparse file access. Faultaround gets more pages mapped and all of
them are young. Under memory pressure, this makes vmscan to swap out anon
pages instead or drop other page cache pages which otherwise stay
resident.
--
Kirill A. Shutemov
--
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>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mm: make faultaround produce old ptes
2016-05-18 8:04 ` Kirill A. Shutemov
@ 2016-05-18 8:22 ` Michal Hocko
2016-05-18 8:33 ` Kirill A. Shutemov
0 siblings, 1 reply; 9+ messages in thread
From: Michal Hocko @ 2016-05-18 8:22 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: Kirill A. Shutemov, Andrew Morton, linux-mm, Mel Gorman,
Rik van Riel, Vinayak Menon, Minchan Kim
On Wed 18-05-16 11:04:33, Kirill A. Shutemov wrote:
> On Wed, May 18, 2016 at 09:25:50AM +0200, Michal Hocko wrote:
> > On Tue 17-05-16 15:32:46, Kirill A. Shutemov wrote:
> > > Currently, faultaround code produces young pte. This can screw up vmscan
> > > behaviour[1], as it makes vmscan think that these pages are hot and not
> > > push them out on first round.
> > >
> > > Let modify faultaround to produce old pte, so they can easily be
> > > reclaimed under memory pressure.
> >
> > Could you be more specific about what was the original issue that led to
> > this patch? I can understand that marking all those pages new might be
> > too optimistic but when does it matter actually? Sparsely access file
> > mmap?
>
> Yes, sparse file access. Faultaround gets more pages mapped and all of
> them are young. Under memory pressure, this makes vmscan to swap out anon
> pages instead or drop other page cache pages which otherwise stay
> resident.
I am wondering whether it would make more sense to do the fault around
only when chances are that the memory will be used. E.g. ~VM_RAND_READ
resp VM_SEQ_READ rather than unconditionally.
--
Michal Hocko
SUSE Labs
--
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>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mm: make faultaround produce old ptes
2016-05-18 8:22 ` Michal Hocko
@ 2016-05-18 8:33 ` Kirill A. Shutemov
2016-05-18 8:43 ` Michal Hocko
0 siblings, 1 reply; 9+ messages in thread
From: Kirill A. Shutemov @ 2016-05-18 8:33 UTC (permalink / raw)
To: Michal Hocko
Cc: Kirill A. Shutemov, Andrew Morton, linux-mm, Mel Gorman,
Rik van Riel, Vinayak Menon, Minchan Kim
On Wed, May 18, 2016 at 10:22:28AM +0200, Michal Hocko wrote:
> On Wed 18-05-16 11:04:33, Kirill A. Shutemov wrote:
> > On Wed, May 18, 2016 at 09:25:50AM +0200, Michal Hocko wrote:
> > > On Tue 17-05-16 15:32:46, Kirill A. Shutemov wrote:
> > > > Currently, faultaround code produces young pte. This can screw up vmscan
> > > > behaviour[1], as it makes vmscan think that these pages are hot and not
> > > > push them out on first round.
> > > >
> > > > Let modify faultaround to produce old pte, so they can easily be
> > > > reclaimed under memory pressure.
> > >
> > > Could you be more specific about what was the original issue that led to
> > > this patch? I can understand that marking all those pages new might be
> > > too optimistic but when does it matter actually? Sparsely access file
> > > mmap?
> >
> > Yes, sparse file access. Faultaround gets more pages mapped and all of
> > them are young. Under memory pressure, this makes vmscan to swap out anon
> > pages instead or drop other page cache pages which otherwise stay
> > resident.
>
> I am wondering whether it would make more sense to do the fault around
> only when chances are that the memory will be used. E.g. ~VM_RAND_READ
> resp VM_SEQ_READ rather than unconditionally.
I'm not sure about this.
The idea of faularound is that we already have almost everything in our
hands to map additional pages for very little cost: all required locks
has been taken and radix-tree look up will be done anyway.
So I don't see a benefit from limiting us here. Do you?
--
Kirill A. Shutemov
--
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>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mm: make faultaround produce old ptes
2016-05-18 8:33 ` Kirill A. Shutemov
@ 2016-05-18 8:43 ` Michal Hocko
0 siblings, 0 replies; 9+ messages in thread
From: Michal Hocko @ 2016-05-18 8:43 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: Kirill A. Shutemov, Andrew Morton, linux-mm, Mel Gorman,
Rik van Riel, Vinayak Menon, Minchan Kim
On Wed 18-05-16 11:33:48, Kirill A. Shutemov wrote:
> On Wed, May 18, 2016 at 10:22:28AM +0200, Michal Hocko wrote:
> > On Wed 18-05-16 11:04:33, Kirill A. Shutemov wrote:
> > > On Wed, May 18, 2016 at 09:25:50AM +0200, Michal Hocko wrote:
> > > > On Tue 17-05-16 15:32:46, Kirill A. Shutemov wrote:
> > > > > Currently, faultaround code produces young pte. This can screw up vmscan
> > > > > behaviour[1], as it makes vmscan think that these pages are hot and not
> > > > > push them out on first round.
> > > > >
> > > > > Let modify faultaround to produce old pte, so they can easily be
> > > > > reclaimed under memory pressure.
> > > >
> > > > Could you be more specific about what was the original issue that led to
> > > > this patch? I can understand that marking all those pages new might be
> > > > too optimistic but when does it matter actually? Sparsely access file
> > > > mmap?
> > >
> > > Yes, sparse file access. Faultaround gets more pages mapped and all of
> > > them are young. Under memory pressure, this makes vmscan to swap out anon
> > > pages instead or drop other page cache pages which otherwise stay
> > > resident.
> >
> > I am wondering whether it would make more sense to do the fault around
> > only when chances are that the memory will be used. E.g. ~VM_RAND_READ
> > resp VM_SEQ_READ rather than unconditionally.
>
> I'm not sure about this.
>
> The idea of faularound is that we already have almost everything in our
> hands to map additional pages for very little cost: all required locks
> has been taken and radix-tree look up will be done anyway.
Fair enough. Meddling pte young bits sounds like a better approach then.
Feel free to add
Acked-by: Michal Hocko <mhocko@suse.com>
--
Michal Hocko
SUSE Labs
--
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>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] mm: make faultaround produce old ptes
2016-05-17 12:32 [PATCH] mm: make faultaround produce old ptes Kirill A. Shutemov
2016-05-18 1:22 ` Minchan Kim
2016-05-18 7:25 ` Michal Hocko
@ 2016-05-19 4:27 ` Rik van Riel
2 siblings, 0 replies; 9+ messages in thread
From: Rik van Riel @ 2016-05-19 4:27 UTC (permalink / raw)
To: Kirill A. Shutemov, Andrew Morton
Cc: linux-mm, Mel Gorman, Michal Hocko, Vinayak Menon, Minchan Kim
[-- Attachment #1: Type: text/plain, Size: 1101 bytes --]
On Tue, 2016-05-17 at 15:32 +0300, Kirill A. Shutemov wrote:
> Currently, faultaround code produces young pte. This can screw up
> vmscan
> behaviour[1], as it makes vmscan think that these pages are hot and
> not
> push them out on first round.
>
> Let modify faultaround to produce old pte, so they can easily be
> reclaimed under memory pressure.
>
> This can to some extend defeat purpose of faultaround on machines
> without hardware accessed bit as it will not help up with reducing
> number of minor page faults.
>
> We may want to disable faultaround on such machines altogether, but
> that's subject for separate patchset.
>
> [1] https://lkml.kernel.org/r/1460992636-711-1-git-send-email-vinmeno
> n@codeaurora.org
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Rik van Riel <riel@redhat.com>
> Cc: Michal Hocko <mhocko@kernel.org>
> Cc: Vinayak Menon <vinmenon@codeaurora.org>
> Cc: Minchan Kim <minchan@kernel.org>
>
Acked-by: Rik van Riel <riel@redhat.com>
--
All Rights Reversed.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-05-19 4:27 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-17 12:32 [PATCH] mm: make faultaround produce old ptes Kirill A. Shutemov
2016-05-18 1:22 ` Minchan Kim
2016-05-18 1:27 ` Minchan Kim
2016-05-18 7:25 ` Michal Hocko
2016-05-18 8:04 ` Kirill A. Shutemov
2016-05-18 8:22 ` Michal Hocko
2016-05-18 8:33 ` Kirill A. Shutemov
2016-05-18 8:43 ` Michal Hocko
2016-05-19 4:27 ` Rik van Riel
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).