From b85526df37073d4def86f48c9be93d8ab170c28e Mon Sep 17 00:00:00 2001 From: Will McVicker Date: Mon, 2 Mar 2020 17:22:27 -0800 Subject: [PATCH] ANDROID: GKI: mm: add struct/enum fields for SPECULATIVE_PAGE_FAULTS Add the necessary struct/enum attributes from the SPECULATIVE_PAGE_FAULTS feature as padding to reduce the ABI diff between vendors and ACK. This allows vendors to pick the SPECULATIVE_PAGE_FAULTS feature and still be ABI compatible with ACK-4.19. Bug: 149848888 Bug: 151963988 Test: build Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Laurent Dufour Signed-off-by: Vinayak Menon Signed-off-by: Charan Teja Reddy [surenb: Squashed the following commits and kept only struct/enum changes 396b98086496 mm: provide speculative fault infrastructure 47e3eb155848 mm: cache some VMA fields in the vm_fault structure 3f31f748a8ba mm: protect mm_rb tree with a rwlock 88a78dc2863d mm: VMA sequence count 0947fbfea499 mm: allow vmas with vm_ops to be speculatively handled ] Signed-off-by: Will McVicker Signed-off-by: Suren Baghdasaryan Merged-In: I1aa561649a836c753b9e52710c3bc1f6eee1dd78 Change-Id: I1aa561649a836c753b9e52710c3bc1f6eee1dd78 --- include/linux/mm.h | 4 ++++ include/linux/mm_types.h | 5 +++++ include/linux/vm_event_item.h | 2 ++ mm/vmstat.c | 2 ++ 4 files changed, 13 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index c06305ce27d5..12edfa2873d0 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -357,6 +357,8 @@ struct vm_fault { gfp_t gfp_mask; /* gfp mask to be used for allocations */ pgoff_t pgoff; /* Logical page offset based on vma */ unsigned long address; /* Faulting virtual address */ + unsigned int sequence; /* Speculative Page Fault field */ + pmd_t orig_pmd; /* Speculative Page Fault field */ pmd_t *pmd; /* Pointer to pmd entry matching * the 'address' */ pud_t *pud; /* Pointer to pud entry matching @@ -387,6 +389,8 @@ struct vm_fault { * page table to avoid allocation from * atomic context. */ + unsigned long vma_flags; /* Speculative Page Fault field */ + pgprot_t vma_page_prot; /* Speculative Page Fault field */ }; /* page entry size for vm->huge_fault() */ diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 3f6ab003e4bf..f01ff9994bae 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -335,6 +335,9 @@ struct vm_area_struct { struct mempolicy *vm_policy; /* NUMA policy for the VMA */ #endif struct vm_userfaultfd_ctx vm_userfaultfd_ctx; + + seqcount_t vm_sequence; /* Speculative page fault field */ + atomic_t vm_ref_count; /* Speculative page fault field */ } __randomize_layout; struct core_thread { @@ -354,6 +357,8 @@ struct mm_struct { struct vm_area_struct *mmap; /* list of VMAs */ struct rb_root mm_rb; u64 vmacache_seqnum; /* per-thread vmacache */ + + rwlock_t mm_rb_lock; /* Speculative page fault field */ #ifdef CONFIG_MMU unsigned long (*get_unmapped_area) (struct file *filp, unsigned long addr, unsigned long len, diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h index 47a3441cf4c4..8958827baa49 100644 --- a/include/linux/vm_event_item.h +++ b/include/linux/vm_event_item.h @@ -110,6 +110,8 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, SWAP_RA, SWAP_RA_HIT, #endif + SPECULATIVE_PGFAULT_ANON, /* Speculative page fault field */ + SPECULATIVE_PGFAULT_FILE, /* Speculative page fault field */ NR_VM_EVENT_ITEMS }; diff --git a/mm/vmstat.c b/mm/vmstat.c index d3579a0b4d52..3ce0b102dc43 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1291,6 +1291,8 @@ const char * const vmstat_text[] = { "swap_ra", "swap_ra_hit", #endif + "speculative_pgfault_anon", + "speculative_pgfault_file", #endif /* CONFIG_VM_EVENTS_COUNTERS */ }; #endif /* CONFIG_PROC_FS || CONFIG_SYSFS || CONFIG_NUMA */