]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
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>
4 years agomm/mmap: vma_expand() Cleanup code a bit
Liam R. Howlett [Sun, 7 Feb 2021 00:41:29 +0000 (19:41 -0500)]
mm/mmap: vma_expand() Cleanup code a bit

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fix linked list damage from e40a951e09ed0e
Liam R. Howlett [Thu, 4 Feb 2021 19:23:45 +0000 (14:23 -0500)]
mm/mmap: Fix linked list damage from e40a951e09ed0e

Drop unnecessary while() after mas_for_each()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agofs/proc/task_mmu: Fix linked list damage from c4e6b1dfcb6f99
Liam R. Howlett [Thu, 4 Feb 2021 19:20:09 +0000 (14:20 -0500)]
fs/proc/task_mmu: Fix linked list damage from c4e6b1dfcb6f99

Fix reset of mas and initialize vma_start.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/ksm: Fix error introduced in 3fd77bfa4f25fa
Liam R. Howlett [Thu, 4 Feb 2021 19:06:58 +0000 (14:06 -0500)]
mm/ksm: Fix error introduced in 3fd77bfa4f25fa

mm may be uninitialized during the first loop.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Set next to NULL in mmap_region()
Liam R. Howlett [Thu, 4 Feb 2021 18:59:30 +0000 (13:59 -0500)]
mm/mmap: Set next to NULL in mmap_region()

When following cannot_expand goto, next would not be set

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Remove validate from expand() as the lock isn't held.
Liam R. Howlett [Thu, 4 Feb 2021 01:15:18 +0000 (20:15 -0500)]
mm/mmap: Remove validate from expand() as the lock isn't held.

Add validate_mm() to many other locations.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Don't reset ma_neighbour in brk() as it won't be used
Liam R. Howlett [Thu, 4 Feb 2021 01:13:38 +0000 (20:13 -0500)]
mm/mmap: Don't reset ma_neighbour in brk() as it won't be used

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fix alignment mess of gap searching
Liam R. Howlett [Thu, 4 Feb 2021 01:07:37 +0000 (20:07 -0500)]
mm/mmap: Fix alignment mess of gap searching

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Assert lock is held before running validate_mm()
Liam R. Howlett [Thu, 4 Feb 2021 01:06:44 +0000 (20:06 -0500)]
mm/mmap: Assert lock is held before running validate_mm()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Drop unused ma_lock from remap_file_pages
Liam R. Howlett [Wed, 3 Feb 2021 15:41:25 +0000 (10:41 -0500)]
mm/mmap: Drop unused ma_lock from remap_file_pages

The variable is not used.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fix error path not checking anon_vma for null
Liam R. Howlett [Wed, 3 Feb 2021 15:28:44 +0000 (10:28 -0500)]
mm/mmap: Fix error path not checking anon_vma for null

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Rework mas_replace()
Liam R. Howlett [Wed, 3 Feb 2021 14:35:43 +0000 (09:35 -0500)]
maple_tree: Rework mas_replace()

Drop ma_set_slot() and mte_set_slot() in favour of just setting the slot
value in the parent.  This is the only function using those two
functions and they are not necessary.

Drop check for replacing the node with itself as that doesn't happen -
confirmed by running the test suite with a BUG_ON instead of the swap.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mempolicy: Fix mas_for_each() loop
Liam R. Howlett [Wed, 3 Feb 2021 01:21:11 +0000 (20:21 -0500)]
mm/mempolicy: Fix mas_for_each() loop

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agolib/maple_tree: Fix allocation walk iterators.
Liam R. Howlett [Tue, 2 Feb 2021 14:19:43 +0000 (09:19 -0500)]
lib/maple_tree: Fix allocation walk iterators.

Do not reset mas->node or mas->offset and advance the slot on
continuing.

This also drops mas_rev_awalk() and instead pulls it into
mas_empty_area_rev().

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fix exit_mmap() maple state.
Liam R. Howlett [Tue, 2 Feb 2021 14:17:16 +0000 (09:17 -0500)]
mm/mmap: Fix exit_mmap() maple state.

Do not reset the maple state prior to unmap_vmas().

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fux do_mas_align_munmap() search for vma.
Liam R. Howlett [Tue, 2 Feb 2021 14:16:20 +0000 (09:16 -0500)]
mm/mmap: Fux do_mas_align_munmap() search for vma.

Use find instead of walk to search for the VMA to ensure a VMA is found
if the start does not fall on a VMA

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Change gap calculations
Liam R. Howlett [Tue, 2 Feb 2021 14:14:41 +0000 (09:14 -0500)]
mm/mmap: Change gap calculations

When calculating the gaps, make sure the alignment is okay.

This needs further analysis.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/memory: Fix zap_page_range
Liam R. Howlett [Tue, 2 Feb 2021 14:12:34 +0000 (09:12 -0500)]
mm/memory: Fix zap_page_range

Use mas_for_each to avoid calling unmap_single_vma for the start VMA twice.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/memory: Whitespace fix
Liam R. Howlett [Tue, 2 Feb 2021 14:11:59 +0000 (09:11 -0500)]
mm/memory: Whitespace fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fix validate_mm() warning
Liam R. Howlett [Mon, 1 Feb 2021 19:25:38 +0000 (14:25 -0500)]
mm/mmap: Fix validate_mm() warning

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Remove rb and vma_link() comment on bug.
Liam R. Howlett [Mon, 1 Feb 2021 19:02:47 +0000 (14:02 -0500)]
mm/mmap: Remove rb and vma_link() comment on bug.

This bug does not exist for maple tree

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Use mtree_init() in mt_destroy_walk()
Liam R. Howlett [Mon, 1 Feb 2021 18:48:20 +0000 (13:48 -0500)]
mm/mmap: Use mtree_init() in mt_destroy_walk()

Don't use MTREE_INIT()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Use mtree_init() in do_mas_align_munmap()
Liam R. Howlett [Mon, 1 Feb 2021 18:47:49 +0000 (13:47 -0500)]
mm/mmap: Use mtree_init() in do_mas_align_munmap()

Don't use MTREE_INIT()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Convert __insert_vm_struct to use mas, convert vma_link to use vma_mas_link() howlett/maple_spf/20210129
Liam R. Howlett [Mon, 4 Jan 2021 18:55:29 +0000 (13:55 -0500)]
mm/mmap: Convert __insert_vm_struct to use mas, convert vma_link to use vma_mas_link()

Drop unused vma_store()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm: Remove vma linked list.
Liam R. Howlett [Mon, 4 Jan 2021 20:15:50 +0000 (15:15 -0500)]
mm: Remove vma linked list.

The vma linked list has been replaced by the maple tree iterators and
vma_next() vma_prev() functions.

A part of this change is also the iterators free_pgd_range(),
zap_page_range(), and unmap_single_vma()

The internal _vma_next() has been dropped.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/util: Remove __vma_link_list() and __vma_unlink_list()
Liam R. Howlett [Mon, 4 Jan 2021 20:10:54 +0000 (15:10 -0500)]
mm/util: Remove __vma_link_list() and __vma_unlink_list()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/nommu: Stop inserting into the vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 20:10:18 +0000 (15:10 -0500)]
mm/nommu: Stop inserting into the vma linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/swapfile: Use maple tree iterator instead of vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 20:07:11 +0000 (15:07 -0500)]
mm/swapfile: Use maple tree iterator instead of vma linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/pagewalk: Use vma_next() instead of vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 20:06:47 +0000 (15:06 -0500)]
mm/pagewalk: Use vma_next() instead of vma linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/oom_kill: Use maple tree iterators instead of vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 20:06:25 +0000 (15:06 -0500)]
mm/oom_kill: Use maple tree iterators instead of vma linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/nommu: Use maple tree iterators instead of vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 20:04:42 +0000 (15:04 -0500)]
mm/nommu: Use maple tree iterators instead of vma linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/msync: Use vma_next() instead of vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 20:04:14 +0000 (15:04 -0500)]
mm/msync: Use vma_next() instead of vma linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mremap: Use vma_next() instead of vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 20:03:49 +0000 (15:03 -0500)]
mm/mremap: Use vma_next() instead of vma linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mprotect: Use maple tree navigation instead of vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 20:02:28 +0000 (15:02 -0500)]
mm/mprotect: Use maple tree navigation instead of vma linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mlock: Use maple tree iterators instead of vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 20:00:14 +0000 (15:00 -0500)]
mm/mlock: Use maple tree iterators instead of vma linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mempolicy: Use maple tree iterators instead of vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:59:52 +0000 (14:59 -0500)]
mm/mempolicy: Use maple tree iterators instead of vma linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/memcontrol: Stop using mm->highest_vm_end
Liam R. Howlett [Mon, 4 Jan 2021 19:59:05 +0000 (14:59 -0500)]
mm/memcontrol: Stop using mm->highest_vm_end

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/madvise: Use vma_next instead of vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:58:35 +0000 (14:58 -0500)]
mm/madvise: Use vma_next instead of vma linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/ksm: Use maple tree iterators instead of vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:58:11 +0000 (14:58 -0500)]
mm/ksm: Use maple tree iterators instead of vma linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/khugepaged: Use maple tree iterators instead of vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:57:47 +0000 (14:57 -0500)]
mm/khugepaged: Use maple tree iterators instead of vma linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/huge_memory: Use vma_next() instead of vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:56:58 +0000 (14:56 -0500)]
mm/huge_memory: Use vma_next() instead of vma linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/gup: Use maple tree navigation instead of linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:56:20 +0000 (14:56 -0500)]
mm/gup: Use maple tree navigation instead of linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agokernel/sys: Use maple tree iterators instead of linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:54:49 +0000 (14:54 -0500)]
kernel/sys: Use maple tree iterators instead of linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agokernel/sched/fair: Use maple tree iterators instead of linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:54:07 +0000 (14:54 -0500)]
kernel/sched/fair: Use maple tree iterators instead of linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agokernel/events/uprobes: Use maple tree iterators instead of linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:53:01 +0000 (14:53 -0500)]
kernel/events/uprobes: Use maple tree iterators instead of linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agokernel/events/core: Use maple tree iterators instead of linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:52:39 +0000 (14:52 -0500)]
kernel/events/core: Use maple tree iterators instead of linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agokernel/acct: Use maple tree iterators instead of linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:52:15 +0000 (14:52 -0500)]
kernel/acct: Use maple tree iterators instead of linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoipc/shm: Stop using the vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:51:19 +0000 (14:51 -0500)]
ipc/shm: Stop using the vma linked list

When searching for a VMA, a maple state can be used instead of the linked list in
the mm_struct

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agofs/userfaultfd: Stop using vma linked list.
Liam R. Howlett [Mon, 4 Jan 2021 19:49:47 +0000 (14:49 -0500)]
fs/userfaultfd: Stop using vma linked list.

Don't use the mm_struct linked list or the vma->vm_next in prep for removal

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agofs/proc/task_mmu: Stop using linked list and highest_vm_end
Liam R. Howlett [Mon, 4 Jan 2021 19:47:48 +0000 (14:47 -0500)]
fs/proc/task_mmu: Stop using linked list and highest_vm_end

Remove references to mm_struct linked list and highest_vm_end for when they are removed

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agofs/proc/base: Use maple tree iterators in place of linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:46:23 +0000 (14:46 -0500)]
fs/proc/base: Use maple tree iterators in place of linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agofs/exec: Use vma_next() instead of linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:45:37 +0000 (14:45 -0500)]
fs/exec: Use vma_next() instead of linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agofs/coredump: Use maple tree iterators in place of linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:44:45 +0000 (14:44 -0500)]
fs/coredump: Use maple tree iterators in place of linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agofs/binfmt_elf: Use maple tree iterators for fill_files_note()
Liam R. Howlett [Mon, 4 Jan 2021 19:44:16 +0000 (14:44 -0500)]
fs/binfmt_elf: Use maple tree iterators for fill_files_note()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agodrivers/tee/optee: Use maple tree iterators for __check_mem_type()
Liam R. Howlett [Mon, 4 Jan 2021 19:43:36 +0000 (14:43 -0500)]
drivers/tee/optee: Use maple tree iterators for __check_mem_type()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agodrivers/oprofile: Lookup address in tree instead of linked list.
Liam R. Howlett [Mon, 4 Jan 2021 19:42:37 +0000 (14:42 -0500)]
drivers/oprofile: Lookup address in tree instead of linked list.

Use the vma interface to find the vma if one exists instead of the linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agodrivers/misc/cxl: Use maple tree iterators for cxl_prefault_vma()
Liam R. Howlett [Mon, 4 Jan 2021 19:31:50 +0000 (14:31 -0500)]
drivers/misc/cxl: Use maple tree iterators for cxl_prefault_vma()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoarch/xtensa: Use maple tree iterators for unmapped area
Liam R. Howlett [Mon, 4 Jan 2021 19:30:59 +0000 (14:30 -0500)]
arch/xtensa: Use maple tree iterators for unmapped area

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoarch/x86: Use maple tree iterators for vdso/vma
Liam R. Howlett [Mon, 4 Jan 2021 19:30:25 +0000 (14:30 -0500)]
arch/x86: Use maple tree iterators for vdso/vma

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoarch/um: Use maple tree iterators instead of linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:29:56 +0000 (14:29 -0500)]
arch/um: Use maple tree iterators instead of linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoarch/s390: Use maple tree iterators instead of linked list.
Liam R. Howlett [Mon, 4 Jan 2021 19:29:19 +0000 (14:29 -0500)]
arch/s390: Use maple tree iterators instead of linked list.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoarch/powerpc: Optimize cell spu task sync.
Liam R. Howlett [Mon, 4 Jan 2021 19:28:48 +0000 (14:28 -0500)]
arch/powerpc: Optimize cell spu task sync.

Use the vma api to look up the spu reference instead of walking the linked list.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoarch/powerpc: Remove mmap linked list from mm/book2s32/subpage_prot
Liam R. Howlett [Mon, 4 Jan 2021 19:26:34 +0000 (14:26 -0500)]
arch/powerpc: Remove mmap linked list from mm/book2s32/subpage_prot

Start using the maple tree

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoarch/powerpc: Remove mmap linked list from mm/book2s32/tlb
Liam R. Howlett [Mon, 4 Jan 2021 19:25:54 +0000 (14:25 -0500)]
arch/powerpc: Remove mmap linked list from mm/book2s32/tlb

Start using the maple tree

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoarch/parsic: Remove mmap linked list from kernel/cache
Liam R. Howlett [Mon, 4 Jan 2021 19:25:19 +0000 (14:25 -0500)]
arch/parsic: Remove mmap linked list from kernel/cache

Start using the maple tree

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agoarch/arm64: Remove mmap linked list from vdso.
Liam R. Howlett [Mon, 4 Jan 2021 19:24:40 +0000 (14:24 -0500)]
arch/arm64: Remove mmap linked list from vdso.

Start using the maple tree

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm: Introduce vma_next() and vma_prev()
Liam R. Howlett [Mon, 4 Jan 2021 20:13:14 +0000 (15:13 -0500)]
mm: Introduce vma_next() and vma_prev()

Rename internam vma_next() to _vma_next().

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agommap: make remove_vma_list() inline
Liam R. Howlett [Wed, 25 Nov 2020 01:24:10 +0000 (20:24 -0500)]
mmap: make remove_vma_list() inline

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Change do_brk_munmap() to use do_mas_align_munmap()
Liam R. Howlett [Tue, 1 Dec 2020 02:30:04 +0000 (21:30 -0500)]
mm/mmap: Change do_brk_munmap() to use do_mas_align_munmap()

do_brk_munmap() already has aligned addresses.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agommap: Remove __do_munmap() in favour of do_mas_munmap()
Liam R. Howlett [Tue, 24 Nov 2020 21:27:58 +0000 (16:27 -0500)]
mmap: Remove __do_munmap() in favour of do_mas_munmap()

Export new interface and use it in place of old interface.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agommap: Use find_vma_intersection in do_mmap() for overlap
Liam R. Howlett [Tue, 24 Nov 2020 21:23:38 +0000 (16:23 -0500)]
mmap: Use find_vma_intersection in do_mmap() for overlap

When detecting a conflict with MAP_FIXED_NOREPLACE, using the new interface avoids
the need for a temp variable

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Add do_mas_munmap() and wraper for __do_munmap()
Liam R. Howlett [Tue, 24 Nov 2020 19:50:43 +0000 (14:50 -0500)]
mm/mmap: Add do_mas_munmap() and wraper for __do_munmap()

To avoid extra tree work, it is necessary to support passing in a maple state
to key functions.  Start this work with __do_munmap().

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Move mmap_region() below do_munmap()
Liam R. Howlett [Wed, 27 Jan 2021 15:25:13 +0000 (10:25 -0500)]
mm/mmap: Move mmap_region() below do_munmap()

Relocation of code for the next commit.  There should be no changes
here.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Change __do_munmap() to avoid unnecessary lookups.
Liam R. Howlett [Thu, 19 Nov 2020 17:57:23 +0000 (12:57 -0500)]
mm/mmap: Change __do_munmap() to avoid unnecessary lookups.

As there is no longer a vmacache, find_vma() is more expensive and so
avoid doing them

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm: Remove vmacache
Liam R. Howlett [Mon, 16 Nov 2020 19:50:20 +0000 (14:50 -0500)]
mm: Remove vmacache

The maple tree is able to find a VMA quick enough to no longer need the
vma cache.  Remove the vmacache to reduce work in keeping it up to date
and code complexity.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Drop munmap_vma_range()
Liam R. Howlett [Wed, 11 Nov 2020 18:32:57 +0000 (13:32 -0500)]
mm/mmap: Drop munmap_vma_range()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Change mmap_region to use maple tree state
Liam R. Howlett [Tue, 10 Nov 2020 18:37:40 +0000 (13:37 -0500)]
mm/mmap: Change mmap_region to use maple tree state

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm: Change find_vma_intersection to maple tree and make find_vma to
Liam R. Howlett [Mon, 28 Sep 2020 19:50:19 +0000 (15:50 -0400)]
mm: Change find_vma_intersection to maple tree and make find_vma to
inline.

Move find_vma_intersection() to mmap.c and change implementation to
maple tree.

When searching for a vma within a range, it is easier to use the maple
tree interface.  This means the find_vma() call changes to a special
case of the find_vma_intersection().  Exported for kvm module.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Change vm_brk_flags() to use mm_populate_vma()
Liam R. Howlett [Fri, 9 Oct 2020 19:57:40 +0000 (15:57 -0400)]
mm/mmap: Change vm_brk_flags() to use mm_populate_vma()

Skip searching for the vma to populate after creating it by passing in a pointer.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Change do_brk_flags() to expand existing VMA and add
Liam R. Howlett [Mon, 21 Sep 2020 14:47:34 +0000 (10:47 -0400)]
mm/mmap: Change do_brk_flags() to expand existing VMA and add
do_brk_munmap()

Avoid allocating a new VMA when it is not necessary.  Expand or contract
the existing VMA instead.  This avoids unnecessary tree manipulations
and allocations.

Once the VMA is known, use it directly when populating to avoid
unnecessary lookup work.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/gup: Add mm_populate_vma() for use when the vma is known
Liam R. Howlett [Wed, 2 Dec 2020 18:15:58 +0000 (13:15 -0500)]
mm/gup: Add mm_populate_vma() for use when the vma is known

When a vma is known, avoid calling mm_populate to search for the vma to
populate.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm: Remove rb tree.
Liam R. Howlett [Fri, 24 Jul 2020 19:06:25 +0000 (15:06 -0400)]
mm: Remove rb tree.

Remove the RB tree and start using the maple tree for vm_area_struct
tracking.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agokernel/fork: Convert dup_mmap to use maple tree
Liam R. Howlett [Fri, 24 Jul 2020 17:32:30 +0000 (13:32 -0400)]
kernel/fork: Convert dup_mmap to use maple tree

Use the maple tree iterator to duplicate the mm_struct trees.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Change unmapped_area and unmapped_area_topdown to use maple
Liam R. Howlett [Fri, 24 Jul 2020 16:01:47 +0000 (12:01 -0400)]
mm/mmap: Change unmapped_area and unmapped_area_topdown to use maple
tree

Use the new maple tree data structure to find an unmapped area.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Change find_vma_prev() to use maple tree
Liam R. Howlett [Fri, 24 Jul 2020 15:48:08 +0000 (11:48 -0400)]
mm/mmap: Change find_vma_prev() to use maple tree

Change the implementation of find_vma_prev to use the new maple tree
data structure.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Change find_vma() to use the maple tree
Liam R. Howlett [Fri, 24 Jul 2020 15:38:39 +0000 (11:38 -0400)]
mm/mmap: Change find_vma() to use the maple tree

Start using the maple tree to find VMA entries in an mm_struct.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Introduce unlock_range() for code cleanup
Liam R. Howlett [Mon, 21 Sep 2020 19:37:14 +0000 (15:37 -0400)]
mm/mmap: Introduce unlock_range() for code cleanup

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