This is a port on kernel 4.14 of the work done by Peter Zijlstra to
handle page fault without holding the mm semaphore [1].
The idea is to try to handle user space page faults without holding the
mmap_sem. This should allow better concurrency for massively threaded
process since the page fault handler will not wait for other threads memory
layout change to be done, assuming that this change is done in another part
of the process's memory space. This type page fault is named speculative
page fault. If the speculative page fault fails because of a concurrency is
detected or because underlying PMD or PTE tables are not yet allocating, it
is failing its processing and a classic page fault is then tried.
The speculative page fault (SPF) has to look for the VMA matching the fault
address without holding the mmap_sem, so the VMA list is now managed using
SRCU allowing lockless walking. The only impact would be the deferred file
derefencing in the case of a file mapping, since the file pointer is
released once the SRCU cleaning is done. This patch relies on the change
done recently by Paul McKenney in SRCU which now runs a callback per CPU
instead of per SRCU structure [1].
The VMA's attributes checked during the speculative page fault processing
have to be protected against parallel changes. This is done by using a per
VMA sequence lock. This sequence lock allows the speculative page fault
handler to fast check for parallel changes in progress and to abort the
speculative page fault in that case.
Once the VMA is found, the speculative page fault handler would check for
the VMA's attributes to verify that the page fault has to be handled
correctly or not. Thus the VMA is protected through a sequence lock which
allows fast detection of concurrent VMA changes. If such a change is
detected, the speculative page fault is aborted and a *classic* page fault
is tried. VMA sequence locks are added when VMA attributes which are
checked during the page fault are modified.
When the PTE is fetched, the VMA is checked to see if it has been changed,
so once the page table is locked, the VMA is valid, so any other changes
leading to touching this PTE will need to lock the page table, so no
parallel change is possible at this time.
Compared to the Peter's initial work, this series introduces a spin_trylock
when dealing with speculative page fault. This is required to avoid dead
lock when handling a page fault while a TLB invalidate is requested by an
other CPU holding the PTE. Another change due to a lock dependency issue
with mapping->i_mmap_rwsem.
In addition some VMA field values which are used once the PTE is unlocked
at the end the page fault path are saved into the vm_fault structure to
used the values matching the VMA at the time the PTE was locked.
This series only support VMA with no vm_ops define, so huge page and mapped
file are not managed with the speculative path. In addition transparent
huge page are not supported. Once this series will be accepted upstream
I'll extend the support to mapped files, and transparent huge pages.
This series builds on top of v4.14-rc3-mmotm and is functional on x86 and
PowerPC.
Tests have been made using a large commercial in-memory database on a
PowerPC system with 752 CPU using RFC v5 using a previous version of this
series. The results are very encouraging since the loading of the 2TB
database was faster by 14% with the speculative page fault.
Using ebizzy test [3], which spreads a lot of threads, the result are good
when running on both a large or a small system. When using kernbench, the
result are quite similar which expected as not so much multithreaded
processes are involved. But there is no performance degradation neither
which is good.
------------------
Benchmarks results
No change since v4.
Please, see https://lkml.org/lkml/2017/10/9/180 for details.
Impact on the text size for x86_64 (same as v4):
UP SMP
4.14.0-rc3-mm1 0x008ed859 0x00966ea9
4.14.0-rc3-mm1-spf 0x008ed859 0x00968ea9
------------------------
Changes since v4:
- As requested by Andrew Morton, use CONFIG_SPF and define it earlier in
the series to ease bisection.
Changes since v3:
- Don't build when CONFIG_SMP is not set
- Fixed a lock dependency warning in __vma_adjust()
- Use READ_ONCE to access p*d values in handle_speculative_fault()
- Call memcp_oom() service in handle_speculative_fault()
Changes since v2:
- Perf event is renamed in PERF_COUNT_SW_SPF
- On Power handle do_page_fault()'s cleaning
- On Power if the VM_FAULT_ERROR is returned by
handle_speculative_fault(), do not retry but jump to the error path
- If VMA's flags are not matching the fault, directly returns
VM_FAULT_SIGSEGV and not VM_FAULT_RETRY
- Check for pud_trans_huge() to avoid speculative path
- Handles _vm_normal_page()'s introduced by 6f16211df3bf
("mm/device-public-memory: device memory cache coherent with CPU")
- add and review few comments in the code
Changes since v1:
- Remove PERF_COUNT_SW_SPF_FAILED perf event.
- Add tracing events to details speculative page fault failures.
- Cache VMA fields values which are used once the PTE is unlocked at the
end of the page fault events.
- Ensure that fields read during the speculative path are written and read
using WRITE_ONCE and READ_ONCE.
- Add checks at the beginning of the speculative path to abort it if the
VMA is known to not be supported.
Changes since RFC V5 [5]
- Port to 4.13 kernel
- Merging patch fixing lock dependency into the original patch
- Replace the 2 parameters of vma_has_changed() with the vmf pointer
- In patch 7, don't call __do_fault() in the speculative path as it may
want to unlock the mmap_sem.
- In patch 11-12, don't check for vma boundaries when
page_add_new_anon_rmap() is called during the spf path and protect against
anon_vma pointer's update.
- In patch 13-16, add performance events to report number of successful
and failed speculative events.
[1] http://linux-kernel.2935.n7.nabble.com/RFC-PATCH-0-6-Another-go-at-speculative-page-faults-tt965642.html#none
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=da915ad5cf25b5f5d358dd3670c3378d8ae8c03e
[3] http://ebizzy.sourceforge.net/
[4] http://ck.kolivas.org/apps/kernbench/kernbench-0.50/
[5] https://lwn.net/Articles/725607/
Laurent Dufour (16):
x86/mm: Define CONFIG_SPF
powerpc/mm: Define CONFIG_SPF
mm: Introduce pte_spinlock for FAULT_FLAG_SPECULATIVE
mm: Protect VMA modifications using VMA sequence count
mm: Cache some VMA fields in the vm_fault structure
mm: Protect SPF handler against anon_vma changes
mm/migrate: Pass vm_fault pointer to migrate_misplaced_page()
mm: Introduce __lru_cache_add_active_or_unevictable
mm: Introduce __maybe_mkwrite()
mm: Introduce __vm_normal_page()
mm: Introduce __page_add_new_anon_rmap()
mm: Try spin lock in speculative path
mm: Adding speculative page fault failure trace events
perf: Add a speculative page fault sw event
perf tools: Add support for the SPF perf event
powerpc/mm: Add speculative page fault
Peter Zijlstra (6):
mm: Dont assume page-table invariance during faults
mm: Prepare for FAULT_FLAG_SPECULATIVE
mm: VMA sequence count
mm: RCU free VMAs
mm: Provide speculative fault infrastructure
x86/mm: Add speculative pagefault handling
arch/powerpc/Kconfig | 4 +
arch/powerpc/mm/fault.c | 17 ++
arch/x86/Kconfig | 4 +
arch/x86/mm/fault.c | 21 ++
fs/proc/task_mmu.c | 5 +-
fs/userfaultfd.c | 17 +-
include/linux/hugetlb_inline.h | 2 +-
include/linux/migrate.h | 4 +-
include/linux/mm.h | 69 ++++-
include/linux/mm_types.h | 5 +
include/linux/pagemap.h | 4 +-
include/linux/rmap.h | 12 +-
include/linux/swap.h | 11 +-
include/trace/events/pagefault.h | 87 ++++++
include/uapi/linux/perf_event.h | 1 +
kernel/fork.c | 1 +
mm/hugetlb.c | 2 +
mm/init-mm.c | 1 +
mm/internal.h | 21 ++
mm/khugepaged.c | 5 +
mm/madvise.c | 6 +-
mm/memory.c | 496 +++++++++++++++++++++++++++++-----
mm/mempolicy.c | 51 ++--
mm/migrate.c | 4 +-
mm/mlock.c | 13 +-
mm/mmap.c | 160 ++++++++---
mm/mprotect.c | 4 +-
mm/mremap.c | 6 +
mm/rmap.c | 5 +-
mm/swap.c | 12 +-
tools/include/uapi/linux/perf_event.h | 1 +
tools/perf/util/evsel.c | 1 +
tools/perf/util/parse-events.c | 4 +
tools/perf/util/parse-events.l | 1 +
tools/perf/util/python.c | 1 +
35 files changed, 906 insertions(+), 152 deletions(-)
create mode 100644 include/trace/events/pagefault.h
--
2.7.4
Introduce CONFIG_SPF which turns on the Speculative Page Fault handler when
building for 64bits with SMP.
Signed-off-by: Laurent Dufour <redacted>
---
arch/x86/Kconfig | 4 ++++
1 file changed, 4 insertions(+)
From: Peter Zijlstra <peterz@infradead.org>
One of the side effects of speculating on faults (without holding
mmap_sem) is that we can race with free_pgtables() and therefore we
cannot assume the page-tables will stick around.
Remove the reliance on the pte pointer.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
[Remove only if !CONFIG_SPF]
Signed-off-by: Laurent Dufour <redacted>
---
mm/memory.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Define CONFIG_SPF for BOOK3S_64 and SMP. This enables the Speculative Page
Fault handler.
Support is only provide for BOOK3S_64 currently because:
- require CONFIG_PPC_STD_MMU because checks done in
set_access_flags_filter()
- require BOOK3S because we can't support for book3e_hugetlb_preload()
called by update_mmu_cache()
Signed-off-by: Laurent Dufour <redacted>
---
arch/powerpc/Kconfig | 4 ++++
1 file changed, 4 insertions(+)
When handling page fault without holding the mmap_sem the fetch of the
pte lock pointer and the locking will have to be done while ensuring
that the VMA is not touched in our back.
So move the fetch and locking operations in a dedicated function.
Signed-off-by: Laurent Dufour <redacted>
---
mm/memory.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
The VMA sequence count has been introduced to allow fast detection of
VMA modification when running a page fault handler without holding
the mmap_sem.
This patch provides protection against the VMA modification done in :
- madvise()
- mremap()
- mpol_rebind_policy()
- vma_replace_policy()
- change_prot_numa()
- mlock(), munlock()
- mprotect()
- mmap_region()
- collapse_huge_page()
- userfaultd registering services
In addition, VMA fields which will be read during the speculative fault
path needs to be written using WRITE_ONCE to prevent write to be split
and intermediate values to be pushed to other CPUs.
Signed-off-by: Laurent Dufour <redacted>
---
fs/proc/task_mmu.c | 5 ++++-
fs/userfaultfd.c | 17 +++++++++++++----
mm/khugepaged.c | 3 +++
mm/madvise.c | 6 +++++-
mm/mempolicy.c | 51 ++++++++++++++++++++++++++++++++++-----------------
mm/mlock.c | 13 ++++++++-----
mm/mmap.c | 17 ++++++++++-------
mm/mprotect.c | 4 +++-
mm/mremap.c | 6 ++++++
9 files changed, 86 insertions(+), 36 deletions(-)
@@ -301,6 +301,9 @@ static unsigned long move_vma(struct vm_area_struct *vma,if(!new_vma)return-ENOMEM;+vm_write_begin(vma);+vm_write_begin_nested(new_vma,SINGLE_DEPTH_NESTING);+moved_len=move_page_tables(vma,old_addr,new_vma,new_addr,old_len,need_rmap_locks);if(moved_len<old_len){
@@ -317,6 +320,7 @@ static unsigned long move_vma(struct vm_area_struct *vma,*/move_page_tables(new_vma,new_addr,vma,old_addr,moved_len,true);+vm_write_end(vma);vma=new_vma;old_len=new_len;old_addr=new_addr;
@@ -325,7 +329,9 @@ static unsigned long move_vma(struct vm_area_struct *vma,mremap_userfaultfd_prep(new_vma,uf);arch_remap(mm,old_addr,old_addr+old_len,new_addr,new_addr+new_len);+vm_write_end(vma);}+vm_write_end(new_vma);/* Conceal VM_ACCOUNT so old reservation is not undone */if(vm_flags&VM_ACCOUNT){
When handling speculative page fault, the vma->vm_flags and
vma->vm_page_prot fields are read once the page table lock is released. So
there is no more guarantee that these fields would not change in our back.
They will be saved in the vm_fault structure before the VMA is checked for
changes.
This patch also set the fields in hugetlb_no_page() and
__collapse_huge_page_swapin even if it is not need for the callee.
Signed-off-by: Laurent Dufour <redacted>
---
include/linux/mm.h | 6 ++++++
mm/hugetlb.c | 2 ++
mm/khugepaged.c | 2 ++
mm/memory.c | 38 ++++++++++++++++++++------------------
4 files changed, 30 insertions(+), 18 deletions(-)
@@ -881,6 +881,8 @@ static bool __collapse_huge_page_swapin(struct mm_struct *mm,.flags=FAULT_FLAG_ALLOW_RETRY,.pmd=pmd,.pgoff=linear_page_index(vma,address),+.vma_flags=vma->vm_flags,+.vma_page_prot=vma->vm_page_prot,};/* we only decide to swapin, if there is enough young ptes */
@@ -3498,7 +3498,7 @@ int finish_fault(struct vm_fault *vmf)/* Did we COW the page? */if((vmf->flags&FAULT_FLAG_WRITE)&&-!(vmf->vma->vm_flags&VM_SHARED))+!(vmf->vma_flags&VM_SHARED))page=vmf->cow_page;elsepage=vmf->page;
@@ -3752,7 +3752,7 @@ static int do_fault(struct vm_fault *vmf)ret=VM_FAULT_SIGBUS;elseif(!(vmf->flags&FAULT_FLAG_WRITE))ret=do_read_fault(vmf);-elseif(!(vma->vm_flags&VM_SHARED))+elseif(!(vmf->vma_flags&VM_SHARED))ret=do_cow_fault(vmf);elseret=do_shared_fault(vmf);
@@ -3809,7 +3809,7 @@ static int do_numa_page(struct vm_fault *vmf)*accessibleptes,somecanallowaccessbykernelmode.*/pte=ptep_modify_prot_start(vma->vm_mm,vmf->address,vmf->pte);-pte=pte_modify(pte,vma->vm_page_prot);+pte=pte_modify(pte,vmf->vma_page_prot);pte=pte_mkyoung(pte);if(was_writable)pte=pte_mkwrite(pte);
@@ -3843,7 +3843,7 @@ static int do_numa_page(struct vm_fault *vmf)*Flagifthepageissharedbetweenmultipleaddressspaces.This*islaterusedwhendeterminingwhethertogrouptaskstogether*/-if(page_mapcount(page)>1&&(vma->vm_flags&VM_SHARED))+if(page_mapcount(page)>1&&(vmf->vma_flags&VM_SHARED))flags|=TNF_SHARED;last_cpupid=page_cpupid_last(page);
@@ -3887,7 +3887,7 @@ static int wp_huge_pmd(struct vm_fault *vmf, pmd_t orig_pmd)returnvmf->vma->vm_ops->huge_fault(vmf,PE_SIZE_PMD);/* COW handled on pte level: split pmd */-VM_BUG_ON_VMA(vmf->vma->vm_flags&VM_SHARED,vmf->vma);+VM_BUG_ON_VMA(vmf->vma_flags&VM_SHARED,vmf->vma);__split_huge_pmd(vmf->vma,vmf->pmd,vmf->address,false,NULL);returnVM_FAULT_FALLBACK;
@@ -4034,6 +4034,8 @@ static int __handle_mm_fault(struct vm_area_struct *vma, unsigned long address,.flags=flags,.pgoff=linear_page_index(vma,address),.gfp_mask=__get_fault_gfp_mask(vma),+.vma_flags=vma->vm_flags,+.vma_page_prot=vma->vm_page_prot,};unsignedintdirty=flags&FAULT_FLAG_WRITE;structmm_struct*mm=vma->vm_mm;
The speculative page fault handler must be protected against anon_vma
changes. This is because page_add_new_anon_rmap() is called during the
speculative path.
In addition, don't try speculative page fault if the VMA don't have an
anon_vma structure allocated because its allocation should be
protected by the mmap_sem.
In __vma_adjust() when importer->anon_vma is set, there is no need to
protect against speculative page faults since speculative page fault
is aborted if the vma->anon_vma is not set.
When calling page_add_new_anon_rmap() vma->anon_vma is necessarily
valid since we checked for it when locking the pte and the anon_vma is
removed once the pte is unlocked. So even if the speculative page
fault handler is running concurrently with do_unmap(), as the pte is
locked in unmap_region() - through unmap_vmas() - and the anon_vma
unlinked later, because we check for the vma sequence counter which is
updated in unmap_page_range() before locking the pte, and then in
free_pgtables() so when locking the pte the change will be detected.
Signed-off-by: Laurent Dufour <redacted>
---
mm/memory.c | 4 ++++
1 file changed, 4 insertions(+)
The speculative page fault handler which is run without holding the
mmap_sem is calling lru_cache_add_active_or_unevictable() but the vm_flags
is not guaranteed to remain constant.
Introducing __lru_cache_add_active_or_unevictable() which has the vma flags
value parameter instead of the vma pointer.
Signed-off-by: Laurent Dufour <redacted>
---
include/linux/swap.h | 11 +++++++++--
mm/memory.c | 8 ++++----
mm/swap.c | 12 ++++++------
3 files changed, 19 insertions(+), 12 deletions(-)
migrate_misplaced_page() is only called during the page fault handling so
it's better to pass the pointer to the struct vm_fault instead of the vma.
This way during the speculative page fault path the saved vma->vm_flags
could be used.
Signed-off-by: Laurent Dufour <redacted>
---
include/linux/migrate.h | 4 ++--
mm/memory.c | 2 +-
mm/migrate.c | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
@@ -3861,7 +3861,7 @@ static int do_numa_page(struct vm_fault *vmf)}/* Migrate to the requested node */-migrated=migrate_misplaced_page(page,vma,target_nid);+migrated=migrate_misplaced_page(page,vmf,target_nid);if(migrated){page_nid=target_nid;flags|=TNF_MIGRATED;
When dealing with speculative page fault handler, we may race with VMA
being split or merged. In this case the vma->vm_start and vm->vm_end
fields may not match the address the page fault is occurring.
This can only happens when the VMA is split but in that case, the
anon_vma pointer of the new VMA will be the same as the original one,
because in __split_vma the new->anon_vma is set to src->anon_vma when
*new = *vma.
So even if the VMA boundaries are not correct, the anon_vma pointer is
still valid.
If the VMA has been merged, then the VMA in which it has been merged
must have the same anon_vma pointer otherwise the merge can't be done.
So in all the case we know that the anon_vma is valid, since we have
checked before starting the speculative page fault that the anon_vma
pointer is valid for this VMA and since there is an anon_vma this
means that at one time a page has been backed and that before the VMA
is cleaned, the page table lock would have to be grab to clean the
PTE, and the anon_vma field is checked once the PTE is locked.
This patch introduce a new __page_add_new_anon_rmap() service which
doesn't check for the VMA boundaries, and create a new inline one
which do the check.
When called from a page fault handler, if this is not a speculative one,
there is a guarantee that vm_start and vm_end match the faulting address,
so this check is useless. In the context of the speculative page fault
handler, this check may be wrong but anon_vma is still valid as explained
above.
Signed-off-by: Laurent Dufour <redacted>
---
include/linux/rmap.h | 12 ++++++++++--
mm/memory.c | 8 ++++----
mm/rmap.c | 5 ++---
3 files changed, 16 insertions(+), 9 deletions(-)
@@ -2551,7 +2551,7 @@ static int wp_page_copy(struct vm_fault *vmf)*threaddoingCOW.*/ptep_clear_flush_notify(vma,vmf->address,vmf->pte);-page_add_new_anon_rmap(new_page,vma,vmf->address,false);+__page_add_new_anon_rmap(new_page,vma,vmf->address,false);mem_cgroup_commit_charge(new_page,memcg,false,false);__lru_cache_add_active_or_unevictable(new_page,vmf->vma_flags);/*
@@ -3065,7 +3065,7 @@ int do_swap_page(struct vm_fault *vmf)/* ksm created a completely new copy */if(unlikely(page!=swapcache&&swapcache)){-page_add_new_anon_rmap(page,vma,vmf->address,false);+__page_add_new_anon_rmap(page,vma,vmf->address,false);mem_cgroup_commit_charge(page,memcg,false,false);__lru_cache_add_active_or_unevictable(page,vmf->vma_flags);}else{
@@ -3215,7 +3215,7 @@ static int do_anonymous_page(struct vm_fault *vmf)}inc_mm_counter_fast(vma->vm_mm,MM_ANONPAGES);-page_add_new_anon_rmap(page,vma,vmf->address,false);+__page_add_new_anon_rmap(page,vma,vmf->address,false);mem_cgroup_commit_charge(page,memcg,false,false);__lru_cache_add_active_or_unevictable(page,vmf->vma_flags);setpte:
This patch enable the speculative page fault on the PowerPC
architecture.
This will try a speculative page fault without holding the mmap_sem,
if it returns with VM_FAULT_RETRY, the mmap_sem is acquired and the
traditional page fault processing is done.
Build on if CONFIG_SPF is defined (currently for BOOK3S_64 && SMP).
Signed-off-by: Laurent Dufour <redacted>
---
arch/powerpc/mm/fault.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
@@ -442,6 +442,20 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address,if(is_exec)flags|=FAULT_FLAG_INSTRUCTION;+#ifdef CONFIG_SPF+if(is_user){+/* let's try a speculative page fault without grabbing the+*mmap_sem.+*/+fault=handle_speculative_fault(mm,address,flags);+if(!(fault&VM_FAULT_RETRY)){+perf_sw_event(PERF_COUNT_SW_SPF,1,+regs,address);+gotodone;+}+}+#endif /* CONFIG_SPF */+/* When running in the kernel we expect faults to occur only to*addressesinuserspace.Allotherfaultsrepresenterrorsinthe*kernelandshouldgenerateanOOPS.Unfortunately,inthecaseofan
@@ -526,6 +540,9 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address,up_read(¤t->mm->mmap_sem);+#ifdef CONFIG_SPF+done:+#endifif(unlikely(fault&VM_FAULT_ERROR))returnmm_fault_error(regs,address,fault);
From: Peter Zijlstra <peterz@infradead.org>
Try a speculative fault before acquiring mmap_sem, if it returns with
VM_FAULT_RETRY continue with the mmap_sem acquisition and do the
traditional fault.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
[Clearing of FAULT_FLAG_ALLOW_RETRY is now done in
handle_speculative_fault()]
[Retry with usual fault path in the case VM_ERROR is returned by
handle_speculative_fault(). This allows signal to be delivered]
[Don't build SPF call if !CONFIG_SPF]
Signed-off-by: Laurent Dufour <redacted>
---
arch/x86/mm/fault.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
@@ -81,6 +81,9 @@#include"internal.h"+#define CREATE_TRACE_POINTS+#include<trace/events/pagefault.h>+#ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS#warning Unfortunate NUMA and NUMA Balancing config, growing page-frame for last_cpupid.#endif
@@ -4255,32 +4267,45 @@ int handle_speculative_fault(struct mm_struct *mm, unsigned long address,*ValidatetheVMAfoundbythelocklesslookup.*/dead=RB_EMPTY_NODE(&vma->vm_rb);+if(dead){+trace_spf_vma_dead(_RET_IP_,vma,address);+gotounlock;+}+seq=raw_read_seqcount(&vma->vm_sequence);/* rmb <-> seqlock,vma_rb_erase() */-if((seq&1)||dead)+if(seq&1){+trace_spf_vma_changed(_RET_IP_,vma,address);gotounlock;+}/**Can'tcallvm_opsservicehaswedon'tknowwhattheywoulddo*withtheVMA.*Thisincludehugepagefromhugetlbfs.*/-if(vma->vm_ops)+if(vma->vm_ops){+trace_spf_vma_notsup(_RET_IP_,vma,address);gotounlock;+}/**__anon_vma_prepare()requiresthemmap_semtobeheld*becausevm_nextandvm_prevmustbesafe.Thiscan'tbeguaranteed*inthespeculativepath.*/-if(unlikely(!vma->anon_vma))+if(unlikely(!vma->anon_vma)){+trace_spf_vma_notsup(_RET_IP_,vma,address);gotounlock;+}vmf.vma_flags=READ_ONCE(vma->vm_flags);vmf.vma_page_prot=READ_ONCE(vma->vm_page_prot);/* Can't call userland page fault handler in the speculative path */-if(unlikely(vmf.vma_flags&VM_UFFD_MISSING))+if(unlikely(vmf.vma_flags&VM_UFFD_MISSING)){+trace_spf_vma_notsup(_RET_IP_,vma,address);gotounlock;+}#ifdef CONFIG_NUMA/*
@@ -4290,25 +4315,32 @@ int handle_speculative_fault(struct mm_struct *mm, unsigned long address,pol=__get_vma_policy(vma,address);if(!pol)pol=get_task_policy(current);-if(pol&&pol->mode==MPOL_INTERLEAVE)+if(pol&&pol->mode==MPOL_INTERLEAVE){+trace_spf_vma_notsup(_RET_IP_,vma,address);gotounlock;+}#endif-if(vmf.vma_flags&VM_GROWSDOWN||vmf.vma_flags&VM_GROWSUP)+if(vmf.vma_flags&VM_GROWSDOWN||vmf.vma_flags&VM_GROWSUP){/**ThiscouldbedetectedbythecheckaddressagainstVMA's*boundariesbutwewanttotraceitasnotsupportedinstead*ofchanged.*/+trace_spf_vma_notsup(_RET_IP_,vma,address);gotounlock;+}if(address<READ_ONCE(vma->vm_start)-||READ_ONCE(vma->vm_end)<=address)+||READ_ONCE(vma->vm_end)<=address){+trace_spf_vma_changed(_RET_IP_,vma,address);gotounlock;+}if(!arch_vma_access_permitted(vma,flags&FAULT_FLAG_WRITE,flags&FAULT_FLAG_INSTRUCTION,flags&FAULT_FLAG_REMOTE)){+trace_spf_vma_access(_RET_IP_,vma,address);ret=VM_FAULT_SIGSEGV;gotounlock;}
@@ -4316,10 +4348,12 @@ int handle_speculative_fault(struct mm_struct *mm, unsigned long address,/* This is one is required to check that the VMA has write access set */if(flags&FAULT_FLAG_WRITE){if(unlikely(!(vmf.vma_flags&VM_WRITE))){+trace_spf_vma_access(_RET_IP_,vma,address);ret=VM_FAULT_SIGSEGV;gotounlock;}}elseif(unlikely(!(vmf.vma_flags&(VM_READ|VM_EXEC|VM_WRITE)))){+trace_spf_vma_access(_RET_IP_,vma,address);ret=VM_FAULT_SIGSEGV;gotounlock;}
@@ -4377,8 +4411,10 @@ int handle_speculative_fault(struct mm_struct *mm, unsigned long address,*Weneedtore-validatetheVMAaftercheckingthebounds,otherwise*wemighthaveafalsepositiveonthebounds.*/-if(read_seqcount_retry(&vma->vm_sequence,seq))+if(read_seqcount_retry(&vma->vm_sequence,seq)){+trace_spf_vma_changed(_RET_IP_,vma,address);gotounlock;+}mem_cgroup_oom_enable();ret=handle_pte_fault(&vmf);
@@ -4401,6 +4437,7 @@ int handle_speculative_fault(struct mm_struct *mm, unsigned long address,returnret;out_walk:+trace_spf_vma_notsup(_RET_IP_,vma,address);local_irq_enable();unlock:srcu_read_unlock(&vma_srcu,idx);
There is a deadlock when a CPU is doing a speculative page fault and
another one is calling do_unmap().
The deadlock occurred because the speculative path try to spinlock the
pte while the interrupt are disabled. When the other CPU in the
unmap's path has locked the pte then is waiting for all the CPU to
invalidate the TLB. As the CPU doing the speculative fault have the
interrupt disable it can't invalidate the TLB, and can't get the lock.
Since we are in a speculative path, we can race with other mm action.
So let assume that the lock may not get acquired and fail the
speculative page fault.
Here are the stacks captured during the deadlock:
CPU 0
native_flush_tlb_others+0x7c/0x260
flush_tlb_mm_range+0x6a/0x220
tlb_flush_mmu_tlbonly+0x63/0xc0
unmap_page_range+0x897/0x9d0
? unmap_single_vma+0x7d/0xe0
? release_pages+0x2b3/0x360
unmap_single_vma+0x7d/0xe0
unmap_vmas+0x51/0xa0
unmap_region+0xbd/0x130
do_munmap+0x279/0x460
SyS_munmap+0x53/0x70
CPU 1
do_raw_spin_lock+0x14e/0x160
_raw_spin_lock+0x5d/0x80
? pte_map_lock+0x169/0x1b0
pte_map_lock+0x169/0x1b0
handle_pte_fault+0xbf2/0xd80
? trace_hardirqs_on+0xd/0x10
handle_speculative_fault+0x272/0x280
handle_speculative_fault+0x5/0x280
__do_page_fault+0x187/0x580
trace_do_page_fault+0x52/0x260
do_async_page_fault+0x19/0x70
async_page_fault+0x28/0x30
Signed-off-by: Laurent Dufour <redacted>
---
mm/memory.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
When dealing with the speculative fault path we should use the VMA's field
cached value stored in the vm_fault structure.
Currently vm_normal_page() is using the pointer to the VMA to fetch the
vm_flags value. This patch provides a new __vm_normal_page() which is
receiving the vm_flags flags value as parameter.
Note: The speculative path is turned on for architecture providing support
for special PTE flag. So only the first block of vm_normal_page is used
during the speculative path.
Signed-off-by: Laurent Dufour <redacted>
---
include/linux/mm.h | 7 +++++--
mm/memory.c | 18 ++++++++++--------
2 files changed, 15 insertions(+), 10 deletions(-)
From: Peter Zijlstra <peterz@infradead.org>
Provide infrastructure to do a speculative fault (not holding
mmap_sem).
The not holding of mmap_sem means we can race against VMA
change/removal and page-table destruction. We use the SRCU VMA freeing
to keep the VMA around. We use the VMA seqcount to detect change
(including umapping / page-table deletion) and we use gup_fast() style
page-table walking to deal with page-table races.
Once we've obtained the page and are ready to update the PTE, we
validate if the state we started the fault with is still valid, if
not, we'll fail the fault with VM_FAULT_RETRY, otherwise we update the
PTE and we're done.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
[Manage the newly introduced pte_spinlock() for speculative page
fault to fail if the VMA is touched in our back]
[Rename vma_is_dead() to vma_has_changed() and declare it here]
[Call p4d_alloc() as it is safe since pgd is valid]
[Call pud_alloc() as it is safe since p4d is valid]
[Set fe.sequence in __handle_mm_fault()]
[Abort speculative path when handle_userfault() has to be called]
[Add additional VMA's flags checks in handle_speculative_fault()]
[Clear FAULT_FLAG_ALLOW_RETRY in handle_speculative_fault()]
[Don't set vmf->pte and vmf->ptl if pte_map_lock() failed]
[Remove warning comment about waiting for !seq&1 since we don't want
to wait]
[Remove warning about no huge page support, mention it explictly]
[Don't call do_fault() in the speculative path as __do_fault() calls
vma->vm_ops->fault() which may want to release mmap_sem]
[Only vm_fault pointer argument for vma_has_changed()]
[Fix check against huge page, calling pmd_trans_huge()]
[Use READ_ONCE() when reading VMA's fields in the speculative path]
[Explicitly check for __HAVE_ARCH_PTE_SPECIAL as we can't support for
processing done in vm_normal_page()]
[Check that vma->anon_vma is already set when starting the speculative
path]
[Check for memory policy as we can't support MPOL_INTERLEAVE case due to
the processing done in mpol_misplaced()]
[Don't support VMA growing up or down]
[Move check on vm_sequence just before calling handle_pte_fault()]
[Don't build SPF services if !CONFIG_SPF]
[Add mem cgroup oom check]
[Use use READ_ONCE to access p*d entries]
Signed-off-by: Laurent Dufour <redacted>
---
include/linux/hugetlb_inline.h | 2 +-
include/linux/mm.h | 5 +
include/linux/pagemap.h | 4 +-
mm/internal.h | 16 +++
mm/memory.c | 285 ++++++++++++++++++++++++++++++++++++++++-
5 files changed, 306 insertions(+), 6 deletions(-)
@@ -320,6 +320,7 @@ struct vm_fault {gfp_tgfp_mask;/* gfp mask to be used for allocations */pgoff_tpgoff;/* Logical page offset based on vma */unsignedlongaddress;/* Faulting virtual address */+unsignedintsequence;pmd_t*pmd;/* Pointer to pmd entry matching*the'address'*/pud_t*pud;/* Pointer to pud entry matching
@@ -2458,18 +2459,90 @@ static inline void wp_page_reuse(struct vm_fault *vmf)pte_unmap_unlock(vmf->pte,vmf->ptl);}+#ifdef CONFIG_SPFstaticboolpte_spinlock(structvm_fault*vmf){+boolret=false;++/* Check if vma is still valid */+if(!(vmf->flags&FAULT_FLAG_SPECULATIVE)){+vmf->ptl=pte_lockptr(vmf->vma->vm_mm,vmf->pmd);+spin_lock(vmf->ptl);+returntrue;+}++local_irq_disable();+if(vma_has_changed(vmf))+gotoout;++vmf->ptl=pte_lockptr(vmf->vma->vm_mm,vmf->pmd);+spin_lock(vmf->ptl);++if(vma_has_changed(vmf)){+spin_unlock(vmf->ptl);+gotoout;+}++ret=true;+out:+local_irq_enable();+returnret;+}+#else+staticinlineboolpte_spinlock(structvm_fault*vmf)+{vmf->ptl=pte_lockptr(vmf->vma->vm_mm,vmf->pmd);spin_lock(vmf->ptl);returntrue;}+#endif /* CONFIG_SPF */+#ifdef CONFIG_SPFstaticboolpte_map_lock(structvm_fault*vmf){-vmf->pte=pte_offset_map_lock(vmf->vma->vm_mm,vmf->pmd,vmf->address,&vmf->ptl);+boolret=false;+pte_t*pte;+spinlock_t*ptl;++if(!(vmf->flags&FAULT_FLAG_SPECULATIVE)){+vmf->pte=pte_offset_map_lock(vmf->vma->vm_mm,vmf->pmd,+vmf->address,&vmf->ptl);+returntrue;+}++/*+*Thefirstvma_has_changed()guaranteesthepage-tablesarestill+*valid,havingIRQsdisabledensurestheystayaround,hencethe+*secondvma_has_changed()tomakesuretheyarestillvalidonce+*we'vegotthelock.Afterthataconcurrentzap_pte_range()will+*blockonthePTLandthuswe'resafe.+*/+local_irq_disable();+if(vma_has_changed(vmf))+gotoout;++pte=pte_offset_map_lock(vmf->vma->vm_mm,vmf->pmd,+vmf->address,&ptl);+if(vma_has_changed(vmf)){+pte_unmap_unlock(pte,ptl);+gotoout;+}++vmf->pte=pte;+vmf->ptl=ptl;+ret=true;+out:+local_irq_enable();+returnret;+}+#else+staticinlineboolpte_map_lock(structvm_fault*vmf)+{+vmf->pte=pte_offset_map_lock(vmf->vma->vm_mm,vmf->pmd,+vmf->address,&vmf->ptl);returntrue;}+#endif /* CONFIG_SPF *//**Handlethecaseofapagewhichweactuallyneedtocopytoanewpage.
@@ -3165,6 +3238,14 @@ static int do_anonymous_page(struct vm_fault *vmf)ret=check_stable_address_space(vma->vm_mm);if(ret)gotounlock;+/*+*Don'tcalltheuserfaultfdduringthespeculativepath.+*WealreadycheckedfortheVMAtonotbemanagedthrough+*userfaultfd,butitmaybesetinourbackoncewehavelock+*thepte.Insuchacasewecanignoreitthistime.+*/+if(vmf->flags&FAULT_FLAG_SPECULATIVE)+gotosetpte;/* Deliver the page fault to userland, check inside PT lock */if(userfaultfd_missing(vma)){pte_unmap_unlock(vmf->pte,vmf->ptl);
@@ -3207,7 +3288,7 @@ static int do_anonymous_page(struct vm_fault *vmf)gotorelease;/* Deliver the page fault to userland, check inside PT lock */-if(userfaultfd_missing(vma)){+if(!(vmf->flags&FAULT_FLAG_SPECULATIVE)&&userfaultfd_missing(vma)){pte_unmap_unlock(vmf->pte,vmf->ptl);mem_cgroup_cancel_charge(page,memcg,false);put_page(page);
@@ -3986,6 +4067,8 @@ static int handle_pte_fault(struct vm_fault *vmf)if(!vmf->pte){if(vma_is_anonymous(vmf->vma))returndo_anonymous_page(vmf);+elseif(vmf->flags&FAULT_FLAG_SPECULATIVE)+returnVM_FAULT_RETRY;elsereturndo_fault(vmf);}
@@ -4083,6 +4166,9 @@ static int __handle_mm_fault(struct vm_area_struct *vma, unsigned long address,vmf.pmd=pmd_alloc(mm,vmf.pud,address);if(!vmf.pmd)returnVM_FAULT_OOM;+#ifdef CONFIG_SPF+vmf.sequence=raw_read_seqcount(&vma->vm_sequence);+#endifif(pmd_none(*vmf.pmd)&&transparent_hugepage_enabled(vma)){ret=create_huge_pmd(&vmf);if(!(ret&VM_FAULT_FALLBACK))
@@ -4116,6 +4202,199 @@ static int __handle_mm_fault(struct vm_area_struct *vma, unsigned long address,returnhandle_pte_fault(&vmf);}+#ifdef CONFIG_SPF++#ifndef __HAVE_ARCH_PTE_SPECIAL+/* This is required by vm_normal_page() */+#error "Speculative page fault handler requires __HAVE_ARCH_PTE_SPECIAL"+#endif++/*+*vm_normal_page()addssomeprocessingwhichshouldbedonewhile+*hodlingthemmap_sem.+*/+inthandle_speculative_fault(structmm_struct*mm,unsignedlongaddress,+unsignedintflags)+{+structvm_faultvmf={+.address=address,+};+pgd_t*pgd,pgde;+p4d_t*p4d,p4de;+pud_t*pud,pude;+pmd_t*pmd,pmde;+intdead,seq,idx,ret=VM_FAULT_RETRY;+structvm_area_struct*vma;+#ifdef CONFIG_NUMA+structmempolicy*pol;+#endif++/* Clear flags that may lead to release the mmap_sem to retry */+flags&=~(FAULT_FLAG_ALLOW_RETRY|FAULT_FLAG_KILLABLE);+flags|=FAULT_FLAG_SPECULATIVE;++idx=srcu_read_lock(&vma_srcu);+vma=find_vma_srcu(mm,address);+if(!vma)+gotounlock;++/*+*ValidatetheVMAfoundbythelocklesslookup.+*/+dead=RB_EMPTY_NODE(&vma->vm_rb);+seq=raw_read_seqcount(&vma->vm_sequence);/* rmb <-> seqlock,vma_rb_erase() */+if((seq&1)||dead)+gotounlock;++/*+*Can'tcallvm_opsservicehaswedon'tknowwhattheywoulddo+*withtheVMA.+*Thisincludehugepagefromhugetlbfs.+*/+if(vma->vm_ops)+gotounlock;++/*+*__anon_vma_prepare()requiresthemmap_semtobeheld+*becausevm_nextandvm_prevmustbesafe.Thiscan'tbeguaranteed+*inthespeculativepath.+*/+if(unlikely(!vma->anon_vma))+gotounlock;++vmf.vma_flags=READ_ONCE(vma->vm_flags);+vmf.vma_page_prot=READ_ONCE(vma->vm_page_prot);++/* Can't call userland page fault handler in the speculative path */+if(unlikely(vmf.vma_flags&VM_UFFD_MISSING))+gotounlock;++#ifdef CONFIG_NUMA+/*+*MPOL_INTERLEAVEimpliesadditionalcheckinmpol_misplaced()which+*arenotcompatiblewiththespeculativepagefaultprocessing.+*/+pol=__get_vma_policy(vma,address);+if(!pol)+pol=get_task_policy(current);+if(pol&&pol->mode==MPOL_INTERLEAVE)+gotounlock;+#endif++if(vmf.vma_flags&VM_GROWSDOWN||vmf.vma_flags&VM_GROWSUP)+/*+*ThiscouldbedetectedbythecheckaddressagainstVMA's+*boundariesbutwewanttotraceitasnotsupportedinstead+*ofchanged.+*/+gotounlock;++if(address<READ_ONCE(vma->vm_start)+||READ_ONCE(vma->vm_end)<=address)+gotounlock;++if(!arch_vma_access_permitted(vma,flags&FAULT_FLAG_WRITE,+flags&FAULT_FLAG_INSTRUCTION,+flags&FAULT_FLAG_REMOTE)){+ret=VM_FAULT_SIGSEGV;+gotounlock;+}++/* This is one is required to check that the VMA has write access set */+if(flags&FAULT_FLAG_WRITE){+if(unlikely(!(vmf.vma_flags&VM_WRITE))){+ret=VM_FAULT_SIGSEGV;+gotounlock;+}+}elseif(unlikely(!(vmf.vma_flags&(VM_READ|VM_EXEC|VM_WRITE)))){+ret=VM_FAULT_SIGSEGV;+gotounlock;+}++/*+*DoaspeculativelookupofthePTEentry.+*/+local_irq_disable();+pgd=pgd_offset(mm,address);+pgde=READ_ONCE(*pgd);+if(pgd_none(pgde)||unlikely(pgd_bad(pgde)))+gotoout_walk;++p4d=p4d_alloc(mm,pgd,address);+p4de=READ_ONCE(*p4d);+if(p4d_none(p4de)||unlikely(p4d_bad(p4de)))+gotoout_walk;++pud=pud_alloc(mm,p4d,address);+pude=READ_ONCE(*pud);+if(pud_none(pude)||unlikely(pud_bad(pude)))+gotoout_walk;++/* Transparent huge pages are not supported. */+if(unlikely(pud_trans_huge(pude)))+gotoout_walk;++pmd=pmd_offset(pud,address);+pmde=READ_ONCE(*pmd);+if(pmd_none(pmde)||unlikely(pmd_bad(pmde)))+gotoout_walk;++/*+*Theabovedoesnotallocate/instantiatepage-tablesbecausedoingso+*wouldleadtothepossibilityofinstantiatingpage-tablesafter+*free_pgtables()--andconsequentlyleakingthem.+*+*Theresultisthatwetakeatleastone!speculativefaultperPMD+*inordertoinstantiateit.+*/+/* Transparent huge pages are not supported. */+if(unlikely(pmd_trans_huge(pmde)))+gotoout_walk;++vmf.vma=vma;+vmf.pmd=pmd;+vmf.pgoff=linear_page_index(vma,address);+vmf.gfp_mask=__get_fault_gfp_mask(vma);+vmf.sequence=seq;+vmf.flags=flags;++local_irq_enable();++/*+*Weneedtore-validatetheVMAaftercheckingthebounds,otherwise+*wemighthaveafalsepositiveonthebounds.+*/+if(read_seqcount_retry(&vma->vm_sequence,seq))+gotounlock;++mem_cgroup_oom_enable();+ret=handle_pte_fault(&vmf);+mem_cgroup_oom_disable();++/*+*ThereisnomoreneedtoholdSRCUsincetheVMApointerisnomore+*used.ReleaseitrightnowtoavoidlongerSRCUgraceperiod.+*/+srcu_read_unlock(&vma_srcu,idx);++/*+*ThetaskmayhaveenteredamemcgOOMsituationbut+*iftheallocationerrorwashandledgracefully(no+*VM_FAULT_OOM),thereisnoneedtokillanything.+*JustcleanuptheOOMstatepeacefully.+*/+if(task_in_memcg_oom(current)&&!(ret&VM_FAULT_OOM))+mem_cgroup_oom_synchronize(false);+returnret;++out_walk:+local_irq_enable();+unlock:+srcu_read_unlock(&vma_srcu,idx);+returnret;+}+#endif /* CONFIG_SPF */+/**Bythetimewegethere,wealreadyholdthemmsemaphore*
The current maybe_mkwrite() is getting passed the pointer to the vma
structure to fetch the vm_flags field.
When dealing with the speculative page fault handler, it will be better to
rely on the cached vm_flags value stored in the vm_fault structure.
This patch introduce a __maybe_mkwrite() service which can be called by
passing the value of the vm_flags field.
There is no change functional changes expected for the other callers of
maybe_mkwrite().
Signed-off-by: Laurent Dufour <redacted>
---
include/linux/mm.h | 9 +++++++--
mm/memory.c | 6 +++---
2 files changed, 10 insertions(+), 5 deletions(-)
From: Peter Zijlstra <peterz@infradead.org>
Manage the VMAs with SRCU such that we can do a lockless VMA lookup.
We put the fput(vma->vm_file) in the SRCU callback, this keeps files
valid during speculative faults, this is possible due to the delayed
fput work by Al Viro -- do we need srcu_barrier() in unmount
someplace?
We guard the mm_rb tree with a seqlock (this could be a seqcount but
we'd have to disable preemption around the write side in order to make
the retry loop in __read_seqcount_begin() work) such that we can know
if the rb tree walk was correct. We cannot trust the restult of a
lockless tree walk in the face of concurrent tree rotations; although
we can trust on the termination of such walks -- tree rotations
guarantee the end result is a tree again after all.
Furthermore, we rely on the WMB implied by the
write_seqlock/count_begin() to separate the VMA initialization and the
publishing stores, analogous to the RELEASE in rcu_assign_pointer().
We also rely on the RMB from read_seqretry() to separate the vma load
from further loads like the smp_read_barrier_depends() in regular
RCU.
We must not touch the vmacache while doing SRCU lookups as that is not
properly serialized against changes. We update gap information after
publishing the VMA, but A) we don't use that and B) the seqlock
read side would fix that anyhow.
We clear vma->vm_rb for nodes removed from the vma tree such that we
can easily detect such 'dead' nodes, we rely on the WMB from
write_sequnlock() to separate the tree removal and clearing the node.
Provide find_vma_srcu() which wraps the required magic.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
[Remove the warnings in description about the SRCU global lock which
has been removed now]
[Rename vma_is_dead() to vma_has_changed() and move its adding to the next
patch]
[Postpone call to mpol_put() as the policy can be used during the
speculative path]
Signed-off-by: Laurent Dufour <redacted>
mm/spf: Fix policy free
---
include/linux/mm_types.h | 2 +
kernel/fork.c | 1 +
mm/init-mm.c | 1 +
mm/internal.h | 5 +++
mm/mmap.c | 103 ++++++++++++++++++++++++++++++++++-------------
5 files changed, 84 insertions(+), 28 deletions(-)
@@ -923,15 +951,12 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start,}if(remove_next){-if(file){+if(file)uprobe_munmap(next,next->vm_start,next->vm_end);-fput(file);-}if(next->anon_vma)anon_vma_merge(vma,next);mm->map_count--;-mpol_put(vma_policy(next));-kmem_cache_free(vm_area_cachep,next);+free_vma(next);vm_raw_write_end(next);/**Inmprotect'scase6(seecommentsonvma_merge),
@@ -2151,15 +2176,10 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,EXPORT_SYMBOL(get_unmapped_area);/* Look up the first VMA which satisfies addr < vm_end, NULL if none. */-structvm_area_struct*find_vma(structmm_struct*mm,unsignedlongaddr)+staticstructvm_area_struct*__find_vma(structmm_struct*mm,unsignedlongaddr){structrb_node*rb_node;-structvm_area_struct*vma;--/* Check the cache first. */-vma=vmacache_find(mm,addr);-if(likely(vma))-returnvma;+structvm_area_struct*vma=NULL;rb_node=mm->mm_rb.rb_node;
@@ -2177,13 +2197,40 @@ struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr)rb_node=rb_node->rb_right;}+returnvma;+}++structvm_area_struct*find_vma(structmm_struct*mm,unsignedlongaddr)+{+structvm_area_struct*vma;++/* Check the cache first. */+vma=vmacache_find(mm,addr);+if(likely(vma))+returnvma;++vma=__find_vma(mm,addr);if(vma)vmacache_update(addr,vma);returnvma;}-EXPORT_SYMBOL(find_vma);+structvm_area_struct*find_vma_srcu(structmm_struct*mm,unsignedlongaddr)+{+structvm_area_struct*vma;+unsignedintseq;++WARN_ON_ONCE(!srcu_read_lock_held(&vma_srcu));++do{+seq=read_seqbegin(&mm->mm_seq);+vma=__find_vma(mm,addr);+}while(read_seqretry(&mm->mm_seq,seq));++returnvma;+}+/**Sameasfind_vma,butalsoreturnapointertothepreviousVMAin*pprev.*/
From: Peter Zijlstra <peterz@infradead.org>
Wrap the VMA modifications (vma_adjust/unmap_page_range) with sequence
counts such that we can easily test if a VMA is changed.
The unmap_page_range() one allows us to make assumptions about
page-tables; when we find the seqcount hasn't changed we can assume
page-tables are still valid.
The flip side is that we cannot distinguish between a vma_adjust() and
the unmap_page_range() -- where with the former we could have
re-checked the vma bounds against the address.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
[Port to 4.12 kernel]
[Build depends on CONFIG_SPF]
[Introduce vm_write_* inline function depending on CONFIG_SPF]
[Fix lock dependency between mapping->i_mmap_rwsem and vma->vm_sequence by
using vm_raw_write* functions]
Signed-off-by: Laurent Dufour <redacted>
Fix locked by raw function
undo lockdep fix as raw services are now used
---
include/linux/mm.h | 41 +++++++++++++++++++++++++++++++++++++++++
include/linux/mm_types.h | 3 +++
mm/memory.c | 2 ++
mm/mmap.c | 40 +++++++++++++++++++++++++++++++++++++---
4 files changed, 83 insertions(+), 3 deletions(-)
@@ -346,6 +346,9 @@ struct vm_area_struct {structmempolicy*vm_policy;/* NUMA policy for the VMA */#endifstructvm_userfaultfd_ctxvm_userfaultfd_ctx;+#ifdef CONFIG_SPF+seqcount_tvm_sequence;+#endif}__randomize_layout;structcore_thread{
From: Peter Zijlstra <peterz@infradead.org>
When speculating faults (without holding mmap_sem) we need to validate
that the vma against which we loaded pages is still valid when we're
ready to install the new PTE.
Therefore, replace the pte_offset_map_lock() calls that (re)take the
PTL with pte_map_lock() which can fail in case we find the VMA changed
since we started the fault.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
[Port to 4.12 kernel]
[Remove the comment about the fault_env structure which has been
implemented as the vm_fault structure in the kernel]
Signed-off-by: Laurent Dufour <redacted>
---
include/linux/mm.h | 1 +
mm/memory.c | 55 ++++++++++++++++++++++++++++++++++++++----------------
2 files changed, 40 insertions(+), 16 deletions(-)
@@ -291,6 +291,7 @@ extern pgprot_t protection_map[16];#define FAULT_FLAG_USER 0x40 /* The fault originated in userspace */#define FAULT_FLAG_REMOTE 0x80 /* faulting for non current tsk/mm */#define FAULT_FLAG_INSTRUCTION 0x100 /* The fault was during an instruction fetch */+#define FAULT_FLAG_SPECULATIVE 0x200 /* Speculative fault, not holding mmap_sem */#define FAULT_FLAG_TRACE \{FAULT_FLAG_WRITE,"WRITE"},\
This patch enable the speculative page fault on the PowerPC
architecture.
This will try a speculative page fault without holding the mmap_sem,
if it returns with VM_FAULT_RETRY, the mmap_sem is acquired and the
traditional page fault processing is done.
Build on if CONFIG_SPF is defined (currently for BOOK3S_64 && SMP).
Signed-off-by: Laurent Dufour <redacted>
---
arch/powerpc/mm/fault.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
@@ -442,6 +442,20 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address,if(is_exec)flags|=FAULT_FLAG_INSTRUCTION;+#ifdef CONFIG_SPF+if(is_user){+/* let's try a speculative page fault without grabbing the+*mmap_sem.+*/+fault=handle_speculative_fault(mm,address,flags);+if(!(fault&VM_FAULT_RETRY)){+perf_sw_event(PERF_COUNT_SW_SPF,1,+regs,address);+gotodone;+}+}+#endif /* CONFIG_SPF */+/* When running in the kernel we expect faults to occur only to*addressesinuserspace.Allotherfaultsrepresenterrorsinthe*kernelandshouldgenerateanOOPS.Unfortunately,inthecaseofan
@@ -526,6 +540,9 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address,up_read(¤t->mm->mmap_sem);+#ifdef CONFIG_SPF+done:+#endifif(unlikely(fault&VM_FAULT_ERROR))returnmm_fault_error(regs,address,fault);
From: Andrea Arcangeli <hidden> Date: 2017-10-26 10:18:39
Hello Laurent,
Message-ID: [off-list ref] shows
significant slowdown even for brk/malloc ops both single and
multi threaded.
The single threaded case I think is the most important because it has
zero chance of getting back any benefit later during page faults.
Could you check if:
1. it's possible change vm_write_begin to be a noop if mm->mm_count is
<= 1? Hint: clone() will run single threaded so there's no way it can run
in the middle of a being/end critical section (clone could set an
MMF flag to possibly keep the sequence counter activated if a child
thread exits and mm_count drops to 1 while the other cpu is in the
middle of a critical section in the other thread).
2. Same thing with RCU freeing of vmas. Wouldn't it be nicer if RCU
freeing happened only once a MMF flag is set? That will at least
reduce the risk of temporary memory waste until the next RCU grace
period. The read of the MMF will scale fine. Of course to allow
point 1 and 2 then the page fault should also take the mmap_sem
until the MMF flag is set.
Could you also investigate a much bigger change: I wonder if it's
possible to drop the sequence number entirely from the vma and stop
using sequence numbers entirely (which is likely the source of the
single threaded regression in point 1 that may explain the report in
the above message-id), and just call the vma rbtree lookup once again
and check that everything is still the same in the vma and the PT lock
obtained is still a match to finish the anon page fault and fill the
pte?
Then of course we also need to add a method to the read-write
semaphore so it tells us if there's already one user holding the read
mmap_sem and we're the second one. If we're the second one (or more
than second) only then we should skip taking the down_read mmap_sem.
Even a multithreaded app won't ever skip taking the mmap_sem until
there's sign of runtime contention, and it won't have to run the way
more expensive sequence number-less revalidation during page faults,
unless we get an immediate scalability payoff because we already know
the mmap_sem is already contended and there are multiple nested
threads in the page fault handler of the same mm.
Perhaps we'd need something more advanced than a
down_read_trylock_if_not_hold() (which has to guaranteed not to write
to any cacheline) and we'll have to count the per-thread exponential
backoff of mmap_sem frequency, but starting with
down_read_trylock_if_not_hold() would be good I think.
This is not how the current patch works, the current patch uses a
sequence number because it pretends to go lockless always and in turn
has to slow down all vma updates fast paths or the revalidation
slowsdown performance for page fault too much (as it always
revalidates).
I think it would be much better to go speculative only when there's
"detected" runtime contention on the mmap_sem with
down_read_trylock_if_not_hold() and that will make the revalidation
cost not an issue to worry about because normally we won't have to
revalidate the vma at all during page fault. In turn by making the
revalidation more expensive by starting a vma rbtree lookup from
scratch, we can drop the sequence number entirely and that should
simplify the patch tremendously because all vm_write_begin/end would
disappear from the patch and in turn the mmap/brk slowdown measured by
the message-id above, should disappear as well.
Thanks,
Andrea
Some regression is found by LKP-tools(linux kernel performance) on this patch series
tested on Intel 2s/4s Skylake platform.
The regression result is sorted by the metric will-it-scale.per_process_ops.
Hi Kemi,
Thanks for reporting this, I'll try to address it by turning some features
of the SPF path off when the process is monothreaded.
Laurent.
This patch enable the speculative page fault on the PowerPC
architecture.
This will try a speculative page fault without holding the mmap_sem,
if it returns with VM_FAULT_RETRY, the mmap_sem is acquired and the
traditional page fault processing is done.
Build on if CONFIG_SPF is defined (currently for BOOK3S_64 && SMP).
Signed-off-by: Laurent Dufour <redacted>
---
arch/powerpc/mm/fault.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
@@ -442,6 +442,20 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address,if(is_exec)flags|=FAULT_FLAG_INSTRUCTION;+#ifdef CONFIG_SPF+if(is_user){+/* let's try a speculative page fault without grabbing the+*mmap_sem.+*/+fault=handle_speculative_fault(mm,address,flags);+if(!(fault&VM_FAULT_RETRY)){+perf_sw_event(PERF_COUNT_SW_SPF,1,+regs,address);+gotodone;+}+}+#endif /* CONFIG_SPF */+/* When running in the kernel we expect faults to occur only to*addressesinuserspace.Allotherfaultsrepresenterrorsinthe*kernelandshouldgenerateanOOPS.Unfortunately,inthecaseofan
@@ -526,6 +540,9 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address,up_read(¤t->mm->mmap_sem);+#ifdef CONFIG_SPF+done:+#endifif(unlikely(fault&VM_FAULT_ERROR))returnmm_fault_error(regs,address,fault);
Hi Andrea,
Thanks for reviewing this series, and sorry for the late answer, I took few
days off...
On 26/10/2017 12:18, Andrea Arcangeli wrote:
Hello Laurent,
Message-ID: [off-list ref] shows
significant slowdown even for brk/malloc ops both single and
multi threaded.
The single threaded case I think is the most important because it has
zero chance of getting back any benefit later during page faults.
Could you check if:
1. it's possible change vm_write_begin to be a noop if mm->mm_count is
<= 1? Hint: clone() will run single threaded so there's no way it can run
in the middle of a being/end critical section (clone could set an
MMF flag to possibly keep the sequence counter activated if a child
thread exits and mm_count drops to 1 while the other cpu is in the
middle of a critical section in the other thread).
This sounds to be a good idea, I'll dig on that.
The major risk here is to have a thread calling vm_*_begin() with
mm->mm_count > 1 and later calling vm_*_end() with mm->mm_count <= 1, but
as you mentioned we should find a way to work around this.
2. Same thing with RCU freeing of vmas. Wouldn't it be nicer if RCU
freeing happened only once a MMF flag is set? That will at least
reduce the risk of temporary memory waste until the next RCU grace
period. The read of the MMF will scale fine. Of course to allow
point 1 and 2 then the page fault should also take the mmap_sem
until the MMF flag is set.
I think we could also deal with the mm->mm_count value here, if there is
only one thread, no need to postpone the VMA's free operation. Isn't it ?
Also, if mm->mm_count <= 1, there is no need to try the speculative path.
Could you also investigate a much bigger change: I wonder if it's
possible to drop the sequence number entirely from the vma and stop
using sequence numbers entirely (which is likely the source of the
single threaded regression in point 1 that may explain the report in
the above message-id), and just call the vma rbtree lookup once again
and check that everything is still the same in the vma and the PT lock
obtained is still a match to finish the anon page fault and fill the
pte?
That's an interesting idea. The big deal here would be to detect that the
VMA has been touched in our back, but there are not so much VMA's fields
involved in the speculative path so that sounds reasonable. The other point
is to identify the impact of the vma rbtree lookup, it's also a known
order, but there is the vma_srcu's lock involved.
Then of course we also need to add a method to the read-write
semaphore so it tells us if there's already one user holding the read
mmap_sem and we're the second one. If we're the second one (or more
than second) only then we should skip taking the down_read mmap_sem.
Even a multithreaded app won't ever skip taking the mmap_sem until
there's sign of runtime contention, and it won't have to run the way
more expensive sequence number-less revalidation during page faults,
unless we get an immediate scalability payoff because we already know
the mmap_sem is already contended and there are multiple nested
threads in the page fault handler of the same mm.
The problem is that we may have a thread entering the page fault path,
seeing that the mmap_sem is free, grab it and continue processing the page
fault. Then another thread is entering mprotect or any other mm service
which grab the mmap_sem and it will be blocked until the page fault is
done. The idea with the speculative page fault is also to not block the
other thread which may need to grab the mmap_sem.
Perhaps we'd need something more advanced than a
down_read_trylock_if_not_hold() (which has to guaranteed not to write
to any cacheline) and we'll have to count the per-thread exponential
backoff of mmap_sem frequency, but starting with
down_read_trylock_if_not_hold() would be good I think.
This is not how the current patch works, the current patch uses a
sequence number because it pretends to go lockless always and in turn
has to slow down all vma updates fast paths or the revalidation
slowsdown performance for page fault too much (as it always
revalidates).
I think it would be much better to go speculative only when there's
"detected" runtime contention on the mmap_sem with
down_read_trylock_if_not_hold() and that will make the revalidation
cost not an issue to worry about because normally we won't have to
revalidate the vma at all during page fault. In turn by making the
revalidation more expensive by starting a vma rbtree lookup from
scratch, we can drop the sequence number entirely and that should
simplify the patch tremendously because all vm_write_begin/end would
disappear from the patch and in turn the mmap/brk slowdown measured by
the message-id above, should disappear as well.
As I mentioned above, I'm not sure about checking the lock contention when
entering the page fault path, checking for the mm->mm_count or a dedicated
mm flags should be enough, but removing the sequence lock would be a very
good simplification. I'll dig further here, and come back soon.
Thanks a lot,
Laurent.
Hi Andrea,
Thanks for reviewing this series, and sorry for the late answer, I took few
days off...
On 26/10/2017 12:18, Andrea Arcangeli wrote:
quoted
Hello Laurent,
Message-ID: [off-list ref] shows
significant slowdown even for brk/malloc ops both single and
multi threaded.
The single threaded case I think is the most important because it has
zero chance of getting back any benefit later during page faults.
Could you check if:
1. it's possible change vm_write_begin to be a noop if mm->mm_count is
<= 1? Hint: clone() will run single threaded so there's no way it can run
in the middle of a being/end critical section (clone could set an
MMF flag to possibly keep the sequence counter activated if a child
thread exits and mm_count drops to 1 while the other cpu is in the
middle of a critical section in the other thread).
This sounds to be a good idea, I'll dig on that.
The major risk here is to have a thread calling vm_*_begin() with
mm->mm_count > 1 and later calling vm_*_end() with mm->mm_count <= 1, but
as you mentioned we should find a way to work around this.
quoted
2. Same thing with RCU freeing of vmas. Wouldn't it be nicer if RCU
freeing happened only once a MMF flag is set? That will at least
reduce the risk of temporary memory waste until the next RCU grace
period. The read of the MMF will scale fine. Of course to allow
point 1 and 2 then the page fault should also take the mmap_sem
until the MMF flag is set.
I think we could also deal with the mm->mm_count value here, if there is
only one thread, no need to postpone the VMA's free operation. Isn't it ?
Also, if mm->mm_count <= 1, there is no need to try the speculative path.
quoted
Could you also investigate a much bigger change: I wonder if it's
possible to drop the sequence number entirely from the vma and stop
using sequence numbers entirely (which is likely the source of the
single threaded regression in point 1 that may explain the report in
the above message-id), and just call the vma rbtree lookup once again
and check that everything is still the same in the vma and the PT lock
obtained is still a match to finish the anon page fault and fill the
pte?
That's an interesting idea. The big deal here would be to detect that the
VMA has been touched in our back, but there are not so much VMA's fields
involved in the speculative path so that sounds reasonable. The other point
is to identify the impact of the vma rbtree lookup, it's also a known
order, but there is the vma_srcu's lock involved.
I think there is some memory barrier missing when the VMA is modified so
currently the modifications done in the VMA structure may not be written
down at the time the pte is locked. So doing that change will also requires
to call smp_wmb() before locking the page tables. In the current patch this
is ensured by the call to write_seqcount_end().
Doing so will still require to have a memory barrier when touching the VMA.
Not sure we get far better performance compared to the sequence count
change. But I'll give it a try anyway ;)
quoted
Then of course we also need to add a method to the read-write
semaphore so it tells us if there's already one user holding the read
mmap_sem and we're the second one. If we're the second one (or more
than second) only then we should skip taking the down_read mmap_sem.
Even a multithreaded app won't ever skip taking the mmap_sem until
there's sign of runtime contention, and it won't have to run the way
more expensive sequence number-less revalidation during page faults,
unless we get an immediate scalability payoff because we already know
the mmap_sem is already contended and there are multiple nested
threads in the page fault handler of the same mm.
The problem is that we may have a thread entering the page fault path,
seeing that the mmap_sem is free, grab it and continue processing the page
fault. Then another thread is entering mprotect or any other mm service
which grab the mmap_sem and it will be blocked until the page fault is
done. The idea with the speculative page fault is also to not block the
other thread which may need to grab the mmap_sem.
quoted
Perhaps we'd need something more advanced than a
down_read_trylock_if_not_hold() (which has to guaranteed not to write
to any cacheline) and we'll have to count the per-thread exponential
backoff of mmap_sem frequency, but starting with
down_read_trylock_if_not_hold() would be good I think.
This is not how the current patch works, the current patch uses a
sequence number because it pretends to go lockless always and in turn
has to slow down all vma updates fast paths or the revalidation
slowsdown performance for page fault too much (as it always
revalidates).
I think it would be much better to go speculative only when there's
"detected" runtime contention on the mmap_sem with
down_read_trylock_if_not_hold() and that will make the revalidation
cost not an issue to worry about because normally we won't have to
revalidate the vma at all during page fault. In turn by making the
revalidation more expensive by starting a vma rbtree lookup from
scratch, we can drop the sequence number entirely and that should
simplify the patch tremendously because all vm_write_begin/end would
disappear from the patch and in turn the mmap/brk slowdown measured by
the message-id above, should disappear as well.
As I mentioned above, I'm not sure about checking the lock contention when
entering the page fault path, checking for the mm->mm_count or a dedicated
mm flags should be enough, but removing the sequence lock would be a very
good simplification. I'll dig further here, and come back soon.
Thanks a lot,
Laurent.
--
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>
From: Andrea Arcangeli <hidden> Date: 2017-11-02 20:08:45
On Thu, Nov 02, 2017 at 06:25:11PM +0100, Laurent Dufour wrote:
I think there is some memory barrier missing when the VMA is modified so
currently the modifications done in the VMA structure may not be written
down at the time the pte is locked. So doing that change will also requires
to call smp_wmb() before locking the page tables. In the current patch this
is ensured by the call to write_seqcount_end().
Doing so will still require to have a memory barrier when touching the VMA.
Not sure we get far better performance compared to the sequence count
change. But I'll give it a try anyway ;)
Luckily smp_wmb is a noop on x86. I would suggest to ignore the above
issue completely if you give it a try, and then if this performs, we
can just embed a smp_wmb() before spin_lock() somewhere in
pte_offset_map_lock/pte_lockptr/spin_lock_nested for those archs whose
spin_lock isn't a smp_wmb() equivalent. I would focus at flushing
writes before every pagetable spin_lock for non-x86 archs, rather than
after all vma modifications. That should be easier to keep under
control and it's going to be more efficient too as if something there
are fewer spin locks than vma modifications.
For non-x86 archs we may then need a smp_wmb__before_spin_lock. That
looks more self contained than surrounding all vma modifications and
it's a noop on x86 anyway.
I thought about the contention detection logic too yesterday: to
detect contention we could have a mm->mmap_sem_contention_jiffies and
if down_read_trylock_exclusive() [same as down_read_if_not_hold in
prev mail] fails (and it'll fail if either read or write mmap_sem is
hold, so also convering mremap/mprotect etc..) we set
mm->mmap_sem_contention_jiffies = jiffies and then to know if you must
not touch the mmap_sem at all, you compare jiffies against
mmap_sem_contention_jiffies, if it's equal we go speculative. If
that's not enough we can just keep going speculative for a few more
jiffies with time_before(). The srcu lock is non concerning because the
inc/dec of the fast path is in per-cpu cacheline of course, no false
sharing possible there or it wouldn't be any better than a normal lock.
The vma revalidation is already done by khugepaged and mm/userfaultfd,
both need to drop the mmap_sem and continue working on the pagetables,
so we already know it's workable and not too slow.
Summarizing.. by using a runtime contention triggered speculative
design that goes speculative only when contention is runtime-detected
using the above logic (or equivalent), and by having to revalidate the
vma by hand with find_vma without knowing instantly if the vma become
stale, we will run with a substantially slower speculative page fault
than with your current speculative always-on design, but the slower
speculative page fault runtime will still scale 100% in SMP so it
should still be faster on large SMP systems. The pros is that it won't
regress the mmap/brk vma modifications. The whole complexity of
tracking the vma modifications should also go away and the resulting
code should be more maintainable and less risky to break in subtle
ways impossible to reproduce.
Thanks!
Andrea
Hi Andrea,
On 02/11/2017 21:08, Andrea Arcangeli wrote:
On Thu, Nov 02, 2017 at 06:25:11PM +0100, Laurent Dufour wrote:
quoted
I think there is some memory barrier missing when the VMA is modified so
currently the modifications done in the VMA structure may not be written
down at the time the pte is locked. So doing that change will also requires
to call smp_wmb() before locking the page tables. In the current patch this
is ensured by the call to write_seqcount_end().
Doing so will still require to have a memory barrier when touching the VMA.
Not sure we get far better performance compared to the sequence count
change. But I'll give it a try anyway ;)
Luckily smp_wmb is a noop on x86. I would suggest to ignore the above
issue completely if you give it a try, and then if this performs, we
can just embed a smp_wmb() before spin_lock() somewhere in
pte_offset_map_lock/pte_lockptr/spin_lock_nested for those archs whose
spin_lock isn't a smp_wmb() equivalent. I would focus at flushing
writes before every pagetable spin_lock for non-x86 archs, rather than
after all vma modifications. That should be easier to keep under
control and it's going to be more efficient too as if something there
are fewer spin locks than vma modifications.
I do agree that would simplify the patch series a lot.
I'll double check that pte lock is not done in a loop other wise having
smp_wmb() there will be bad.
Another point I'm trying to double check is that we may have inconsistency
while reading the vma's flags in the page fault path until the memory
barrier got it in the VMA's changing path. Especially we may have vm_flags
and vm_page_prot not matching at all, which couldn't happen when checking
for the vm_sequence count.
For non-x86 archs we may then need a smp_wmb__before_spin_lock. That
looks more self contained than surrounding all vma modifications and
it's a noop on x86 anyway.
I thought about the contention detection logic too yesterday: to
detect contention we could have a mm->mmap_sem_contention_jiffies and
if down_read_trylock_exclusive() [same as down_read_if_not_hold in
prev mail] fails (and it'll fail if either read or write mmap_sem is
hold, so also convering mremap/mprotect etc..) we set
mm->mmap_sem_contention_jiffies = jiffies and then to know if you must
not touch the mmap_sem at all, you compare jiffies against
mmap_sem_contention_jiffies, if it's equal we go speculative. If
that's not enough we can just keep going speculative for a few more
jiffies with time_before(). The srcu lock is non concerning because the
inc/dec of the fast path is in per-cpu cacheline of course, no false
sharing possible there or it wouldn't be any better than a normal lock.
I'm sorry, I should have missed something here. I can't see how this would
help fixing the case where a thread is entering the page fault handler
seeing that no one else has the mmap_sem and then grab it. While it is
processing the page fault another thread is entering mprotect for instance
and thus will wait for the mmap_sem to be released by the thread processing
the page fault.
Cheers,
Laurent.
The vma revalidation is already done by khugepaged and mm/userfaultfd,
both need to drop the mmap_sem and continue working on the pagetables,
so we already know it's workable and not too slow.
Summarizing.. by using a runtime contention triggered speculative
design that goes speculative only when contention is runtime-detected
using the above logic (or equivalent), and by having to revalidate the
vma by hand with find_vma without knowing instantly if the vma become
stale, we will run with a substantially slower speculative page fault
than with your current speculative always-on design, but the slower
speculative page fault runtime will still scale 100% in SMP so it
should still be faster on large SMP systems. The pros is that it won't
regress the mmap/brk vma modifications. The whole complexity of
tracking the vma modifications should also go away and the resulting
code should be more maintainable and less risky to break in subtle
ways impossible to reproduce.
Thanks!
Andrea
Some regression is found by LKP-tools(linux kernel performance) on this patch series
tested on Intel 2s/4s Skylake platform.
The regression result is sorted by the metric will-it-scale.per_process_ops.
Hi Kemi,
Thanks for reporting this, I'll try to address it by turning some features
of the SPF path off when the process is monothreaded.
make them madvice()-able?
not all multi-threaded apps will necessarily benefit of SPF. right?
just an idea.
-ss