lkml.org 
[lkml]   [2021]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 26/94] Maple Tree: Add new data structure

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.

\
 
 \ /
  Last update: 2021-05-14 13:00    [W:1.089 / U:1.820 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site