]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
3 years agomaple_tree: comments. maple_v5.17-rc4
Liam R. Howlett [Fri, 11 Mar 2022 15:04:08 +0000 (10:04 -0500)]
maple_tree: comments.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple_tree: Fix spanning store detection on ULONG_MAX
Liam R. Howlett [Thu, 10 Mar 2022 15:26:23 +0000 (10:26 -0500)]
maple_tree: Fix spanning store detection on ULONG_MAX

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agokernel/fork: Remove prev from dup_mmap()
Liam R. Howlett [Tue, 8 Mar 2022 18:26:18 +0000 (13:26 -0500)]
kernel/fork: Remove prev from dup_mmap()

no longer needed due to linked list removal

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomm/mmap: Fix unmapped_area_topdown() and expand_downwards()
Liam R. Howlett [Tue, 8 Mar 2022 18:25:02 +0000 (13:25 -0500)]
mm/mmap: Fix unmapped_area_topdown() and expand_downwards()

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agofs/coredump: Fux coredump_next_vma when there is no gate_vma on first call
Liam R. Howlett [Tue, 8 Mar 2022 18:24:21 +0000 (13:24 -0500)]
fs/coredump: Fux coredump_next_vma when there is no gate_vma on first call

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomm/mempolicy: Fix for bug from Hugh
Liam R. Howlett [Tue, 8 Mar 2022 15:42:57 +0000 (10:42 -0500)]
mm/mempolicy: Fix for bug from Hugh

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agotest_maple_tree: Add fuzz testcase 9
Liam R. Howlett [Tue, 8 Mar 2022 14:46:14 +0000 (09:46 -0500)]
test_maple_tree: Add fuzz testcase 9

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple_tree: Fix potential metadata off by one in mas_mab_cp() on final node
Liam R. Howlett [Tue, 8 Mar 2022 14:45:49 +0000 (09:45 -0500)]
maple_tree: Fix potential metadata off by one in mas_mab_cp() on final node

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple_tree: Reduce ma_gap() protection on type
Liam R. Howlett [Fri, 4 Mar 2022 16:45:00 +0000 (11:45 -0500)]
maple_tree: Reduce ma_gap() protection on type

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agotest_maple_tree: Add fuzz 8 test
Liam R. Howlett [Fri, 4 Mar 2022 02:15:09 +0000 (21:15 -0500)]
test_maple_tree: Add fuzz 8 test

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple_tree: Fix left max on rebalance
Liam R. Howlett [Fri, 4 Mar 2022 02:14:54 +0000 (21:14 -0500)]
maple_tree: Fix left max on rebalance

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agotest_maple_tree: Fix mas_reuse_node() zeroing again.
Liam R. Howlett [Thu, 3 Mar 2022 16:51:42 +0000 (11:51 -0500)]
test_maple_tree: Fix mas_reuse_node() zeroing again.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple_tree: Fix mas_reuse_node() zeroing again.
Liam R. Howlett [Thu, 3 Mar 2022 16:50:23 +0000 (11:50 -0500)]
maple_tree: Fix mas_reuse_node() zeroing again.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agotest_maple_tree: Test implied pivot as zero and clear accordingly
Liam R. Howlett [Thu, 3 Mar 2022 15:47:45 +0000 (10:47 -0500)]
test_maple_tree: Test implied pivot as zero and clear accordingly

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agoFix clearing of implied pivot at end of node in node reuse
Liam R. Howlett [Thu, 3 Mar 2022 15:47:07 +0000 (10:47 -0500)]
Fix clearing of implied pivot at end of node in node reuse

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agotest_maple_tree: Add fuzzer test 5
Liam R. Howlett [Thu, 3 Mar 2022 03:37:54 +0000 (22:37 -0500)]
test_maple_tree: Add fuzzer test 5

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple_tree: Fix extend_null overflow
Liam R. Howlett [Thu, 3 Mar 2022 03:36:59 +0000 (22:36 -0500)]
maple_tree: Fix extend_null overflow

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agotest_maple_tree: Add test 4 for spanning store faiure.
Liam R. Howlett [Thu, 3 Mar 2022 03:23:17 +0000 (22:23 -0500)]
test_maple_tree: Add test 4 for spanning store faiure.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple_tree: Fix spannint store mast->r->max
Liam R. Howlett [Thu, 3 Mar 2022 03:22:37 +0000 (22:22 -0500)]
maple_tree: Fix spannint store mast->r->max

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agotest_maple_tree: Add check for node overflow from fuzzer
Liam R. Howlett [Wed, 2 Mar 2022 18:54:22 +0000 (13:54 -0500)]
test_maple_tree: Add check for node overflow from fuzzer

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple_tree: Fix node_size check for slow path goto in mas_wr_modify()
Liam R. Howlett [Wed, 2 Mar 2022 18:51:22 +0000 (13:51 -0500)]
maple_tree: Fix node_size check for slow path goto in mas_wr_modify()

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agotest_maple_tree: Add fuzzer test 2
Liam R. Howlett [Wed, 2 Mar 2022 16:23:58 +0000 (11:23 -0500)]
test_maple_tree: Add fuzzer test 2

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple_tree: Fix spanning store on two node rebalance
Liam R. Howlett [Wed, 2 Mar 2022 16:23:34 +0000 (11:23 -0500)]
maple_tree: Fix spanning store on two node rebalance

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agotest_maple_tree: Add fuzzer test 1
Liam R. Howlett [Wed, 2 Mar 2022 02:35:52 +0000 (21:35 -0500)]
test_maple_tree: Add fuzzer test 1

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple_tree: Fix spanning store to a single root node
Liam R. Howlett [Wed, 2 Mar 2022 02:35:31 +0000 (21:35 -0500)]
maple_tree: Fix spanning store to a single root node

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomunmap
Liam R. Howlett [Tue, 1 Mar 2022 20:17:48 +0000 (15:17 -0500)]
munmap

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agoAdd comment for mt
Liam R. Howlett [Tue, 1 Mar 2022 20:17:10 +0000 (15:17 -0500)]
Add comment for mt

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomas_align fix
Liam R. Howlett [Tue, 1 Mar 2022 18:05:48 +0000 (13:05 -0500)]
mas_align fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agovma_adjust fix
Liam R. Howlett [Tue, 1 Mar 2022 18:05:36 +0000 (13:05 -0500)]
vma_adjust fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agoadd bug on to mt
Liam R. Howlett [Tue, 1 Mar 2022 16:29:05 +0000 (11:29 -0500)]
add bug on to mt

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agodo_mas_aligh_munmap issues
Liam R. Howlett [Tue, 1 Mar 2022 15:55:12 +0000 (10:55 -0500)]
do_mas_aligh_munmap issues

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple tree: debug compile issues
Liam R. Howlett [Tue, 1 Mar 2022 15:54:44 +0000 (10:54 -0500)]
maple tree: debug compile issues

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agofix fix for fix
Liam R. Howlett [Tue, 1 Mar 2022 15:56:08 +0000 (10:56 -0500)]
fix fix for fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agometadata fixes
Liam R. Howlett [Tue, 1 Mar 2022 15:53:56 +0000 (10:53 -0500)]
metadata fixes

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple_tree: Fix header doc on metadata
Liam R. Howlett [Tue, 1 Mar 2022 01:55:31 +0000 (20:55 -0500)]
maple_tree: Fix header doc on metadata

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agoFix compile warnings
Liam R. Howlett [Mon, 28 Feb 2022 14:58:21 +0000 (09:58 -0500)]
Fix compile warnings

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple_tree: Fix bool return in mas_wr_append()
Liam R. Howlett [Fri, 25 Feb 2022 14:59:15 +0000 (09:59 -0500)]
maple_tree: Fix bool return in mas_wr_append()

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomm/mmap.c: Drop inline
Liam R. Howlett [Fri, 25 Feb 2022 01:39:29 +0000 (20:39 -0500)]
mm/mmap.c: Drop inline

Add this to 387dca4a26d4a as well

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomm.h: Drop extern
Liam R. Howlett [Fri, 25 Feb 2022 01:38:07 +0000 (20:38 -0500)]
mm.h: Drop extern

Add this to 387dca4a26d4a as well

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agoAdd find_vma_intersection to nommu
Liam R. Howlett [Fri, 25 Feb 2022 01:36:58 +0000 (20:36 -0500)]
Add find_vma_intersection to nommu

Add this to 387dca4a26d4a

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple_tree: Fix stack size again
Liam R. Howlett [Thu, 24 Feb 2022 18:27:22 +0000 (13:27 -0500)]
maple_tree: Fix stack size again

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agommap: Make vma_store() static
Liam R. Howlett [Thu, 24 Feb 2022 18:03:21 +0000 (13:03 -0500)]
mmap: Make vma_store() static

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agonommu fix of Remove the vma linked list
Liam R. Howlett [Thu, 24 Feb 2022 17:49:30 +0000 (12:49 -0500)]
nommu fix of Remove the vma linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agocleanup set_piv and fix fallthough
Liam R. Howlett [Thu, 24 Feb 2022 17:38:10 +0000 (12:38 -0500)]
cleanup set_piv and fix fallthough

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agoFix 5cae5d8ed9a97
Liam R. Howlett [Thu, 24 Feb 2022 16:52:52 +0000 (11:52 -0500)]
Fix 5cae5d8ed9a97

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agorisc vdso fix
Liam R. Howlett [Thu, 24 Feb 2022 16:51:56 +0000 (11:51 -0500)]
risc vdso fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple_tree: Remove else if in mas_walk() for if statement
Liam R. Howlett [Tue, 22 Feb 2022 16:59:39 +0000 (11:59 -0500)]
maple_tree: Remove else if in mas_walk() for if statement

Since the if returns, make the next else if just an if

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple_tree: Remove check from mas_prev_entry() loop
Liam R. Howlett [Tue, 22 Feb 2022 16:58:45 +0000 (11:58 -0500)]
maple_tree: Remove check from mas_prev_entry() loop

Fix up the change outside the very unlikely loop end

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple_tree: Make mtree_range_walk() more efficient
Liam R. Howlett [Tue, 22 Feb 2022 16:57:30 +0000 (11:57 -0500)]
maple_tree: Make mtree_range_walk() more efficient

Only check offset < end

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple_tree: Clean up mte_set_pivot() dereference
Liam R. Howlett [Tue, 22 Feb 2022 16:56:38 +0000 (11:56 -0500)]
maple_tree: Clean up mte_set_pivot() dereference

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agoFix maple_big_node struct gap calc.
Liam R. Howlett [Sun, 20 Feb 2022 15:35:28 +0000 (10:35 -0500)]
Fix maple_big_node struct gap calc.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agodamon: Fix stack size
Liam R. Howlett [Fri, 18 Feb 2022 01:27:37 +0000 (20:27 -0500)]
damon: Fix stack size

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple_tree: big node weight reduction
Liam R. Howlett [Thu, 17 Feb 2022 22:32:14 +0000 (17:32 -0500)]
maple_tree: big node weight reduction

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomaple_tree: whitespace
Liam R. Howlett [Thu, 17 Feb 2022 17:44:39 +0000 (12:44 -0500)]
maple_tree: whitespace

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomm/mmap.c: Pass in mapping to __vma_link_file()
Liam R. Howlett [Wed, 8 Dec 2021 19:12:39 +0000 (14:12 -0500)]
mm/mmap.c: Pass in mapping to __vma_link_file()

__vma_link_file() resolves the mapping from the file, if there is one.
Pass through the mapping and check the vm_file externally since most
places already have the required information and check of vm_file.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agomm/mmap: Drop range_has_overlap() function
Liam R. Howlett [Fri, 18 Jun 2021 19:06:12 +0000 (15:06 -0400)]
mm/mmap: Drop range_has_overlap() function

Since there is no longer a linked list, the range_has_overlap() function
is identical to the find_vma_intersection() function.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
3 years agomm: Remove the vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 20:10:54 +0000 (15:10 -0500)]
mm: Remove the vma linked list

Replace any vm_next use with vma_find().

Update free_pgtables(), unmap_vmas(), and zap_page_range() to use the
maple tree.

Use the new free_pgtables() and unmap_vmas() in do_mas_align_munmap().
At the same time, alter the loop to be more compact.

Now that free_pgtables() and unmap_vmas() take a maple tree as an
argument, rearrange do_mas_align_munmap() to use the new tree to hold
the vmas to remove.

Remove __vma_link_list() and __vma_unlink_list() as they are exclusively
used to update the linked list

Drop linked list update from __insert_vm_struct().

Rework validation of tree as it was depending on the linked list.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
3 years agoriscv: Use vma iterator for vdso
Liam R. Howlett [Wed, 26 Jan 2022 21:11:51 +0000 (16:11 -0500)]
riscv: Use vma iterator for vdso

Remove the linked list use in favour of the vma iterator.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 years agonommu: Remove uses of VMA linked list
Matthew Wilcox (Oracle) [Fri, 29 Oct 2021 14:18:13 +0000 (10:18 -0400)]
nommu: Remove uses of VMA linked list

Use the maple tree or VMA iterator instead.  This is faster and will
allow us to shrink the VMA.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
3 years agoi915: Use the VMA iterator
Matthew Wilcox (Oracle) [Sat, 30 Oct 2021 03:46:58 +0000 (23:46 -0400)]
i915: Use the VMA iterator

Replace the linked list in probe_range() with the VMA iterator.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
3 years agomm/swapfile: Use vma iterator instead of vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 20:07:11 +0000 (15:07 -0500)]
mm/swapfile: Use vma iterator instead of vma linked list

unuse_mm() no longer needs to reference the linked list.

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

walk_page_range() no longer uses the one vma linked list reference.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
3 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>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
3 years agomm/msync: Use vma_find() instead of vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 20:04:14 +0000 (15:04 -0500)]
mm/msync: Use vma_find() instead of vma linked list

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

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
3 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>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
3 years agomm/mlock: Use vma iterator and instead of vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 20:00:14 +0000 (15:00 -0500)]
mm/mlock: Use vma iterator and instead of vma linked list

Handle overflow checking in count_mm_mlocked_page_nr() differently.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
3 years agomm/mempolicy: Use vma iterator & maple state instead of vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:59:52 +0000 (14:59 -0500)]
mm/mempolicy: Use vma iterator & maple state instead of vma linked list

Reworked the way mbind_range() finds the first VMA to reuse the maple
state and limit the number of tree walks needed.

Note, this drops the VM_BUG_ON(!vma) call, which would catch a start
address higher than the last VMA.  The code was written in a way that
allowed no VMA updates to occur and still return success.  There should
be no functional change to this scenario with the new code.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
3 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

Pass through ULONG_MAX instead.

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

madvise_walk_vmas() no longer uses linked list.

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

Remove the use of the linked list for eventual removal.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
3 years agomm/khugepaged: Stop using vma linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:56:58 +0000 (14:56 -0500)]
mm/khugepaged: Stop using vma linked list

Use vma iterator & find_vma() instead of vma linked list.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
3 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

Use find_vma_intersection() to locate the VMAs in __mm_populate()
instead of using find_vma() and the linked list.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
3 years agobpf: Remove VMA linked list
Liam R. Howlett [Wed, 7 Apr 2021 19:56:08 +0000 (15:56 -0400)]
bpf: Remove VMA linked list

Use vma_next() and remove reference to the start of the linked list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
3 years agofork: Use VMA iterator
Liam R. Howlett [Mon, 4 Jan 2021 19:54:49 +0000 (14:54 -0500)]
fork: Use VMA iterator

The VMA iterator is faster than the linked list and removing the linked
list will shrink the vm_area_struct.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
3 years agosched: Use maple tree iterator to walk VMAs
Liam R. Howlett [Mon, 4 Jan 2021 19:54:07 +0000 (14:54 -0500)]
sched: Use maple tree iterator to walk VMAs

The linked list is slower than walking the VMAs using the maple tree.
We can't use the VMA iterator here because it doesn't support
moving to an earlier position.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
3 years agoperf: Use VMA iterator
Liam R. Howlett [Mon, 4 Jan 2021 19:52:39 +0000 (14:52 -0500)]
perf: Use VMA iterator

The VMA iterator is faster than the linked list and removing the linked
list will shrink the vm_area_struct.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
3 years agoacct: Use VMA iterator instead of linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:52:15 +0000 (14:52 -0500)]
acct: Use VMA iterator instead of linked list

The VMA iterator is faster than the linked list.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
3 years agoipc/shm: Use VMA iterator instead of linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:51:19 +0000 (14:51 -0500)]
ipc/shm: Use VMA iterator instead of linked list

The VMA iterator is faster than the linked llist, and it can be walked
even when VMAs are being removed from the address space, so there's no
need to keep track of 'next'.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
3 years agouserfaultfd: Use maple tree iterator to iterate VMAs
Liam R. Howlett [Mon, 4 Jan 2021 19:49:47 +0000 (14:49 -0500)]
userfaultfd: Use maple tree iterator to iterate VMAs

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>
3 years agofs/proc/task_mmu: Stop using linked list and highest_vm_end
Matthew Wilcox (Oracle) [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: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
3 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>
3 years agoexec: Use VMA iterator instead of linked list
Liam R. Howlett [Mon, 4 Jan 2021 19:45:37 +0000 (14:45 -0500)]
exec: Use VMA iterator instead of linked list

Remove a use of the vm_next list by doing the initial lookup with the
VMA iterator and then using it to find the next entry.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
3 years agocoredump: Remove vma linked list walk
Matthew Wilcox (Oracle) [Tue, 26 Oct 2021 21:18:31 +0000 (17:18 -0400)]
coredump: Remove vma linked list walk

Use the Maple Tree iterator instead.  This is too complicated for the
VMA iterator to handle, so let's open-code it for now.  If this turns
out to be a common pattern, we can migrate it to common code.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
3 years agobinfmt_elf: Remove vma linked list walk
Liam R. Howlett [Mon, 4 Jan 2021 19:44:16 +0000 (14:44 -0500)]
binfmt_elf: Remove vma linked list walk

Use the VMA iterator instead.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
3 years agoum: Remove vma linked list walk
Liam R. Howlett [Tue, 16 Mar 2021 19:56:41 +0000 (15:56 -0400)]
um: Remove vma linked list walk

Use the VMA iterator instead.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
3 years agooptee: Remove vma linked list walk
Liam R. Howlett [Mon, 4 Jan 2021 19:43:36 +0000 (14:43 -0500)]
optee: Remove vma linked list walk

Use the VMA iterator instead.  Change the calling convention of
__check_mem_type() to pass in the mm instead of the first vma in the
range.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
3 years agocxl: Remove vma linked list walk
Liam R. Howlett [Mon, 4 Jan 2021 19:31:50 +0000 (14:31 -0500)]
cxl: Remove vma linked list walk

Use the VMA iterator instead.  This requires a little restructuring
of the surrounding code to hoist the mm to the caller.  That turns
cxl_prefault_one() into a trivial function, so call cxl_fault_segment()
directly.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
3 years agoxtensa: Remove vma linked list walks
Liam R. Howlett [Mon, 4 Jan 2021 19:30:59 +0000 (14:30 -0500)]
xtensa: Remove vma linked list walks

Use the VMA iterator instead.  Since VMA can no longer be NULL in the
loop, then deal with out-of-memory outside the loop.  This means a
slightly longer run time in the failure case (-ENOMEM) - it will run to
the end of the VMAs before erroring instead of in the middle of the
loop.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
3 years agox86: Remove vma linked list walks
Liam R. Howlett [Mon, 4 Jan 2021 19:30:25 +0000 (14:30 -0500)]
x86: Remove vma linked list walks

Use the VMA iterator instead.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
3 years agos390: Remove vma linked list walks
Liam R. Howlett [Mon, 4 Jan 2021 19:29:19 +0000 (14:29 -0500)]
s390: Remove vma linked list walks

Use the VMA iterator instead.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
3 years agopowerpc: Remove mmap linked list walks
Liam R. Howlett [Mon, 4 Jan 2021 19:25:54 +0000 (14:25 -0500)]
powerpc: Remove mmap linked list walks

Use the VMA iterator instead.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
3 years agoparisc: Remove mmap linked list from cache handling
Liam R. Howlett [Mon, 4 Jan 2021 19:25:19 +0000 (14:25 -0500)]
parisc: Remove mmap linked list from cache handling

Use the VMA iterator instead.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
3 years agoarm64: Remove mmap linked list from vdso
Liam R. Howlett [Mon, 4 Jan 2021 19:24:40 +0000 (14:24 -0500)]
arm64: Remove mmap linked list from vdso

Use the VMA iterator instead.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
3 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() has already aligned the address and has a maple tree
state to be used.  Use the new do_mas_align_munmap() to avoid
unnecessary alignment and error checks.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
3 years agomm/mmap: Reorganize munmap to use maple states
Liam R. Howlett [Thu, 19 Nov 2020 17:57:23 +0000 (12:57 -0500)]
mm/mmap: Reorganize munmap to use maple states

Remove __do_munmap() in favour of do_munmap(), do_mas_munmap(), and
do_mas_align_munmap().

do_munmap() is a wrapper to create a maple state for any callers that
have not been converted to the maple tree.

do_mas_munmap() takes a maple state to mumap a range.  This is just a
small function which checks for error conditions and aligns the end of
the range.

do_mas_align_munmap() uses the aligned range to mumap a range.
do_mas_align_munmap() starts with the first VMA in the range, then finds
the last VMA in the range.  Both start and end are split if necessary.
Then the VMAs are unlocked and removed from the linked list at the same
time.  Followed by a single tree operation of overwriting the area in
with a NULL.  Finally, the detached list is unmapped and freed.

By reorganizing the munmap calls as outlined, it is now possible to
avoid extra work of aligning pre-aligned callers which are known to be
safe, avoid extra VMA lookups or tree walks for modifications.

detach_vmas_to_be_unmapped() is no longer used, so drop this code.

vm_brk_flags() can just call the do_mas_munmap() as it checks for
intersecting VMAs directly.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
3 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>
3 years agomm: Convert vma_lookup() to use mtree_load()
Matthew Wilcox (Oracle) [Fri, 29 Oct 2021 01:53:09 +0000 (21:53 -0400)]
mm: Convert vma_lookup() to use mtree_load()

Unlike the rbtree, the Maple Tree will return a NULL if there's
nothing at a particular address.

Since the previous commit dropped the vmacache, it is now possible to
consult the tree directly.

Acked-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
3 years agomm: Remove vmacache
Liam R. Howlett [Mon, 16 Nov 2020 19:50:20 +0000 (14:50 -0500)]
mm: Remove vmacache

By using the maple tree and the maple tree state, the vmacache is no
longer beneficial and is complicating the VMA code.  Remove the vmacache
to reduce the work in keeping it up to date and code complexity.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
3 years agomm/mmap: Use advanced maple tree API for mmap_region()
Liam R. Howlett [Tue, 10 Nov 2020 18:37:40 +0000 (13:37 -0500)]
mm/mmap: Use advanced maple tree API for mmap_region()

Changing mmap_region() to use the maple tree state and the advanced
maple tree interface allows for a lot less tree walking.

This change removes the last caller of munmap_vma_range(), so drop this
unused function.

Add vma_expand() to expand a VMA if possible by doing the necessary
hugepage check, uprobe_munmap of files, dcache flush, modifications then
undoing the detaches, etc.

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