]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
5 years agomaple_tree: Fix mas_find search. maple2
Liam R. Howlett [Thu, 17 Oct 2019 02:00:41 +0000 (22:00 -0400)]
maple_tree: Fix mas_find search.

There was a bug when a null occurred in a non-leaf node.  This commit
addresses that issue as well as trying to fix dead node detection.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple tree test: Iterate over a partially deleted tree
Matthew Wilcox (Oracle) [Wed, 16 Oct 2019 20:03:18 +0000 (16:03 -0400)]
maple tree test: Iterate over a partially deleted tree

Move mas_reset() to the header file and add mas_retry() to mirror
xas_retry().  Fix a few minor typos too.  Each time we delete an
entry from the tree, iterate over the tree to be sure we can still
do that correctly.  It fails once we've deleted the first node.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
5 years agomaple_tree: Fix coalesce/rebalance when erasing from the front of the
Liam R. Howlett [Wed, 16 Oct 2019 19:31:37 +0000 (15:31 -0400)]
maple_tree: Fix coalesce/rebalance when erasing from the front of the
tree.

mas_coalesce_pivots added to set all null entries to the same pivot.
mas_coalesce_empty added to coalesce pivots after setting the entry to
NULL.
mas_rebalance reworked to free empty & coalesce_pivots on allocation
failure.  Parent nodes are then checked.
coalesce_root has a special case for when end == coalesce for handling
allocation failures.
mas_coalesce reworked to better perform when checking parent nodes &
works when allocations fail.
Gaps are now pushed to the right to avoid pulling the 0 pivot to the
left.

Also included:
Add check for dense nodes.
Fix mas_prev_slot called with root node.
typo fix for rebalance comment

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple tree tests: Erase entries individually
Matthew Wilcox (Oracle) [Wed, 16 Oct 2019 00:50:29 +0000 (20:50 -0400)]
maple tree tests: Erase entries individually

This should result in the tree being empty.  Right now, it doesn't --
the nodes full of deleted entries are not themselves deleted.

Also fix the lack of locking around the mas iteration.

5 years agomaple_tree: Convert mtree_erase to match xarray interface
Liam R. Howlett [Tue, 15 Oct 2019 23:34:51 +0000 (19:34 -0400)]
maple_tree: Convert mtree_erase to match xarray interface

Return erased value instead of number of freed slots.  This required a
bit of a rework of the test cases.

Also removed two test cases to verify new nodes were used as they were
not necessary when the deleted range is an exact match for the insert.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Rename ms_root_expand to mas_root_expand to align with naming convention
Liam R. Howlett [Tue, 15 Oct 2019 18:44:00 +0000 (14:44 -0400)]
maple_tree: Rename ms_root_expand to mas_root_expand to align with naming convention

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Update mas_start to return the entry on a single pointer
Liam R. Howlett [Tue, 15 Oct 2019 18:40:48 +0000 (14:40 -0400)]
maple_tree: Update mas_start to return the entry on a single pointer
tree.

mas_start returns:
  If mas->node is an error or MAS_START, return NULL
  If it's an empty tree:     NULL & mas->node == MAS_NONE
  If it's a single entry:    The entry & mas->node == MAS_ROOT
  If it's a tree:            NULL & mas->node == safe root node.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Change mas_start to return the entry in a single pointer
Liam R. Howlett [Tue, 15 Oct 2019 18:38:45 +0000 (14:38 -0400)]
maple_tree: Change mas_start to return the entry in a single pointer
tree.

There are now three cases of the mas_start return:
 If it's an empty tree:     NULL & mas->node == MAS_NONE
 If it's a single entry:    The entry & mas->node == MAS_ROOT
 If it's a tree:            NULL & mas->node == safe root node.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Fix check_find_2 testcase.
Liam R. Howlett [Tue, 15 Oct 2019 02:40:35 +0000 (22:40 -0400)]
maple_tree: Fix check_find_2 testcase.

The check_find_2 exposed issues when the tree was a simple pointer.  The
pointer case was not being handled correctly in mas_start, or _mas_walk.
Fixing these two functions also required fixing calling functions to
check for MAS_ROOT (a root pointer).

There was also a bug in mas_next_entry where the next node was checked -
which is not possible if it's the root node.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agoMerge remote-tracking branch 'willy/maple2' into maple2
Liam R. Howlett [Tue, 15 Oct 2019 00:44:08 +0000 (20:44 -0400)]
Merge remote-tracking branch 'willy/maple2' into maple2

5 years agomore thoughts
Matthew Wilcox (Oracle) [Thu, 15 Aug 2019 19:42:56 +0000 (15:42 -0400)]
more thoughts

5 years agomaple_tree: New check_find2 test
Matthew Wilcox (Oracle) [Sun, 13 Oct 2019 03:24:44 +0000 (23:24 -0400)]
maple_tree: New check_find2 test

This is supposed to test various different conditions, but it currently
falls over trying to iterate a tree with no entries in it.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
5 years agomaple_tree: Fix test check_find
Matthew Wilcox (Oracle) [Sun, 13 Oct 2019 03:23:46 +0000 (23:23 -0400)]
maple_tree: Fix test check_find

Lock the tree before beginning the iteration and unlock it after we've
finished.  Also destroy the tree so subsequent users of the tree aren't
confused by the detritus from this test.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
5 years agomaple_tree: Fix mas_dead_node for a trivial tree
Matthew Wilcox (Oracle) [Sun, 13 Oct 2019 03:21:36 +0000 (23:21 -0400)]
maple_tree: Fix mas_dead_node for a trivial tree

For a tree with no entries, or an entry only at 0, mas_dead_node()
can be called with a mas->node of NULL.  This node is, by definition,
not dead.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
5 years agomaple_tree: Use mas_lock/unlock
Matthew Wilcox (Oracle) [Sun, 13 Oct 2019 03:20:48 +0000 (23:20 -0400)]
maple_tree: Use mas_lock/unlock

If we've got a maple state, use the convenience wrappers instead of
open-coding it.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
5 years agomaple_tree: Random whitespace fixes
Matthew Wilcox (Oracle) [Sun, 13 Oct 2019 03:19:22 +0000 (23:19 -0400)]
maple_tree: Random whitespace fixes

Also add some missing EXPORT_SYMBOLs

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
5 years agomaple_tree: Add mas_set() and mas_set_range()
Matthew Wilcox (Oracle) [Sun, 13 Oct 2019 03:16:46 +0000 (23:16 -0400)]
maple_tree: Add mas_set() and mas_set_range()

The equivalent of xas_set()

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
5 years agomaple_tree: Fix mas_load issues
Liam R. Howlett [Fri, 11 Oct 2019 15:14:55 +0000 (11:14 -0400)]
maple_tree: Fix mas_load issues

Previous commit included incomplete work of mas_load by accident.  This
fixes the build failure and successfully runs all tests.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Move iterators to the header
Liam R. Howlett [Fri, 11 Oct 2019 14:39:35 +0000 (10:39 -0400)]
maple_tree: Move iterators to the header

This is part of the api, so expose it through the header.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Standardize names of functions
Liam R. Howlett [Thu, 10 Oct 2019 19:08:29 +0000 (15:08 -0400)]
maple_tree: Standardize names of functions

anything that takes a struct ma_state as the first argument is named
mas_
anything that takes a struct maple_enode as the first argument is name
mte_

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Add coalesce support.
Liam R. Howlett [Tue, 8 Oct 2019 01:34:08 +0000 (21:34 -0400)]
maple_tree: Add coalesce support.

Coalesce is done in two stages:
  1. Set all adjacent coalesce pivots to the highest value.
  2. rebalance if there is not enough data in the node.

Rebalance is done as follows:
  1. Take data from the right (4 or everything)
  2. if there is no right, rebalance the node to the left.
  3. if there is no left, rebalance the parent.
  4. if there is no parent, remove a level from the tree.

More testing is needed.  The test infrastructure needs to be reworked to
use more knowledge of the tree layout to test when split/erase occurs
and to ensure the testcases fail if they become invalid (ie: dense
support re-enabled).

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Add layout comments to header.
Liam R. Howlett [Wed, 14 Aug 2019 17:30:36 +0000 (13:30 -0400)]
maple_tree: Add layout comments to header.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Remove unnecessary coalescing.
Liam R. Howlett [Mon, 5 Aug 2019 19:53:28 +0000 (15:53 -0400)]
maple_tree: Remove unnecessary coalescing.

Coalescing is only needed between nodes now.  Skip any identical entries when copying the node data in ma_add

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: More erase checking.
Liam R. Howlett [Mon, 5 Aug 2019 18:50:07 +0000 (14:50 -0400)]
maple_tree: More erase checking.

Ensure erase coalesces XA_RETRY_ENTRY on copy, and don't split if data can be coalesced

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Convert another pivot fetch to safe_pivot
Liam R. Howlett [Mon, 5 Aug 2019 16:38:13 +0000 (12:38 -0400)]
maple_tree: Convert another pivot fetch to safe_pivot

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Restore slot in ma_coalesce and additional erase testcases
Liam R. Howlett [Mon, 5 Aug 2019 15:33:27 +0000 (11:33 -0400)]
maple_tree: Restore slot in ma_coalesce and additional erase testcases

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Clean up ma_copy and mas_coalesce
Liam R. Howlett [Fri, 2 Aug 2019 19:35:27 +0000 (15:35 -0400)]
maple_tree: Clean up ma_copy and mas_coalesce

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Fix coalesce to skip duplicate pivots and to run on leaves
Liam R. Howlett [Fri, 2 Aug 2019 18:43:02 +0000 (14:43 -0400)]
maple_tree: Fix coalesce to skip duplicate pivots and to run on leaves

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agotest_maple_tree: Quiet down output
Liam R. Howlett [Fri, 2 Aug 2019 17:40:14 +0000 (13:40 -0400)]
test_maple_tree: Quiet down output

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Add some comments to ma_rev_alloc and ma_alloc
Liam R. Howlett [Fri, 2 Aug 2019 15:29:20 +0000 (11:29 -0400)]
maple_tree: Add some comments to ma_rev_alloc and ma_alloc

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Store XA_RETRY_ENTRY on erase
Liam R. Howlett [Fri, 2 Aug 2019 15:21:12 +0000 (11:21 -0400)]
maple_tree: Store XA_RETRY_ENTRY on erase

Avoid using slots again until an RCU freeing cycle is complete by storing XA_RETRY_ENTRY

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Add mas_pause for pausing iterator.
Liam R. Howlett [Thu, 1 Aug 2019 18:09:25 +0000 (14:09 -0400)]
maple_tree: Add mas_pause for pausing iterator.

Also add testcases for the pause function.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: checkpatch fixes
Liam R. Howlett [Thu, 1 Aug 2019 02:02:24 +0000 (22:02 -0400)]
maple_tree: checkpatch fixes

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Add restarts for interaters on dead nodes.
Liam R. Howlett [Thu, 1 Aug 2019 01:08:19 +0000 (21:08 -0400)]
maple_tree: Add restarts for interaters on dead nodes.

also fix the testcase for the iterators for the zero entry test.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: mt_for_each implementation
Liam R. Howlett [Wed, 31 Jul 2019 18:52:04 +0000 (14:52 -0400)]
maple_tree: mt_for_each implementation

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Add check for mas_for_each loop.
Liam R. Howlett [Wed, 31 Jul 2019 17:12:10 +0000 (13:12 -0400)]
maple_tree: Add check for mas_for_each loop.

Also change the ams_start to reset min/max

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomas_find implementation
Liam R. Howlett [Wed, 31 Jul 2019 16:38:16 +0000 (12:38 -0400)]
mas_find implementation

Fixes for prev/next node as well

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: mas_next_node/mas_prev_node restarts added on dead node detection.
Liam R. Howlett [Sat, 27 Jul 2019 00:31:30 +0000 (20:31 -0400)]
maple_tree: mas_next_node/mas_prev_node restarts added on dead node detection.

Also required reordering some functions.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Add basic store support.
Liam R. Howlett [Fri, 14 Jun 2019 12:37:34 +0000 (08:37 -0400)]
maple_tree: Add basic store support.

This store operation builds a new tree.  This was done to avoid creating
an invalid b-tree (not the same height from all leaves to head).

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Change erase return to 0 on success.
Liam R. Howlett [Wed, 22 May 2019 16:40:26 +0000 (12:40 -0400)]
maple_tree: Change erase return to 0 on success.

Count isn't used, so return 0 for success.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Add reverse walk.
Liam R. Howlett [Wed, 22 May 2019 12:50:15 +0000 (08:50 -0400)]
maple_tree: Add reverse walk.

Search for a hole of a given size at the highest address.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Fix range checking on skip_node
Liam R. Howlett [Tue, 14 May 2019 17:49:12 +0000 (13:49 -0400)]
maple_tree: Fix range checking on skip_node

When skipping a node, it is only valid to break out of the loop if slot
+ 1 is valid.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Fix forward searching for gaps.
Liam R. Howlett [Wed, 24 Apr 2019 17:52:00 +0000 (13:52 -0400)]
maple_tree: Fix forward searching for gaps.

There was an off-by-one issue with the gap calculation as it is
exclusive - inclusive.

Fix the ascend search in maple_awalk using the wrong parent slot.

Return -EBUSY correctly when a failure occurs.

Fix node splitting when there is no such thing as dense.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_dump: Pad better
Matthew Wilcox [Wed, 24 Apr 2019 17:03:27 +0000 (13:03 -0400)]
maple_dump: Pad better

I think this works out better visually than the previous effort.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agomaple_dump: Pad to indicate depth
Matthew Wilcox [Tue, 23 Apr 2019 19:44:48 +0000 (15:44 -0400)]
maple_dump: Pad to indicate depth

Not entirely sure if this is the best way to indicate depth; let's
try it for a bit and see how confused we get.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
5 years agomaple_tree: Disable dense nodes.
Liam R. Howlett [Tue, 23 Apr 2019 19:22:52 +0000 (15:22 -0400)]
maple_tree: Disable dense nodes.

Disable dense nodes to avoid split issues.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: messy test output
Liam R. Howlett [Tue, 2 Apr 2019 14:59:15 +0000 (10:59 -0400)]
maple_tree: messy test output

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Remove early exit on tests
Liam R. Howlett [Thu, 28 Mar 2019 17:59:33 +0000 (13:59 -0400)]
maple_tree: Remove early exit on tests

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Add awalk for walking allocation trees for gaps.
Liam R. Howlett [Thu, 28 Mar 2019 16:24:09 +0000 (12:24 -0400)]
maple_tree: Add awalk for walking allocation trees for gaps.

Adds mtree_alloc_range to allocate a range.  Some basic tests.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Add maple_tree alloc support for gaps.
Liam R. Howlett [Fri, 15 Mar 2019 20:01:22 +0000 (16:01 -0400)]
maple_tree: Add maple_tree alloc support for gaps.

Start populating gaps with values
Remove the maple_aleaf_64 type and use regular maple_leaf_64.
Rework pivot calculations to be more straight forward.
Don't use dense nodes in the root node to avoid having a dense node as
the right-most node.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: typedef maple_enode for encoded node.
Liam R. Howlett [Mon, 18 Mar 2019 19:57:30 +0000 (15:57 -0400)]
maple_tree: typedef maple_enode for encoded node.

Use the compiler to check if an encoded node or a regular node is used

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: typedef parent node to maple_pnode
Liam R. Howlett [Mon, 18 Mar 2019 17:51:34 +0000 (13:51 -0400)]
maple_tree: typedef parent node to maple_pnode

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Use encoded node for getting rcu slot in ma_encoded_parent
Liam R. Howlett [Fri, 15 Mar 2019 20:26:39 +0000 (16:26 -0400)]
maple_tree: Use encoded node for getting rcu slot in ma_encoded_parent

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Add initial maple_arange_64 node support.
Liam R. Howlett [Tue, 12 Mar 2019 18:52:59 +0000 (14:52 -0400)]
maple_tree: Add initial maple_arange_64 node support.

maple_arange_64 is for allocation ranges which need to track gaps in
subtrees.  This commit does not address tracking the gaps.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agotest_maple_tree: Fix range checking.
Liam R. Howlett [Thu, 14 Mar 2019 16:53:16 +0000 (12:53 -0400)]
test_maple_tree: Fix range checking.

Checking a range was not using the correct number range.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Fix range add to empty tree.
Liam R. Howlett [Wed, 13 Mar 2019 15:56:15 +0000 (11:56 -0400)]
maple_tree: Fix range add to empty tree.

When adding to an empty tree, use the encoded node to set the pivot.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Rework internal walk.
Liam R. Howlett [Tue, 12 Mar 2019 18:52:18 +0000 (14:52 -0400)]
maple_tree: Rework internal walk.

Reduce possible calls to get an rcu entry.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agoma_xa_benchmark: Update time calculations
Liam R. Howlett [Fri, 8 Mar 2019 18:54:13 +0000 (13:54 -0500)]
ma_xa_benchmark: Update time calculations

Time calculations were prone to overflow because seconds were not
included.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Fix double free error.
Liam R. Howlett [Fri, 8 Mar 2019 18:53:10 +0000 (13:53 -0500)]
maple_tree: Fix double free error.

There was a double free which raced with the rcu free so it was not
detected all the time.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple: Fix _mas_walk return & clean up ma_insert root expand logic
Liam R. Howlett [Thu, 7 Mar 2019 15:18:29 +0000 (10:18 -0500)]
maple: Fix _mas_walk return & clean up ma_insert root expand logic

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple: Fix off by one error when walking.
Liam R. Howlett [Thu, 7 Mar 2019 14:47:48 +0000 (09:47 -0500)]
maple: Fix off by one error when walking.

When going to the next slot, the minimum value is actually pivot + 1 and
not just the pivot value.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Optimize _mas_walk
Liam R. Howlett [Sun, 17 Feb 2019 22:01:21 +0000 (17:01 -0500)]
maple_tree: Optimize _mas_walk

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Rework walk.
Liam R. Howlett [Fri, 15 Feb 2019 21:27:03 +0000 (16:27 -0500)]
maple_tree: Rework walk.

Make walk more efficient by avoiding duplicate fetches of slot and pivots.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Make walk faster.
Liam R. Howlett [Fri, 15 Feb 2019 20:58:50 +0000 (15:58 -0500)]
maple_tree: Make walk faster.

Avoid looking up duplicate information.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agoma_xa_benchmark: Fix percentage calculation for time.
Liam R. Howlett [Fri, 15 Feb 2019 20:45:42 +0000 (15:45 -0500)]
ma_xa_benchmark: Fix percentage calculation for time.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Efficiencies
Liam R. Howlett [Fri, 15 Feb 2019 20:43:48 +0000 (15:43 -0500)]
maple_tree: Efficiencies

Remove unneeded code.
Fix splitting from the back of a node.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Dense node support & nulls in tree.
Liam R. Howlett [Wed, 13 Feb 2019 16:12:02 +0000 (11:12 -0500)]
maple_tree: Dense node support & nulls in tree.

Support dense node types.  The reduces the space required for sequential
indexes a lot.
Splitting now decides between usign the parent type and the dense node
type for left/right independently.
Fixes had to be made to pivot lookups.
A few static inline additions to speed things up.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Performance enhancements.
Liam R. Howlett [Tue, 12 Feb 2019 21:01:13 +0000 (16:01 -0500)]
maple_tree:  Performance enhancements.

Start using slot 0 on splits.
Fix missing breaks on set of slots.
Calc node type only once during certain loops

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Make functions node-type generic.
Liam R. Howlett [Thu, 7 Feb 2019 19:34:49 +0000 (14:34 -0500)]
maple_tree: Make functions node-type generic.

Move mt_max outside of debug and add mt_slots
Create mt_slots for enum to slot size mapping.
Rename ma_cp_data_64 to ma_split_data
Drop extra calls in split.
Create calls to get/set pivots & slots.
Rework all functions to use generic calls.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agoma_xa_benchmark: Use user time. add rcu barrier before size calc.
Liam R. Howlett [Wed, 6 Feb 2019 20:23:25 +0000 (15:23 -0500)]
ma_xa_benchmark: Use user time. add rcu barrier before size calc.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agoma_xa_benchmark: Initial push
Liam R. Howlett [Tue, 5 Feb 2019 17:30:13 +0000 (12:30 -0500)]
ma_xa_benchmark: Initial push

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: remove duplicate function.
Liam R. Howlett [Tue, 5 Feb 2019 15:23:16 +0000 (10:23 -0500)]
maple_tree: remove duplicate function.

When adding a check for reserved entries, I hadn't noticed it already
existed.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agotest_maple_tree: Fix comments & add more tests.
Liam R. Howlett [Fri, 1 Feb 2019 19:22:25 +0000 (14:22 -0500)]
test_maple_tree: Fix comments & add more tests.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Fix split & insert to use last slot.
Liam R. Howlett [Fri, 1 Feb 2019 19:21:33 +0000 (14:21 -0500)]
maple_tree: Fix split & insert to use last slot.

The last slot was revealed to be NULL always.  Fix this by changing the
the end calculations and to ensure it is okay to use the final slot.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Drop depth from split operation.
Liam R. Howlett [Fri, 1 Feb 2019 18:09:56 +0000 (13:09 -0500)]
maple_tree: Drop depth from split operation.

It is not used.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Fix root bit & parent type.
Liam R. Howlett [Fri, 1 Feb 2019 18:00:47 +0000 (13:00 -0500)]
maple_tree: Fix root bit & parent type.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: fix goto lables in ma_insert
Liam R. Howlett [Fri, 1 Feb 2019 00:30:44 +0000 (19:30 -0500)]
maple_tree: fix goto lables in ma_insert

Fix the order of goto labels and set the error correct if using exists.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Add root expand to node if the single entry ends in 10.
Liam R. Howlett [Fri, 1 Feb 2019 00:28:50 +0000 (19:28 -0500)]
maple_tree: Add root expand to node if the single entry ends in 10.

As requested by page cache.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Change mask calc for mt_parent_type
Liam R. Howlett [Fri, 1 Feb 2019 00:28:10 +0000 (19:28 -0500)]
maple_tree: Change mask calc for mt_parent_type

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Remove depth from ma_split.
Liam R. Howlett [Thu, 31 Jan 2019 16:18:46 +0000 (11:18 -0500)]
maple_tree: Remove depth from ma_split.

the depth is no longer use, so drop it.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agoThoughts: Add table of bits in the parent.
Liam R. Howlett [Thu, 31 Jan 2019 16:15:05 +0000 (11:15 -0500)]
Thoughts: Add table of bits in the parent.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Fix parent definitions & fallout from ULONG_MAX ending.
Liam R. Howlett [Thu, 31 Jan 2019 16:11:13 +0000 (11:11 -0500)]
maple_tree: Fix parent definitions & fallout from ULONG_MAX ending.

coalesce needed to be updated for ULONG_MAX endings.
ma_copy needed to check for ULONG_MAX ending.
ma_encoded_parent no longer updates the ma_state limits.
adopt_children needed the encoded node passed in for the node type to
encode in the parent of the children.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agotest_maple_tree: Add seqential test for adding 1000 entries
Liam R. Howlett [Thu, 31 Jan 2019 15:53:33 +0000 (10:53 -0500)]
test_maple_tree: Add seqential test for adding 1000 entries

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Add comment about encode parent.
Liam R. Howlett [Wed, 30 Jan 2019 14:38:56 +0000 (09:38 -0500)]
maple_tree: Add comment about encode parent.

function name seems to lack description

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Move mas_update_limits
Liam R. Howlett [Tue, 29 Jan 2019 20:53:03 +0000 (15:53 -0500)]
maple_tree: Move mas_update_limits

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Small cleanup of code and comments
Liam R. Howlett [Tue, 29 Jan 2019 20:28:36 +0000 (15:28 -0500)]
maple_tree: Small cleanup of code and comments

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Fix error in splitting on the right side
Liam R. Howlett [Tue, 29 Jan 2019 20:06:00 +0000 (15:06 -0500)]
maple_tree: Fix error in splitting on the right side

When splitting on the right side, there were a number of logical
errors:
1. Finding the parents type needed the parent to be encoded, so move the
logic to a location better suited to use the encoded node.
2. ma_copy had an incorrect range (off by one).
3. mt_replace was not using the encoded node to find the parent's slot.
This would always return zero.
4. ma_link had a potential overflow in the pivot.
5. The ma_state's min/max was not being updated and so the pivots were
not always correct when using the min/max.
6. The data end detection needed to be updated to also check for
ULONG_MAX.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agotest_maple_tree: port nomem thread race test.
Liam R. Howlett [Mon, 28 Jan 2019 19:08:29 +0000 (14:08 -0500)]
test_maple_tree: port nomem thread race test.

Test to see that allocations work when two threads are racing.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Change return type of ma_insert.
Liam R. Howlett [Mon, 28 Jan 2019 19:07:04 +0000 (14:07 -0500)]
maple_tree: Change return type of ma_insert.

ma_insert was returning a pointer in the old API.  This is no longer
needed.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agotest_maple_tree: Re-implement old allocation tests for new API.
Liam R. Howlett [Mon, 28 Jan 2019 18:30:15 +0000 (13:30 -0500)]
test_maple_tree: Re-implement old allocation tests for new API.

Rewrite the allocation tests for maple2 rewrite.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agotesting: Fix bug in allocation tests for radix-tree linux.
Liam R. Howlett [Mon, 28 Jan 2019 18:29:01 +0000 (13:29 -0500)]
testing: Fix bug in allocation tests for radix-tree linux.

When initializing kmem_cache for testing, ensure non_kernel is
initialized to zero.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agotest_maple_tree: Fix compile warning
Liam R. Howlett [Mon, 28 Jan 2019 15:21:11 +0000 (10:21 -0500)]
test_maple_tree: Fix compile warning

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Clean up erase function.
Liam R. Howlett [Fri, 25 Jan 2019 21:03:21 +0000 (16:03 -0500)]
maple_tree: Clean up erase function.

The node type is set during the partial copy of data operation now.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Remove enc_full and just use mas->node.
Liam R. Howlett [Fri, 25 Jan 2019 20:49:28 +0000 (15:49 -0500)]
maple_tree: Remove enc_full and just use mas->node.

No need for this variable in mas_split.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Load safe root to mas->node in encoded_parent
Liam R. Howlett [Fri, 25 Jan 2019 20:43:38 +0000 (15:43 -0500)]
maple_tree: Load safe root to mas->node in encoded_parent

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Code clean up.
Liam R. Howlett [Fri, 25 Jan 2019 20:34:15 +0000 (15:34 -0500)]
maple_tree: Code clean up.

Drop unused variables & a fuction left from development of split

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Fix dump debug code when the last slot is null.
Liam R. Howlett [Tue, 22 Jan 2019 15:14:38 +0000 (10:14 -0500)]
maple_tree: Fix dump debug code when the last slot is null.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_node: Fix comments
Liam R. Howlett [Fri, 18 Jan 2019 19:46:54 +0000 (14:46 -0500)]
maple_node: Fix comments

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Split support
Liam R. Howlett [Fri, 18 Jan 2019 15:55:38 +0000 (10:55 -0500)]
maple_tree: Split support

Initial split support.  Walks up the tree splitting as necessary to
support the addition of a node.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
5 years agomaple_tree: Rearrange _ma_insert for appends.
Liam R. Howlett [Tue, 15 Jan 2019 16:17:00 +0000 (11:17 -0500)]
maple_tree: Rearrange _ma_insert for appends.

Reorder and make _ma_insert append safe and prepare for split.

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