lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210514204440.ofwxmcdm6nrmur6m@revolver>
Date:   Fri, 14 May 2021 20:45:00 +0000
From:   Liam Howlett <liam.howlett@...cle.com>
To:     Peter Zijlstra <peterz@...radead.org>
CC:     "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Song Liu <songliubraving@...com>,
        Davidlohr Bueso <dave@...olabs.net>,
        "Paul E . McKenney" <paulmck@...nel.org>,
        Matthew Wilcox <willy@...radead.org>,
        Laurent Dufour <ldufour@...ux.ibm.com>,
        David Rientjes <rientjes@...gle.com>,
        Axel Rasmussen <axelrasmussen@...gle.com>,
        Suren Baghdasaryan <surenb@...gle.com>,
        Vlastimil Babka <vbabka@...e.cz>,
        Rik van Riel <riel@...riel.com>,
        Michel Lespinasse <walken.cr@...il.com>
Subject: Re: [PATCH 26/94] Maple Tree: Add new data structure

* Peter Zijlstra <peterz@...radead.org> [210514 06:58]:
> 
> Cc'ing a moderated list is sodding annoying, dropped it.
> 
> On Wed, Apr 28, 2021 at 03:36:02PM +0000, Liam Howlett wrote:
> 
> > +struct maple_range_64 {
> > +	struct maple_pnode *parent;
> > +	unsigned long pivot[MAPLE_RANGE64_SLOTS - 1];
> > +	void __rcu *slot[MAPLE_RANGE64_SLOTS];
> > +};
> > +
> > +struct maple_arange_64 {
> > +	struct maple_pnode *parent;
> > +	unsigned long pivot[MAPLE_ARANGE64_SLOTS - 1];
> > +	void __rcu *slot[MAPLE_ARANGE64_SLOTS];
> > +	unsigned long gap[MAPLE_ARANGE64_SLOTS];
> > +	unsigned char meta;
> > +};
> > +
> > +struct maple_alloc {
> > +	unsigned long total;
> > +	unsigned char node_count;
> > +	unsigned int request_count;
> > +	struct maple_alloc *slot[MAPLE_ALLOC_SLOTS];
> > +};
> > +
> > +struct maple_topiary {
> > +	struct maple_pnode *parent;
> > +	struct maple_enode *next; /* Overlaps the pivot */
> > +};
> > +
> > +enum maple_type {
> > +	maple_dense,
> > +	maple_leaf_64,
> > +	maple_range_64,
> > +	maple_arange_64,
> > +};
> 
> > +struct maple_node {
> > +	union {
> > +		struct {
> > +			struct maple_pnode *parent;
> > +			void __rcu *slot[MAPLE_NODE_SLOTS];
> > +		};
> > +		struct {
> > +			void *pad;
> > +			struct rcu_head rcu;
> > +			unsigned int ma_flags;
> > +			enum maple_type type;
> > +		};
> > +		struct maple_range_64 mr64;
> > +		struct maple_arange_64 ma64;
> > +		struct maple_alloc alloc;
> > +	};
> > +};
> 
> This is somewhat inconsistent; would it make sense to have struct
> maple_dense and struct maple_leaf_64, and maybe even struct maple_free,
> such that one can write:
> 
> struct maple_node {
> 	union {
> 		/* maple_type: */
> 		struct maple_dense	md;
> 		struct maple_leaf_64	ml64;
> 		struct maple_range_64	mr64;
> 		struct maple_arange_64	ma64;
> 
> 		/* internal, life-time: */
> 		struct maple_alloc	alloc;
> 		struct maple_free	free;
> 	};
> };
> 
> Or something along those lines.
> 

The problem I am solving with the anon structs is the resulting C code
looks much cleaner with the anon structs.  I could make #defines or
small inline helpers to make the other side pretty, but at the expense
of readability imo.  What do you think?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ