]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
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>
4 years agomm_types: Drop more rb tree from vm_area
Liam R. Howlett [Mon, 2 Nov 2020 17:34:31 +0000 (12:34 -0500)]
mm_types: Drop more rb tree from vm_area

Note: Need to fix NOMMU code
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fux mm->map reference to mm->mmap after rebase
Liam R. Howlett [Mon, 2 Nov 2020 01:02:10 +0000 (20:02 -0500)]
mm/mmap: Fux mm->map reference to mm->mmap after rebase

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agommm/mmap: Fix differences after rebase
Liam R. Howlett [Fri, 30 Oct 2020 19:19:27 +0000 (15:19 -0400)]
mmm/mmap: Fix differences after rebase

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Rework MA_STATE_BULK and MA_STATE_REBALANCE
Liam R. Howlett [Fri, 30 Oct 2020 01:45:01 +0000 (21:45 -0400)]
maple_tree: Rework MA_STATE_BULK and MA_STATE_REBALANCE

Set MA_STATE_BULK when setting the expected number of store events.

Only rebalance the end node when it is deficient.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotest_maple_tree: Add bench_slot_store()
Liam R. Howlett [Thu, 29 Oct 2020 20:01:48 +0000 (16:01 -0400)]
test_maple_tree: Add bench_slot_store()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Drop 128B node support
Liam R. Howlett [Thu, 29 Oct 2020 19:45:43 +0000 (15:45 -0400)]
maple_tree: Drop 128B node support

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Fix _mas_store() expand null
Liam R. Howlett [Thu, 29 Oct 2020 19:11:39 +0000 (15:11 -0400)]
maple_tree: Fix _mas_store() expand null

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Rename MA_STATE_ defines
Liam R. Howlett [Thu, 29 Oct 2020 18:35:26 +0000 (14:35 -0400)]
maple_tree: Rename MA_STATE_ defines

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Don't use mas_extend_null in _mas_store()
Liam R. Howlett [Thu, 29 Oct 2020 17:54:49 +0000 (13:54 -0400)]
maple_tree: Don't use mas_extend_null in _mas_store()

mas_extend_null() is too heavy when the nulls are contained within a single node.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotest_maple_tree: Drop dump in check_ranges()
Liam R. Howlett [Wed, 28 Oct 2020 02:46:00 +0000 (22:46 -0400)]
test_maple_tree: Drop dump in check_ranges()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Reduce variables by using mas->offset directly.. more.
Liam R. Howlett [Wed, 28 Oct 2020 02:40:18 +0000 (22:40 -0400)]
maple_tree: Reduce variables by using mas->offset directly.. more.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Reduce variables by using mas->offset directly
Liam R. Howlett [Wed, 28 Oct 2020 02:16:23 +0000 (22:16 -0400)]
maple_tree: Reduce variables by using mas->offset directly

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Remove mas_offset() and mas_set_offset() now that offset is in ma_state...
Liam R. Howlett [Wed, 28 Oct 2020 01:54:25 +0000 (21:54 -0400)]
maple_tree: Remove mas_offset() and mas_set_offset() now that offset is in ma_state directly

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fix vma locking on brk
Liam R. Howlett [Wed, 28 Oct 2020 00:25:17 +0000 (20:25 -0400)]
mm/mmap: Fix vma locking on brk

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Some optimizations, I hope
Liam R. Howlett [Wed, 28 Oct 2020 00:24:50 +0000 (20:24 -0400)]
maple_tree: Some optimizations, I hope

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Fix _mas_store() rmin expansion on null.
Liam R. Howlett [Tue, 27 Oct 2020 18:10:59 +0000 (14:10 -0400)]
maple_tree: Fix _mas_store() rmin expansion on null.

When the offset changes on expanding null, ensure the min slot value changes
as well.  This avoids a fall-through to the slow path and uses the
mas_node_store() instead.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agokernel/fork: Update maple tree interface.
Liam R. Howlett [Tue, 27 Oct 2020 16:54:10 +0000 (12:54 -0400)]
kernel/fork: Update maple tree interface.

Start using the number of entries directly, and mas_destroy().

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Implement optimized fork splitting.
Liam R. Howlett [Tue, 27 Oct 2020 16:52:49 +0000 (12:52 -0400)]
maple_tree: Implement optimized fork splitting.

When using mas_for_each with pre-allocations, split so that there are
more slots available to the left.  If this results in an insufficient
node to the left, then rebalance on mas_destroy().

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Fix mas_alloc_push() overflow
Liam R. Howlett [Mon, 26 Oct 2020 22:23:36 +0000 (18:23 -0400)]
maple_tree: Fix mas_alloc_push() overflow

mas_alloc_push() was overflowing and writing the next node.  Add #define to
clean up the alloc slot calculations

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotest_maple_tree: Add more allocation checks around overflow
Liam R. Howlett [Mon, 26 Oct 2020 00:31:56 +0000 (20:31 -0400)]
test_maple_tree: Add more allocation checks around overflow

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Fix allocation issues
Liam R. Howlett [Sun, 25 Oct 2020 02:50:19 +0000 (22:50 -0400)]
maple_tree: Fix allocation issues

Ensure no overflow on mas_alloc_nodes()
Use allocated instead of calling mas_allocated() multiple times
Fix mas_set_alloc_req() to set the value and not add it.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotest_maple_tree: Test poping all pushed nodes to ensure mas_allocated is set correctly
Liam R. Howlett [Wed, 21 Oct 2020 19:38:48 +0000 (15:38 -0400)]
test_maple_tree: Test poping all pushed nodes to ensure mas_allocated is set correctly

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Add better allocation testing and relax push_left to avoid jitters
Liam R. Howlett [Wed, 21 Oct 2020 19:23:50 +0000 (15:23 -0400)]
maple_tree: Add better allocation testing and relax push_left to avoid jitters

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotest_maple_tree: Add check_forking()
Liam R. Howlett [Thu, 22 Oct 2020 19:38:31 +0000 (15:38 -0400)]
test_maple_tree: Add check_forking()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: clean up a few small things
Liam R. Howlett [Thu, 22 Oct 2020 18:46:42 +0000 (14:46 -0400)]
maple_tree: clean up a few small things

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Fix mas_for_each limits on index when searching for first entry in node
Liam R. Howlett [Thu, 22 Oct 2020 18:46:13 +0000 (14:46 -0400)]
maple_tree: Fix mas_for_each limits on index when searching for first entry in node

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fix unnecessary locking of anon_vma on expanding of a vma.
Liam R. Howlett [Tue, 20 Oct 2020 18:59:58 +0000 (14:59 -0400)]
mm/mmap: Fix unnecessary locking of anon_vma on expanding of a vma.

When expanding the end of a vma, it is unnecessary to loc the anon_vma tree for writing
because the spinlock on the vma tree ensures that there are no concurrent vma expansions

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree_test: Fix compile warnings
Liam R. Howlett [Tue, 20 Oct 2020 16:25:02 +0000 (12:25 -0400)]
maple_tree_test: Fix compile warnings

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Fix mas_alloc_nodes() off by one in bulk alloc
Liam R. Howlett [Tue, 20 Oct 2020 16:24:51 +0000 (12:24 -0400)]
maple_tree: Fix mas_alloc_nodes() off by one in bulk alloc

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Switch to kmem_cache_alloc_bulk() instead of single node allocations
Liam R. Howlett [Sat, 17 Oct 2020 00:06:05 +0000 (20:06 -0400)]
maple_tree: Switch to kmem_cache_alloc_bulk() instead of single node allocations

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotools/testing/radix-tree: Add keme_cache_alloc_bulk() support
Liam R. Howlett [Sat, 17 Oct 2020 00:05:01 +0000 (20:05 -0400)]
tools/testing/radix-tree: Add keme_cache_alloc_bulk() support

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Add mas_node_store() and fix issue with mas_slot_store()
Liam R. Howlett [Thu, 15 Oct 2020 17:08:44 +0000 (13:08 -0400)]
maple_tree: Add mas_node_store() and fix issue with mas_slot_store()

Add mas_node_store when alterations can be contained within a single node.

Rename mas_fast_store to mas_slot_store.
Fix issue with mas_fast_store getting the wrong range when expanding nulls back.  The range
max was not being updated.

Add testcases for benchmarking and fix forking benchmark

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agotest_maple_tree: change cnt to count
Liam R. Howlett [Tue, 13 Oct 2020 20:31:53 +0000 (16:31 -0400)]
test_maple_tree: change cnt to count

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: cnt => count
Liam R. Howlett [Tue, 13 Oct 2020 18:13:02 +0000 (14:13 -0400)]
maple_tree: cnt => count

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Add mas_free to push unused nodes
Liam R. Howlett [Tue, 13 Oct 2020 16:14:27 +0000 (12:14 -0400)]
maple_tree: Add mas_free to push unused nodes

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fix memory leak by maple tree
Liam R. Howlett [Sun, 11 Oct 2020 03:35:05 +0000 (23:35 -0400)]
mm/mmap: Fix memory leak by maple tree

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Export mas_empty_alloc() for mas_for_each pre-allocations
Liam R. Howlett [Sun, 11 Oct 2020 18:18:05 +0000 (14:18 -0400)]
maple_tree: Export mas_empty_alloc() for mas_for_each pre-allocations

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Fix ltp shmt09 by checking if vma->vm_anon before locking in vma_mt_brk()
Liam R. Howlett [Sat, 10 Oct 2020 01:40:55 +0000 (21:40 -0400)]
maple_tree: Fix ltp shmt09 by checking if vma->vm_anon before locking in vma_mt_brk()

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: brk fix
Liam R. Howlett [Sat, 10 Oct 2020 00:30:17 +0000 (20:30 -0400)]
mm/mmap: brk fix

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_munmap/do_brk_flags().
Liam R. Howlett [Fri, 9 Oct 2020 19:35:01 +0000 (15:35 -0400)]
mm/mmap: Change do_brk_munmap/do_brk_flags().

do_brk_munmap needs to call vma_adjust_trans_huge() when altering the
vma size.

do_brk_munmap needs to support userfaults on umap.

do_brk_flags needs to take a pointer as it could return a new value that
needs to be populated.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomaple_tree: Fix find_vma_intersction() cache update with possible incorrect addr
Liam R. Howlett [Fri, 9 Oct 2020 19:12:59 +0000 (15:12 -0400)]
maple_tree: Fix find_vma_intersction() cache update with possible incorrect addr

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
4 years agomm/mmap: Fix vma_adjust in tracking maple tree
Liam R. Howlett [Fri, 9 Oct 2020 19:08:56 +0000 (15:08 -0400)]
mm/mmap: Fix vma_adjust in tracking maple tree

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