Thread (137 messages) 137 messages, 6 authors, 2021-05-31

Re: [PATCH 26/94] Maple Tree: Add new data structure

From: Peter Zijlstra <peterz@infradead.org>
Date: 2021-05-14 10:59:51
Also in: lkml

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help