[PATCH v2 1/2] lib/htree: Add locking interface to new Hash Tree

JaeJoon Jung rgbi3307 at gmail.com
Tue Aug 6 19:24:18 PDT 2024


Hello, Pedro Falcato
----------------------------
Thank you for your advice.
Hash Tree is a new implementation and does not have any users yet.
And it will likely take some time for many people to recognize and
demonstrate its superiority.

Hello, Darrick J. Wong
------------------------------
rhashtable was coded using the structure below,
struct rhash_head
struct rhashtable
It doesn't seem to be a Linux Kernel standard API.

And, as for the Rosebush you mentioned, I checked the related
information in the link below.
https://lore.kernel.org/lkml/20240222203726.1101861-1-willy@infradead.org/

I think "Matthew Wilcox" who developed this would be well aware of this.
Since he developed XArray which is currently running in the kernel, I
would appreciate his advice.


Hello, lsahn at wewakecorp.com
------------------------------------------
The Hash Tree I implemented uses HTREE_HASH_KEY to keep the tree balanced.
You can check the macro below in include/linux/htree.h.

#define HTREE_HASH_KEY(idx, d, bits)    ( sizeof(idx) <= 4 ?    \
        (((u32)idx + d) * htgr32[d]) >> (32 - bits) :           \
        (((u64)idx + d) * htgr64[d]) >> (64 - bits) )

The hash keys are distributed using each GOLDEN RATIO value at each
depth of the tree.
The standard deviation of the hash key is less than 4.
The function that tests and computes this is _htree_hash_dev() in the
lib/htree-test.c

Thanks.
>From JaeJoon Jung

On Wed, 7 Aug 2024 at 10:42, <lsahn at wewakecorp.com> wrote:
>
>
>
> > -----Original Message-----
> > From: owner-linux-mm at kvack.org <owner-linux-mm at kvack.org> On Behalf Of
> > JaeJoon Jung
> > Sent: Wednesday, August 7, 2024 9:22 AM
> > To: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
> > Cc: Linus Torvalds <torvalds at linux-foundation.org>; Sasha Levin
> > <levinsasha928 at gmail.com>; Liam R . Howlett <Liam.Howlett at oracle.com>;
> > Matthew Wilcox <willy at infradead.org>; linux-kernel at vger.kernel.org; linux-
> > mm at kvack.org; maple-tree at lists.infradead.org; linux-
> > fsdevel at vger.kernel.org
> > Subject: Re: [PATCH v2 1/2] lib/htree: Add locking interface to new Hash
> > Tree
>
> ...
>
> > The Hash Tree I implemented manages the Tree with the characteristic
> > of a hash that is accessed in O(1).
> > Even if the tree gets deeper, the search time does not increase.
> > There is no rotation cost because the tree is kept balanced by hash key.
>
> How does it keep balancing?
>



More information about the maple-tree mailing list