]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
4 years agoswapfile rcu fix maple_spf
Liam R. Howlett [Tue, 16 Mar 2021 20:00:31 +0000 (16:00 -0400)]
swapfile rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agooom_kill rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 20:00:23 +0000 (16:00 -0400)]
oom_kill rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomlock rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 20:00:14 +0000 (16:00 -0400)]
mlock rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomempolicy rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 20:00:06 +0000 (16:00 -0400)]
mempolicy rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomemory rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 19:59:57 +0000 (15:59 -0400)]
memory rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoksm rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 19:59:44 +0000 (15:59 -0400)]
ksm rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agokhugepaged rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 19:59:36 +0000 (15:59 -0400)]
khugepaged rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agosys rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 19:59:23 +0000 (15:59 -0400)]
sys rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agosched/fair rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 19:59:15 +0000 (15:59 -0400)]
sched/fair rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agofork rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 19:59:04 +0000 (15:59 -0400)]
fork rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agouprobes rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 19:58:54 +0000 (15:58 -0400)]
uprobes rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoevents/core rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 19:58:42 +0000 (15:58 -0400)]
events/core rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agokernel/acct rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 19:58:27 +0000 (15:58 -0400)]
kernel/acct rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agouserfaultfd rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 19:58:18 +0000 (15:58 -0400)]
userfaultfd rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotask_mmu rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 19:58:05 +0000 (15:58 -0400)]
task_mmu rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoproc base rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 19:57:55 +0000 (15:57 -0400)]
proc base rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agobinfmt_elf rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 19:57:44 +0000 (15:57 -0400)]
binfmt_elf rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agooptee rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 19:57:33 +0000 (15:57 -0400)]
optee rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agocxl rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 19:57:18 +0000 (15:57 -0400)]
cxl rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoxtensa rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 19:57:06 +0000 (15:57 -0400)]
xtensa rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agox86 vdso rcu lock fix
Liam R. Howlett [Tue, 16 Mar 2021 19:56:54 +0000 (15:56 -0400)]
x86 vdso rcu lock fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoum tlb rcu fix
Liam R. Howlett [Tue, 16 Mar 2021 19:56:41 +0000 (15:56 -0400)]
um tlb rcu fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agos390: gmap, fix rcu lock
Liam R. Howlett [Tue, 16 Mar 2021 19:56:31 +0000 (15:56 -0400)]
s390: gmap, fix rcu lock

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoppc book3s64: Fix subpage rcu lock
Liam R. Howlett [Tue, 16 Mar 2021 19:56:10 +0000 (15:56 -0400)]
ppc book3s64: Fix subpage rcu lock

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoppc book3s32: Fix tlb rcu lock
Liam R. Howlett [Tue, 16 Mar 2021 19:55:54 +0000 (15:55 -0400)]
ppc book3s32: Fix tlb rcu lock

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoparisc: Fix cache rcu lock
Liam R. Howlett [Tue, 16 Mar 2021 19:55:38 +0000 (15:55 -0400)]
parisc: Fix cache rcu lock

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fix remap_file_pages() locking to work with new do_mmap()
Liam R. Howlett [Tue, 16 Mar 2021 16:35:18 +0000 (12:35 -0400)]
mm/mmap: Fix remap_file_pages() locking to work with new do_mmap()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fix remap_file_pages() change.
Liam R. Howlett [Tue, 16 Mar 2021 16:34:59 +0000 (12:34 -0400)]
mm/mmap: Fix remap_file_pages() change.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Drop validations in do_mas_align_munmap()
Liam R. Howlett [Tue, 16 Mar 2021 16:34:30 +0000 (12:34 -0400)]
mm/mmap: Drop validations in do_mas_align_munmap()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm: Move mas locking outside of munmap() path.
Liam R. Howlett [Thu, 11 Mar 2021 20:25:33 +0000 (15:25 -0500)]
mm: Move mas locking outside of munmap() path.

Now that there is a split variant that allows splitting to use a maple state,
move the locks to a more logical position.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Rename b_node to bn in mab_calc_split()
Liam R. Howlett [Thu, 11 Mar 2021 20:22:47 +0000 (15:22 -0500)]
maple_tree: Rename b_node to bn in mab_calc_split()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Add mas_split_vma() and use it for munmap()
Liam R. Howlett [Tue, 9 Mar 2021 03:47:27 +0000 (22:47 -0500)]
mm/mmap: Add mas_split_vma() and use it for munmap()

Use the maple state when splitting a node to not have to rewalk/reset the state on splits.
This is also needed to clean the locks up

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Fix spanning_rebalance() insufficient nodes and mas state.
Liam R. Howlett [Tue, 9 Mar 2021 03:46:05 +0000 (22:46 -0500)]
maple_tree: Fix spanning_rebalance() insufficient nodes and mas state.

Fix mas state when expanding a root, the offset on rebalance, and the node and offset
when doing a spanning store.

Note that spanning rebalance needed to do some tricky free/no free based on
where the node data comes from.  Next would skip the free of the next node
as it is picked up when mas_topiary() trims the parents children

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Fix offset in mas_node_stre, find old node in mas_store_gfp.
Liam R. Howlett [Fri, 5 Mar 2021 16:16:04 +0000 (11:16 -0500)]
maple_tree: Fix offset in mas_node_stre, find old node in mas_store_gfp.

Needs fixing, should restore the maple state during the operation by saving the leaf info

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Prepare detaching of VMAs for new split
Liam R. Howlett [Fri, 5 Mar 2021 16:11:31 +0000 (11:11 -0500)]
mm/mmap: Prepare detaching of VMAs for new split

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Fix maple state offset on root expansion
Liam R. Howlett [Fri, 5 Mar 2021 16:10:35 +0000 (11:10 -0500)]
maple_tree: Fix maple state offset on root expansion

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Optimize mmap_region() use of maple states
Liam R. Howlett [Tue, 2 Mar 2021 15:15:35 +0000 (10:15 -0500)]
mm/mmap: Optimize mmap_region() use of maple states

Only walk down once after the tree was modified with the munmap call.  Copy mas
to find prev and next.  Only reset mas if the address changed.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoFix ipc/shm for nommu.
Liam R. Howlett [Mon, 1 Mar 2021 21:01:05 +0000 (16:01 -0500)]
Fix ipc/shm for nommu.

Define mas for nommu and mmu builds

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Fix mas_find for a single entry, add test
Liam R. Howlett [Mon, 1 Mar 2021 19:36:59 +0000 (14:36 -0500)]
maple_tree: Fix mas_find for a single entry, add test

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agolib/test_maple_tree: Rename zero() to not_empty(), use mas_set(), add more allocation...
Liam R. Howlett [Mon, 1 Mar 2021 19:36:18 +0000 (14:36 -0500)]
lib/test_maple_tree: Rename zero() to not_empty(), use mas_set(), add more allocation tests

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agolib/maple_tree: Clean up node allocations
Liam R. Howlett [Mon, 1 Mar 2021 19:34:11 +0000 (14:34 -0500)]
lib/maple_tree: Clean up node allocations

Remove extra parenthesis, etc

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mempolicy: Use vma_lookup() instead of find_vma_intersection()
Liam R. Howlett [Mon, 1 Mar 2021 19:30:58 +0000 (14:30 -0500)]
mm/mempolicy: Use vma_lookup() instead of find_vma_intersection()

vma_lookup() is more efficient

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/memory.c: Use vma_lookup() instead of find_vma_intersection()
Liam R. Howlett [Mon, 1 Mar 2021 19:30:38 +0000 (14:30 -0500)]
mm/memory.c: Use vma_lookup() instead of find_vma_intersection()

vma_lookup() is more efficient

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoarch/powerpc/oprofile/cell/spu_task_sync: Use vma_lookup() instead of find_vma_inters...
Liam R. Howlett [Mon, 1 Mar 2021 19:30:00 +0000 (14:30 -0500)]
arch/powerpc/oprofile/cell/spu_task_sync: Use vma_lookup() instead of find_vma_intersection()

vma_lookup() is more efficient

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoarch/powerpc/kvm/book3s_hv_uvmem: Use vma_lookup() instead of find_vma_intersection()
Liam R. Howlett [Mon, 1 Mar 2021 19:29:29 +0000 (14:29 -0500)]
arch/powerpc/kvm/book3s_hv_uvmem: Use vma_lookup() instead of find_vma_intersection()

vma_lookup() is more efficient

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoarch/mips/kernel/traps: Use vma_lookup() instead of find_vma_intersection()
Liam R. Howlett [Mon, 1 Mar 2021 19:29:09 +0000 (14:29 -0500)]
arch/mips/kernel/traps: Use vma_lookup() instead of find_vma_intersection()

vma_lookup() is more efficient

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoarch/arm64/kvm: Use vma_lookup() instead of find_vma_intersection()
Liam R. Howlett [Mon, 1 Mar 2021 19:28:44 +0000 (14:28 -0500)]
arch/arm64/kvm: Use vma_lookup() instead of find_vma_intersection()

vma_lookup() is more efficient

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agodrivers/oprofile: Use vma_lookup() instead of find_vma_intersection()
Liam R. Howlett [Mon, 1 Mar 2021 19:28:00 +0000 (14:28 -0500)]
drivers/oprofile: Use vma_lookup() instead of find_vma_intersection()

vma_lookup() is more efficient

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agovfio: Use vma_lookup() instead of find_vma_intersection()
Liam R. Howlett [Mon, 1 Mar 2021 19:27:28 +0000 (14:27 -0500)]
vfio: Use vma_lookup() instead of find_vma_intersection()

vma_lookup() is more efficient

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agovirt/kvm: Use vma_lookup() instead of find_vma_intersection()
Liam R. Howlett [Mon, 1 Mar 2021 19:26:37 +0000 (14:26 -0500)]
virt/kvm: Use vma_lookup() instead of find_vma_intersection()

vma_lookup() is more efficient

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoarch/arc/kernel/troubleshoot: use vma_lookup() instead of find_vma_intersection()
Liam R. Howlett [Mon, 1 Mar 2021 19:25:27 +0000 (14:25 -0500)]
arch/arc/kernel/troubleshoot: use vma_lookup() instead of find_vma_intersection()

vma_lookup() is more efficient

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/framge_vector: Use vma_lookup() instead of find_vma_intersection()
Liam R. Howlett [Mon, 1 Mar 2021 19:24:29 +0000 (14:24 -0500)]
mm/framge_vector: Use vma_lookup() instead of find_vma_intersection()

vma_lookup() is more efficient

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fix mmap_region() maple state
Liam R. Howlett [Mon, 1 Mar 2021 19:23:26 +0000 (14:23 -0500)]
mm/mmap: Fix mmap_region() maple state

When finding next, tmp must be reset to mas to ensure the correct slot is
used for writing

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fix whitespace in expand_upwards()
Liam R. Howlett [Mon, 1 Mar 2021 19:22:39 +0000 (14:22 -0500)]
mm/mmap: Fix whitespace in expand_upwards()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm: Add vma_lookup()
Liam R. Howlett [Mon, 1 Mar 2021 19:01:06 +0000 (14:01 -0500)]
mm: Add vma_lookup()

Walk the maple tree to find the requested address.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoi915_vma: Rename vma_lookup to i915_vma_lookup
Liam R. Howlett [Mon, 1 Mar 2021 18:59:43 +0000 (13:59 -0500)]
i915_vma: Rename vma_lookup to i915_vma_lookup

Use i915 prefix to avoid name collision with future vma_lookup() in mm.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Add 32 bit support
Liam R. Howlett [Wed, 24 Feb 2021 20:30:13 +0000 (15:30 -0500)]
maple_tree: Add 32 bit support

Add the defines for the size of nodes, etc to support 32 bit kernels.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agonommu: remove cache
Liam R. Howlett [Tue, 23 Feb 2021 16:35:27 +0000 (11:35 -0500)]
nommu: remove cache

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/nommu and fs/proc/task_nommu: convert to maple tree
Liam R. Howlett [Tue, 23 Feb 2021 16:24:23 +0000 (11:24 -0500)]
mm/nommu and fs/proc/task_nommu: convert to maple tree

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agonommu: linked list fix
Liam R. Howlett [Tue, 23 Feb 2021 16:23:44 +0000 (11:23 -0500)]
nommu: linked list fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm: Restore rb_node to vm_region.
Liam R. Howlett [Tue, 23 Feb 2021 15:52:01 +0000 (10:52 -0500)]
mm: Restore rb_node to vm_region.

nommu uses the rb tree for overlapped shared regions

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm: Move mm_populate_vma to internal header.
Liam R. Howlett [Tue, 23 Feb 2021 15:51:13 +0000 (10:51 -0500)]
mm: Move mm_populate_vma to internal header.

mm_populate_vma is only internal to mm code

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm: Move vma_mas_store()/vma_mas_erase() to internal header.
Liam R. Howlett [Tue, 23 Feb 2021 15:49:13 +0000 (10:49 -0500)]
mm: Move vma_mas_store()/vma_mas_erase() to internal header.

These are used in nommu case as well

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: add mtree_store() to header
Liam R. Howlett [Mon, 22 Feb 2021 01:05:26 +0000 (20:05 -0500)]
maple_tree: add mtree_store() to header

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Add static where necessary.
Liam R. Howlett [Mon, 22 Feb 2021 01:04:48 +0000 (20:04 -0500)]
maple_tree: Add static where necessary.

Add static to anywhere sparse reports necessary.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Change do_mas_align_munmap() to static
Liam R. Howlett [Mon, 22 Feb 2021 00:55:52 +0000 (19:55 -0500)]
mm/mmap: Change do_mas_align_munmap() to static

Add static to the declaration as reported by sparse

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agolib/maple_tree: Fix rcu annotations
Matthew Wilcox (Oracle) [Sun, 21 Feb 2021 04:46:45 +0000 (23:46 -0500)]
lib/maple_tree: Fix rcu annotations

Add all the missing __rcu annotations reported by sparse.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
4 years agomm/mmap: Lock maple tree when using mas_store_gfp()
Liam R. Howlett [Sat, 20 Feb 2021 17:56:07 +0000 (12:56 -0500)]
mm/mmap: Lock maple tree when using mas_store_gfp()

When storing to the maple tree, take the write lock to avoid
entering/exiting the use of RCU during a write operation.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agolib/maple_tree: Fix mas_pop_node() zeroing.
Liam R. Howlett [Sat, 20 Feb 2021 17:52:56 +0000 (12:52 -0500)]
lib/maple_tree: Fix mas_pop_node() zeroing.

When using a single allocation in the node, zero out slot 0 of the node
being returned.

Also, small whitespace fix in mas_push

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/ksm: Fix compile warning and whitespace for 3fd77bfa4f25fa
Liam R. Howlett [Thu, 18 Feb 2021 14:51:08 +0000 (09:51 -0500)]
mm/ksm: Fix compile warning and whitespace for 3fd77bfa4f25fa

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agolib/maple_tree: Fix mas_store_gfp() on spanning store.
Liam R. Howlett [Thu, 18 Feb 2021 14:27:48 +0000 (09:27 -0500)]
lib/maple_tree: Fix mas_store_gfp() on spanning store.

Spanning store detection needs to be more robust than checking if it spans the end of
a node.  Fix the detection by using mas_is_span_wr().  Also ensure it's not MAS_NONE.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agolib/maple_tree: Add check for dead nodes in mt_validate()
Liam R. Howlett [Thu, 18 Feb 2021 14:26:45 +0000 (09:26 -0500)]
lib/maple_tree: Add check for dead nodes in mt_validate()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: __insert_vm_struct() only needs to mas_reset()
Liam R. Howlett [Thu, 18 Feb 2021 14:26:07 +0000 (09:26 -0500)]
mm/mmap: __insert_vm_struct() only needs to mas_reset()

vma_mas_store() will set the range again.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mprotect: Use vma_next() of prev.
Liam R. Howlett [Thu, 18 Feb 2021 14:24:49 +0000 (09:24 -0500)]
mm/mprotect: Use vma_next() of prev.

The linked list used to use prev->next.  the maple state may be invalidated
by the mprotect_fixup call which may alter the tree.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mprotect: Use vma_next() instead of mas_next().
Liam R. Howlett [Wed, 17 Feb 2021 22:15:37 +0000 (17:15 -0500)]
mm/mprotect: Use vma_next() instead of mas_next().

mas is in the wrong state and would potentially return the current vma twice.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fix mmap_region() maple tree store.
Liam R. Howlett [Wed, 17 Feb 2021 22:03:35 +0000 (17:03 -0500)]
mm/mmap: Fix mmap_region() maple tree store.

mas_set_range() before vma_mas_link() as the address may have changed
as commented above in the code.

Do the same in the error path.

This forces a reset of the mas->node to MA_START.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: ULONG_MAX in exit_mmap
Liam R. Howlett [Wed, 17 Feb 2021 14:19:55 +0000 (09:19 -0500)]
mm/mmap: ULONG_MAX in exit_mmap

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: ULONG_MAX in do_brk_munmap
Liam R. Howlett [Wed, 17 Feb 2021 14:19:38 +0000 (09:19 -0500)]
mm/mmap: ULONG_MAX in do_brk_munmap

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: ULONG_MAX in detach_range
Liam R. Howlett [Wed, 17 Feb 2021 14:19:25 +0000 (09:19 -0500)]
mm/mmap: ULONG_MAX in detach_range

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: ULONG_MAX in remove_mt
Liam R. Howlett [Wed, 17 Feb 2021 14:19:08 +0000 (09:19 -0500)]
mm/mmap: ULONG_MAX in remove_mt

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mprotect: Change do_mprotect_pkey() -1 to ULONG_MAX
Liam R. Howlett [Wed, 17 Feb 2021 14:17:40 +0000 (09:17 -0500)]
mm/mprotect: Change do_mprotect_pkey()  -1 to ULONG_MAX

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomempolicy: Fix mbind_range -1 to ULONG_MAX
Liam R. Howlett [Wed, 17 Feb 2021 14:16:52 +0000 (09:16 -0500)]
mempolicy: Fix mbind_range -1 to ULONG_MAX

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agokernel/sched/fair: Change -1 to ULONG_MAX
Liam R. Howlett [Wed, 17 Feb 2021 14:16:24 +0000 (09:16 -0500)]
kernel/sched/fair: Change -1 to ULONG_MAX

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agokernel/acct: Change -1 to ULONG_MAX
Liam R. Howlett [Wed, 17 Feb 2021 14:16:07 +0000 (09:16 -0500)]
kernel/acct: Change -1 to ULONG_MAX

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotask_mmu: Change -1 to ULONG_MAX
Liam R. Howlett [Wed, 17 Feb 2021 14:15:53 +0000 (09:15 -0500)]
task_mmu: Change -1 to ULONG_MAX

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoppc book3s32: Change -1 to ULONG_MAX
Liam R. Howlett [Wed, 17 Feb 2021 14:15:37 +0000 (09:15 -0500)]
ppc book3s32: Change -1 to ULONG_MAX

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agolib/maple_tree: Reset request_count to 0 of old head on push
Liam R. Howlett [Tue, 16 Feb 2021 18:33:24 +0000 (13:33 -0500)]
lib/maple_tree: Reset request_count to 0 of old head on push

Just to be safe

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Add validate_mm() to __vma_adjust() start
Liam R. Howlett [Tue, 16 Feb 2021 15:49:09 +0000 (10:49 -0500)]
mm/mmap: Add validate_mm() to __vma_adjust() start

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mprotect: Fix adcfbd7698558a linked list removal
Liam R. Howlett [Wed, 10 Feb 2021 14:33:59 +0000 (09:33 -0500)]
mm/mprotect: Fix adcfbd7698558a linked list removal

Use mas_find() in do_mprotect_pkey to find the next vma to better align
with what happened with the old API

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agokernel/sched/fair: Fix linked list fallout 4acb2b9560cd8f
Liam R. Howlett [Wed, 10 Feb 2021 14:30:51 +0000 (09:30 -0500)]
kernel/sched/fair: Fix linked list fallout 4acb2b9560cd8f

When searching for the vma, use mas_find, not mas_walk() to better do what was happening before

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mempolicy: fix adcfbd7698558a
Liam R. Howlett [Tue, 9 Feb 2021 19:37:24 +0000 (14:37 -0500)]
mm/mempolicy: fix adcfbd7698558a

When removing the linked list, a bug was introduced in maple state
iterator used for the mbind_range() function.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: do_brk_munmap() whitespace fix
Liam R. Howlett [Tue, 9 Feb 2021 14:45:09 +0000 (09:45 -0500)]
mm/mmap: do_brk_munmap() whitespace fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: use ma_is_root() in mas_replace().
Liam R. Howlett [Tue, 9 Feb 2021 00:34:00 +0000 (19:34 -0500)]
maple_tree: use ma_is_root() in mas_replace().

Instead of using mte_is_root(), use ma_is_root() directly since the maple node
is known already.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Find next vma in do_brk_munmap() prior to updating tree.
Liam R. Howlett [Tue, 9 Feb 2021 00:33:02 +0000 (19:33 -0500)]
mm/mmap: Find next vma in do_brk_munmap() prior to updating tree.

The tree update may invalidate the location and cause a longer search if the VMA does not
preceed a NULL entry

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fix do_brk_munmap() when munmapping an entire VMA or more
Liam R. Howlett [Tue, 9 Feb 2021 00:31:53 +0000 (19:31 -0500)]
mm/mmap: Fix do_brk_munmap() when munmapping an entire VMA or more

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Add more validate_mm() calls
Liam R. Howlett [Tue, 9 Feb 2021 00:24:58 +0000 (19:24 -0500)]
mm/mmap: Add more validate_mm() calls

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm: Return a bool from anon_vma_interval_tree_verify()
Liam R. Howlett [Sun, 7 Feb 2021 00:47:59 +0000 (19:47 -0500)]
mm: Return a bool from anon_vma_interval_tree_verify()

Added to allow printing which vma has the issue

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: expand_upwards() shouldn't call validate_mm()
Liam R. Howlett [Sun, 7 Feb 2021 00:47:17 +0000 (19:47 -0500)]
mm/mmap: expand_upwards() shouldn't call validate_mm()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: mmap_region() fixes for when expanding vma as well as anon
Liam R. Howlett [Sun, 7 Feb 2021 00:46:38 +0000 (19:46 -0500)]
mm/mmap: mmap_region() fixes for when expanding vma as well as anon

When expanding a vma, call khugepaged_enter_vma_merge() with correct vma.

Also, set the vm_pgoff to the correct value when adding an anon mapping.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fix detach_range() and do_mas_align_munmap()
Liam R. Howlett [Sun, 7 Feb 2021 00:44:50 +0000 (19:44 -0500)]
mm/mmap: Fix detach_range() and do_mas_align_munmap()

When searching for the first entry overlapp in do_mas_align_munmap(), the mas->last
will be modified if one is found, and if the maple state isn't reset for splitting,
then the wrong end will be past to detach_range() in the maple state.

detach_range() no longer needs both vma and vm_area_struct last, so make that change
too.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>