]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
4 years agomaple_tree: Rework mas_mab_cp()
Liam R. Howlett [Wed, 9 Dec 2020 22:00:38 +0000 (17:00 -0500)]
maple_tree: Rework mas_mab_cp()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Only zero request_count in mas_pop_node() if needed
Liam R. Howlett [Wed, 9 Dec 2020 22:00:22 +0000 (17:00 -0500)]
maple_tree: Only zero request_count in mas_pop_node() if needed

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Rework mas_ascend()
Liam R. Howlett [Wed, 9 Dec 2020 21:59:32 +0000 (16:59 -0500)]
maple_tree: Rework mas_ascend()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Rework mas_next_nentry
Liam R. Howlett [Mon, 7 Dec 2020 21:03:26 +0000 (16:03 -0500)]
maple_tree: Rework mas_next_nentry

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: A bunch of optimizations
Liam R. Howlett [Mon, 7 Dec 2020 21:02:52 +0000 (16:02 -0500)]
maple_tree: A bunch of optimizations

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Use memset in mas_reuse_node on arrays
Liam R. Howlett [Mon, 7 Dec 2020 21:02:08 +0000 (16:02 -0500)]
maple_tree: Use memset in mas_reuse_node on arrays

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Retrun boolean from mas_rebalance()
Liam R. Howlett [Mon, 7 Dec 2020 21:01:43 +0000 (16:01 -0500)]
maple_tree: Retrun boolean from mas_rebalance()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Optimize mast_sibling_rebalance_right()
Liam R. Howlett [Mon, 7 Dec 2020 21:00:51 +0000 (16:00 -0500)]
maple_tree: Optimize mast_sibling_rebalance_right()

Only set the data when needed

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Save maple_type in mast_topiary()
Liam R. Howlett [Mon, 7 Dec 2020 21:00:16 +0000 (16:00 -0500)]
maple_tree: Save maple_type in mast_topiary()

It is used more than once

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Use mas_data_end in mas_next_sibling()
Liam R. Howlett [Mon, 7 Dec 2020 20:59:37 +0000 (15:59 -0500)]
maple_tree: Use mas_data_end in mas_next_sibling()

This should be faster for allocation ranges.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Rework mas_first_entry() for leaf case
Liam R. Howlett [Mon, 7 Dec 2020 20:58:39 +0000 (15:58 -0500)]
maple_tree: Rework mas_first_entry() for leaf case

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Save node to avoid duplicate calls
Liam R. Howlett [Mon, 7 Dec 2020 20:58:10 +0000 (15:58 -0500)]
maple_tree: Save node to avoid duplicate calls

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Remove unnecessary call in mas_ascend()
Liam R. Howlett [Mon, 7 Dec 2020 20:57:33 +0000 (15:57 -0500)]
maple_tree: Remove unnecessary call in mas_ascend()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Change some larger functions to not be inline
Liam R. Howlett [Mon, 7 Dec 2020 20:57:05 +0000 (15:57 -0500)]
maple_tree: Change some larger functions to not be inline

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Remove BUG_ON for meta setting
Liam R. Howlett [Mon, 7 Dec 2020 20:55:31 +0000 (15:55 -0500)]
maple_tree: Remove BUG_ON for meta setting

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Remove slot shift calculations.
Liam R. Howlett [Mon, 7 Dec 2020 20:55:13 +0000 (15:55 -0500)]
maple_tree: Remove slot shift calculations.

Slot shift is always 3 now, so don't calculate it.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Change check on mas_prev() loop.
Liam R. Howlett [Mon, 7 Dec 2020 01:40:40 +0000 (20:40 -0500)]
maple_tree: Change check on mas_prev() loop.

Don't check if it is searchable as the only possibility is mas_is_none()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Move all searching to common debug area
Liam R. Howlett [Mon, 7 Dec 2020 01:29:32 +0000 (20:29 -0500)]
maple_tree: Move all searching to common debug area

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Remove unnecessary check for mas_next_nentry().
Liam R. Howlett [Mon, 7 Dec 2020 01:00:15 +0000 (20:00 -0500)]
maple_tree: Remove unnecessary check for mas_next_nentry().

Don't need to check if r_start is out of range of node.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Optimizer mas_node_walk() by removing special case.
Liam R. Howlett [Mon, 7 Dec 2020 00:59:15 +0000 (19:59 -0500)]
maple_tree: Optimizer mas_node_walk() by removing special case.

Check if offset is set is no longer necessary in the loop as it is done before.
Also, check after checing index <= max.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Optimize _mas_store() slow path
Liam R. Howlett [Mon, 7 Dec 2020 00:57:40 +0000 (19:57 -0500)]
maple_tree: Optimize _mas_store() slow path

When entering the slow path, only zero what is necessary after the data is set.
Also, don't calculate things twice when not necessary

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Use a variable for b_node->b_end
Liam R. Howlett [Mon, 7 Dec 2020 00:55:55 +0000 (19:55 -0500)]
maple_tree: Use a variable for b_node->b_end

Makes cleaner code and less dereferences

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Change mas_descend_adopt() to not set offset.
Liam R. Howlett [Mon, 7 Dec 2020 00:55:10 +0000 (19:55 -0500)]
maple_tree: Change mas_descend_adopt() to not set offset.

Instead, reset the offset in mas_new_child() as the data is already being accessed.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: mas_first_entry() optimization
Liam R. Howlett [Mon, 7 Dec 2020 00:53:05 +0000 (19:53 -0500)]
maple_tree: mas_first_entry() optimization

Remove loop in favour of checking pivot 0 or 1 as one mus have a value.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Remove BUG_ON() debug
Liam R. Howlett [Sat, 5 Dec 2020 20:36:34 +0000 (15:36 -0500)]
maple_tree: Remove BUG_ON() debug

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Change __mas_walk and mas_wr_walk to directly use type.
Liam R. Howlett [Fri, 4 Dec 2020 03:44:49 +0000 (22:44 -0500)]
maple_tree: Change __mas_walk and mas_wr_walk to directly use type.

The node type is known, so don't look it up again

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Set max only when needed in mas_is_span_wr()
Liam R. Howlett [Fri, 4 Dec 2020 03:33:17 +0000 (22:33 -0500)]
maple_tree: Set max only when needed in mas_is_span_wr()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Add append operation
Liam R. Howlett [Fri, 4 Dec 2020 02:56:45 +0000 (21:56 -0500)]
maple_tree: Add append operation

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Code cleanup.
Liam R. Howlett [Fri, 4 Dec 2020 02:56:04 +0000 (21:56 -0500)]
maple_tree: Code cleanup.

remove unnecessary braces, space, and add an unlikely to __mas_walk()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Change mab_split_calc() to do bulk calc first.
Liam R. Howlett [Fri, 4 Dec 2020 02:55:28 +0000 (21:55 -0500)]
maple_tree: Change mab_split_calc() to do bulk calc first.

Do the bulk calc first if necessary.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotest_maple_tree: Increase bench_forking() nr_fork.
Liam R. Howlett [Thu, 3 Dec 2020 19:54:36 +0000 (14:54 -0500)]
test_maple_tree: Increase bench_forking() nr_fork.

Time was getting too low

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Speed up reverse allocation walks.
Liam R. Howlett [Thu, 3 Dec 2020 17:04:18 +0000 (12:04 -0500)]
maple_tree: Speed up reverse allocation walks.

Rewrite loops to be quicker by removing special cases.
Also skip the next slot if a leaf has a gap that is not large enough.

Benchmarks of BENCK_AWALK below:

Old:
./maple  13.57s user 0.00s system 99% cpu 13.596 total

New:
./maple  11.87s user 0.01s system 99% cpu 11.936 total

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Optimize mas_get_empty_area{_rev}() etc
Liam R. Howlett [Thu, 3 Dec 2020 17:03:10 +0000 (12:03 -0500)]
maple_tree: Optimize mas_get_empty_area{_rev}() etc

Take advantage of locality of reference by not dereferencing in some functions.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotest_maple_tree: Increase bench_awalk() count
Liam R. Howlett [Thu, 3 Dec 2020 17:21:21 +0000 (12:21 -0500)]
test_maple_tree: Increase bench_awalk() count

Speedups have dropped this testcase below 10s, so increase it.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotest_maple_tree: Fix mtree_alloc_rrange to search for exclusive end
Liam R. Howlett [Wed, 2 Dec 2020 21:55:00 +0000 (16:55 -0500)]
test_maple_tree: Fix mtree_alloc_rrange to search for exclusive end

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Convert unmapped_area_topdown() search to be inclusive search.
Liam R. Howlett [Wed, 2 Dec 2020 17:24:36 +0000 (12:24 -0500)]
mm/mmap: Convert unmapped_area_topdown() search to be inclusive search.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: stop _mas_get_empty_area() from converting to inclusive search.
Liam R. Howlett [Wed, 2 Dec 2020 17:23:35 +0000 (12:23 -0500)]
maple_tree: stop _mas_get_empty_area() from converting to inclusive search.

This should be done in the mm code

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: optimize mas_rev_awalk and mas_awalk a bit
Liam R. Howlett [Tue, 1 Dec 2020 21:36:30 +0000 (16:36 -0500)]
maple_tree: optimize mas_rev_awalk and mas_awalk a bit

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: optimize some more
Liam R. Howlett [Tue, 1 Dec 2020 21:30:47 +0000 (16:30 -0500)]
maple_tree: optimize some more

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Make some common functions faster.
Liam R. Howlett [Tue, 1 Dec 2020 19:54:18 +0000 (14:54 -0500)]
maple_tree: Make some common functions faster.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Optimize mas_leaf_max_gap() by skipping slots after a gap.
Liam R. Howlett [Tue, 1 Dec 2020 16:04:49 +0000 (11:04 -0500)]
maple_tree: Optimize mas_leaf_max_gap() by skipping slots after a gap.

Two gaps cannot happen in a row, so don't bother checking the next slot if there exists a gap.
Also, remove slot[0], slot[1], and slot[max] by checking them first.  This allows for a more
optimal loop

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 agomm/mmap: Don't mas_set in mma_region() to avoid a mas_reset()
Liam R. Howlett [Tue, 1 Dec 2020 02:29:21 +0000 (21:29 -0500)]
mm/mmap: Don't mas_set in mma_region() to avoid a mas_reset()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: rework do_mas_munmap() and friends
Liam R. Howlett [Tue, 1 Dec 2020 02:28:44 +0000 (21:28 -0500)]
mm/mmap: rework do_mas_munmap() and friends

Pull out alignmnet calculations for functions that have already aligned

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: move populate calc in vm_brk_flags() ouside the mmap_write_unlock
Liam R. Howlett [Tue, 1 Dec 2020 02:27:00 +0000 (21:27 -0500)]
mm/mmap: move populate calc in vm_brk_flags() ouside the mmap_write_unlock

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fix do_brk_flags and do_brk_munmap locking.
Liam R. Howlett [Tue, 1 Dec 2020 02:26:18 +0000 (21:26 -0500)]
mm/mmap: Fix do_brk_flags and do_brk_munmap locking.

Also use the knowledge of finding a mapping at newbrk to know that a munmap is
necessary.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotest_maple_tree: Add tests for prev/next
Liam R. Howlett [Mon, 30 Nov 2020 20:34:39 +0000 (15:34 -0500)]
test_maple_tree: Add tests for prev/next

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotest_maple_tree: Fix test harness for new next/prev interface
Liam R. Howlett [Mon, 30 Nov 2020 20:34:22 +0000 (15:34 -0500)]
test_maple_tree: Fix test harness for new next/prev interface

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Fix mas_next() and mas_walk() setting index/last.
Liam R. Howlett [Mon, 30 Nov 2020 20:28:21 +0000 (15:28 -0500)]
maple_tree: Fix mas_next() and mas_walk() setting index/last.

Ensure that the last/index is set regardless of if there is a value found.  This
is necessary to ensure prev/next work as expected.  Also update mas_find() to
this new functionality

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Fix mas_prev() from skipping entries.
Liam R. Howlett [Mon, 30 Nov 2020 20:27:00 +0000 (15:27 -0500)]
maple_tree: Fix mas_prev() from skipping entries.

When searching backwards, if the node wasn't fully full then the pivot could
be zero and thus return there was no previous entry in the node.  Also set
mas.last/mas.index to ensure correct prev/next functions

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Clean up mas_node_store() by using local var
Liam R. Howlett [Mon, 30 Nov 2020 20:22:52 +0000 (15:22 -0500)]
maple_tree: Clean up mas_node_store() by using local var

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Rework brk() to take interval tree locks when necessary
Liam R. Howlett [Thu, 26 Nov 2020 20:43:25 +0000 (15:43 -0500)]
mm/mmap: Rework brk() to take interval tree locks when necessary

interval tree locks are necessary for expand/contract of VMAs so use them.
This path is also rather slow and cannot be taken if the anon_vma_chain is
not a singular list

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Move __vma_adjust update of highest_vm_end
Liam R. Howlett [Thu, 26 Nov 2020 18:51:52 +0000 (13:51 -0500)]
mm/mmap: Move __vma_adjust update of highest_vm_end

Move the highest_vm_end update to avoid checking if the end changed more than once.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agommap: mmap_region() Remove mas_reset() as it will happen if needed
Liam R. Howlett [Thu, 26 Nov 2020 00:49:08 +0000 (19:49 -0500)]
mmap: mmap_region() Remove mas_reset() as it will happen if needed

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotest_maple_tree: Disable benchmarks
Liam R. Howlett [Wed, 25 Nov 2020 20:07:57 +0000 (15:07 -0500)]
test_maple_tree: Disable benchmarks

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Optimize mas_reuse_node() loop
Liam R. Howlett [Wed, 25 Nov 2020 19:58:09 +0000 (14:58 -0500)]
maple_tree: Optimize mas_reuse_node() loop

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Optimize mas_node_walk() and standardize __mas_walk() a bit
Liam R. Howlett [Wed, 25 Nov 2020 19:04:48 +0000 (14:04 -0500)]
maple_tree: Optimize mas_node_walk() and standardize __mas_walk() a bit

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotest_maple_tree: tweak bench_walk()
Liam R. Howlett [Wed, 25 Nov 2020 19:00:45 +0000 (14:00 -0500)]
test_maple_tree: tweak bench_walk()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotest_maple_tree: Add bench_walk()
Liam R. Howlett [Wed, 25 Nov 2020 18:51:56 +0000 (13:51 -0500)]
test_maple_tree: Add bench_walk()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: mas_node_walk() could never return false
Liam R. Howlett [Wed, 25 Nov 2020 03:37:08 +0000 (22:37 -0500)]
maple_tree: mas_node_walk() could never return false

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 agommap: Avoid modifying maple tree in __vma_adjust more than necessary
Liam R. Howlett [Wed, 25 Nov 2020 01:23:48 +0000 (20:23 -0500)]
mmap: Avoid modifying maple tree in __vma_adjust more than necessary

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agommap: mmap_region() whitespace fix
Liam R. Howlett [Wed, 25 Nov 2020 01:23:17 +0000 (20:23 -0500)]
mmap: mmap_region() whitespace fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agommap: mmap_region() whitespace fix
Liam R. Howlett [Tue, 24 Nov 2020 21:28:18 +0000 (16:28 -0500)]
mmap: mmap_region() whitespace fix

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 all places necessary including mremap.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agommap: Don't reset mas until needed in mmap_region()
Liam R. Howlett [Tue, 24 Nov 2020 21:24:24 +0000 (16:24 -0500)]
mmap: Don't reset mas until needed in mmap_region()

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 agommap: Update count_vma_pages_range() to only use one ma_state
Liam R. Howlett [Tue, 24 Nov 2020 21:22:25 +0000 (16:22 -0500)]
mmap: Update count_vma_pages_range() to only use one ma_state

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agommap: Update mmap_region() to use do_mas_munmap()
Liam R. Howlett [Tue, 24 Nov 2020 19:51:29 +0000 (14:51 -0500)]
mmap: Update mmap_region() to use do_mas_munmap()

Use the maple state to avoid multiple walks of the tree

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 [Tue, 24 Nov 2020 19:49:25 +0000 (14:49 -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 use a ma_state
Liam R. Howlett [Tue, 24 Nov 2020 19:37:16 +0000 (14:37 -0500)]
mm/mmap: Change __do_munmap() to use a ma_state

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fix mmap_region() potential issue
Liam R. Howlett [Tue, 24 Nov 2020 19:36:27 +0000 (14:36 -0500)]
mm/mmap: Fix mmap_region() potential issue

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Drop mas_tree_gap & pass more through from _mas_store
Liam R. Howlett [Tue, 24 Nov 2020 17:19:31 +0000 (12:19 -0500)]
maple_tree: Drop mas_tree_gap & pass more through from _mas_store

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Whitespace fix
Liam R. Howlett [Tue, 24 Nov 2020 17:18:58 +0000 (12:18 -0500)]
mm/mmap: Whitespace fix

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotest_maple_tree: Move benchmarking defines and encapsulate functions
Liam R. Howlett [Tue, 24 Nov 2020 17:18:26 +0000 (12:18 -0500)]
test_maple_tree: Move benchmarking defines and encapsulate functions

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 agomaple_tree: Fix __mas_next() when the limit is hit
Liam R. Howlett [Fri, 20 Nov 2020 03:43:40 +0000 (22:43 -0500)]
maple_tree: Fix __mas_next() when the limit is hit

When a search limit is hit, restore the previous location so that
mas_next() works on that particular ma_state.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotest_maple_tree: Fix defines
Liam R. Howlett [Fri, 20 Nov 2020 19:26:15 +0000 (14:26 -0500)]
test_maple_tree: Fix defines

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotesting: radix-tree changes cleanup
Liam R. Howlett [Thu, 19 Nov 2020 17:15:39 +0000 (12:15 -0500)]
testing: radix-tree changes cleanup

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Code clean up
Liam R. Howlett [Thu, 19 Nov 2020 17:15:22 +0000 (12:15 -0500)]
maple_tree: Code clean up

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm: Clean up modifications
Liam R. Howlett [Thu, 19 Nov 2020 17:15:05 +0000 (12:15 -0500)]
mm: Clean up modifications

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 agomaple_tree: More efficient rev_awalk and mas_next()
Liam R. Howlett [Mon, 16 Nov 2020 19:42:02 +0000 (14:42 -0500)]
maple_tree: More efficient rev_awalk and mas_next()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Change vma->vm_mm to mm
Liam R. Howlett [Thu, 12 Nov 2020 00:30:47 +0000 (19:30 -0500)]
mm/mmap: Change vma->vm_mm to mm

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fix unlock range un do_munmap
Liam R. Howlett [Wed, 11 Nov 2020 21:27:36 +0000 (16:27 -0500)]
mm/mmap: Fix unlock range un do_munmap

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Clean up mas_ascend() on root parent
Liam R. Howlett [Wed, 11 Nov 2020 18:39:10 +0000 (13:39 -0500)]
maple_tree: Clean up mas_ascend() on root parent

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: reset mas->node to MAS_START in mas_next() if it's MAS_NONE
Liam R. Howlett [Wed, 11 Nov 2020 18:36:14 +0000 (13:36 -0500)]
maple_tree: reset mas->node to MAS_START in mas_next() if it's MAS_NONE

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 agomaple_tree: When mas_walk() is called in mas->node == MAS_NONE, reset to MAS_START
Liam R. Howlett [Wed, 11 Nov 2020 18:27:54 +0000 (13:27 -0500)]
maple_tree: When mas_walk() is called in mas->node == MAS_NONE, reset to MAS_START

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/mmap: Fix do_brk_munmap() multiple pages.
Liam R. Howlett [Mon, 9 Nov 2020 19:45:37 +0000 (14:45 -0500)]
mm/mmap: Fix do_brk_munmap() multiple pages.

This is rare, so just use the slower __do_munmap()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Call __do_munmap() on slow path of do_brk_munmap()
Liam R. Howlett [Mon, 9 Nov 2020 18:41:05 +0000 (13:41 -0500)]
mm/mmap: Call __do_munmap() on slow path of do_brk_munmap()

do_brk_munmap() would not handle the unmapping of multiple VMAs in the case of
mprotect'ed regions of a brk() so just use the full __do_munmap() in these
rare cases.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Finish converting brk() to using a maple state
Liam R. Howlett [Fri, 6 Nov 2020 21:54:02 +0000 (16:54 -0500)]
mm/mmap: Finish converting brk() to using a maple state

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Add mas_store_gfp() and fix mas_prev() and mas_store()
Liam R. Howlett [Fri, 6 Nov 2020 21:52:59 +0000 (16:52 -0500)]
maple_tree: Add mas_store_gfp() and fix mas_prev() and mas_store()

When searching for the previous value, walk the node first.  Don't just assume we are looking for the
last entry if it's MAS_START.

mas_store() and mas_destroy() now workk better with MAS_START as well.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Optimizations and whitespace. nothing interesting
Liam R. Howlett [Fri, 6 Nov 2020 21:50:55 +0000 (16:50 -0500)]
maple_tree: Optimizations and whitespace.  nothing interesting

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: whitespace
Liam R. Howlett [Wed, 4 Nov 2020 02:41:52 +0000 (21:41 -0500)]
maple_tree: whitespace

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotest_maple_tree: Make bench_slot_store() more realistic
Liam R. Howlett [Wed, 4 Nov 2020 02:39:33 +0000 (21:39 -0500)]
test_maple_tree: Make bench_slot_store() more realistic

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Optimize __mas_next a bit, I hope
Liam R. Howlett [Wed, 4 Nov 2020 02:33:58 +0000 (21:33 -0500)]
maple_tree: Optimize __mas_next a bit, I hope

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Add metadata to arange nodes.
Liam R. Howlett [Wed, 4 Nov 2020 02:33:19 +0000 (21:33 -0500)]
maple_tree: Add metadata to arange nodes.

Add a metadata into the arange64 nodes to tell the end and the largest gap slot.

This is used to speed up various activities on the node, especially finding the
end of the data and updating the gap.

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