X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=rcuja%2Frcuja.c;h=348789e420f97c7621aab153b324179dff3669f8;hb=ff38c745ac5ceb485eed6b9e662a9e25d6d12731;hp=8d3bfd70ea64ecaf9264f380adb9a14ccc8d35ac;hpb=d68c6810e2b7b5e9feed2b8af8a84cb1b4ce744d;p=userspace-rcu.git diff --git a/rcuja/rcuja.c b/rcuja/rcuja.c index 8d3bfd7..348789e 100644 --- a/rcuja/rcuja.c +++ b/rcuja/rcuja.c @@ -21,32 +21,39 @@ */ #include +#include #include #include #include #include #include +#include + #include "rcuja-internal.h" #include "bitfield.h" enum rcu_ja_type_class { RCU_JA_LINEAR = 0, /* Type A */ - /* 32-bit: 1 to 12 children, 8 to 64 bytes */ - /* 64-bit: 1 to 14 children, 16 to 128 bytes */ - RCU_JA_BITMAP = 1, /* Type B */ - /* 32-bit: 13 to 120 children, 128 to 512 bytes */ - /* 64-bit: 15 to 124 children, 256 to 1024 bytes */ + /* 32-bit: 1 to 25 children, 8 to 128 bytes */ + /* 64-bit: 1 to 28 children, 16 to 256 bytes */ + RCU_JA_POOL = 1, /* Type B */ + /* 32-bit: 26 to 100 children, 256 to 512 bytes */ + /* 64-bit: 29 to 112 children, 512 to 1024 bytes */ RCU_JA_PIGEON = 2, /* Type C */ - /* 32-bit: 121 to 256 children, 1024 bytes */ - /* 64-bit: 125 to 256 children, 2048 bytes */ + /* 32-bit: 101 to 256 children, 1024 bytes */ + /* 64-bit: 113 to 256 children, 2048 bytes */ /* Leaf nodes are implicit from their height in the tree */ + RCU_JA_NR_TYPES, }; struct rcu_ja_type { enum rcu_ja_type_class type_class; - uint16_t min_child; /* minimum number of children: 1 to 256 */ - uint16_t max_child; /* maximum number of children: 1 to 256 */ - uint16_t order; /* node size is (1 << order), in bytes */ + uint16_t min_child; /* minimum number of children: 1 to 256 */ + uint16_t max_child; /* maximum number of children: 1 to 256 */ + uint16_t max_linear_child; /* per-pool max nr. children: 1 to 256 */ + uint16_t order; /* node size is (1 << order), in bytes */ + uint16_t nr_pool_order; /* number of pools */ + uint16_t pool_size_order; /* pool size */ }; /* @@ -70,58 +77,170 @@ struct rcu_ja_type { * The node the index within the following arrays is represented on 3 * bits. It identifies the node type, min/max number of children, and * the size order. + * The max_child values for the RCU_JA_POOL below result from + * statistical approximation: over million populations, the max_child + * covers between 97% and 99% of the populations generated. Therefore, a + * fallback should exist to cover the rare extreme population unbalance + * cases, but it will not have a major impact on speed nor space + * consumption, since those are rare cases. */ #if (CAA_BITS_PER_LONG < 64) /* 32-bit pointers */ +enum { + ja_type_0_max_child = 1, + ja_type_1_max_child = 3, + ja_type_2_max_child = 6, + ja_type_3_max_child = 12, + ja_type_4_max_child = 25, + ja_type_5_max_child = 48, + ja_type_6_max_child = 92, + ja_type_7_max_child = 256, +}; + +enum { + ja_type_0_max_linear_child = 1, + ja_type_1_max_linear_child = 3, + ja_type_2_max_linear_child = 6, + ja_type_3_max_linear_child = 12, + ja_type_4_max_linear_child = 25, + ja_type_5_max_linear_child = 24, + ja_type_6_max_linear_child = 23, +}; + +enum { + ja_type_5_nr_pool_order = 1, + ja_type_6_nr_pool_order = 2, +}; + const struct rcu_ja_type ja_types[] = { - { .type_class = RCU_JA_LINEAR, .min_child = 1, .max_child = 1, .order = 3, }, - { .type_class = RCU_JA_LINEAR, .min_child = 1, .max_child = 3, .order = 4, }, - { .type_class = RCU_JA_LINEAR, .min_child = 3, .max_child = 6, .order = 5, }, - { .type_class = RCU_JA_LINEAR, .min_child = 4, .max_child = 12, .order = 6, }, + { .type_class = RCU_JA_LINEAR, .min_child = 1, .max_child = ja_type_0_max_child, .max_linear_child = ja_type_0_max_linear_child, .order = 3, }, + { .type_class = RCU_JA_LINEAR, .min_child = 1, .max_child = ja_type_1_max_child, .max_linear_child = ja_type_1_max_linear_child, .order = 4, }, + { .type_class = RCU_JA_LINEAR, .min_child = 3, .max_child = ja_type_2_max_child, .max_linear_child = ja_type_2_max_linear_child, .order = 5, }, + { .type_class = RCU_JA_LINEAR, .min_child = 4, .max_child = ja_type_3_max_child, .max_linear_child = ja_type_3_max_linear_child, .order = 6, }, + { .type_class = RCU_JA_LINEAR, .min_child = 10, .max_child = ja_type_4_max_child, .max_linear_child = ja_type_4_max_linear_child, .order = 7, }, - { .type_class = RCU_JA_BITMAP, .min_child = 10, .max_child = 24, .order = 7, }, - { .type_class = RCU_JA_BITMAP, .min_child = 20, .max_child = 56, .order = 8, }, - { .type_class = RCU_JA_BITMAP, .min_child = 46, .max_child = 120, .order = 9, }, + /* Pools may fill sooner than max_child */ + { .type_class = RCU_JA_POOL, .min_child = 20, .max_child = ja_type_5_max_child, .max_linear_child = ja_type_5_max_linear_child, .order = 8, .nr_pool_order = ja_type_5_nr_pool_order, .pool_size_order = 7, }, + { .type_class = RCU_JA_POOL, .min_child = 45, .max_child = ja_type_6_max_child, .max_linear_child = ja_type_6_max_linear_child, .order = 9, .nr_pool_order = ja_type_6_nr_pool_order, .pool_size_order = 7, }, - { .type_class = RCU_JA_PIGEON, .min_child = 100, .max_child = 256, .order = 10, }, + /* + * TODO: Upon node removal below min_child, if child pool is + * filled beyond capacity, we need to roll back to pigeon. + */ + { .type_class = RCU_JA_PIGEON, .min_child = 89, .max_child = ja_type_7_max_child, .order = 10, }, }; -CAA_BUILD_BUG_ON(CAA_ARRAY_SIZE(ja_types) > JA_TYPE_MAX_NR); #else /* !(CAA_BITS_PER_LONG < 64) */ /* 64-bit pointers */ +enum { + ja_type_0_max_child = 1, + ja_type_1_max_child = 3, + ja_type_2_max_child = 7, + ja_type_3_max_child = 14, + ja_type_4_max_child = 28, + ja_type_5_max_child = 54, + ja_type_6_max_child = 104, + ja_type_7_max_child = 256, +}; + +enum { + ja_type_0_max_linear_child = 1, + ja_type_1_max_linear_child = 3, + ja_type_2_max_linear_child = 7, + ja_type_3_max_linear_child = 14, + ja_type_4_max_linear_child = 28, + ja_type_5_max_linear_child = 27, + ja_type_6_max_linear_child = 26, +}; + +enum { + ja_type_5_nr_pool_order = 1, + ja_type_6_nr_pool_order = 2, +}; + const struct rcu_ja_type ja_types[] = { - { .type_class = RCU_JA_LINEAR, .min_child = 1, .max_child = 1, .order = 4, }, - { .type_class = RCU_JA_LINEAR, .min_child = 1, .max_child = 3, .order = 5, }, - { .type_class = RCU_JA_LINEAR, .min_child = 3, .max_child = 7, .order = 6, }, - { .type_class = RCU_JA_LINEAR, .min_child = 5, .max_child = 14, .order = 7, }, + { .type_class = RCU_JA_LINEAR, .min_child = 1, .max_child = ja_type_0_max_child, .max_linear_child = ja_type_0_max_linear_child, .order = 4, }, + { .type_class = RCU_JA_LINEAR, .min_child = 1, .max_child = ja_type_1_max_child, .max_linear_child = ja_type_1_max_linear_child, .order = 5, }, + { .type_class = RCU_JA_LINEAR, .min_child = 3, .max_child = ja_type_2_max_child, .max_linear_child = ja_type_2_max_linear_child, .order = 6, }, + { .type_class = RCU_JA_LINEAR, .min_child = 5, .max_child = ja_type_3_max_child, .max_linear_child = ja_type_3_max_linear_child, .order = 7, }, + { .type_class = RCU_JA_LINEAR, .min_child = 10, .max_child = ja_type_4_max_child, .max_linear_child = ja_type_4_max_linear_child, .order = 8, }, - { .type_class = RCU_JA_BITMAP, .min_child = 10, .max_child = 28, .order = 8, }, - { .type_class = RCU_JA_BITMAP, .min_child = 22, .max_child = 60, .order = 9, }, - { .type_class = RCU_JA_BITMAP, .min_child = 49, .max_child = 124, .order = 10, }, + /* Pools may fill sooner than max_child. */ + { .type_class = RCU_JA_POOL, .min_child = 22, .max_child = ja_type_5_max_child, .max_linear_child = ja_type_5_max_linear_child, .order = 9, .nr_pool_order = ja_type_5_nr_pool_order, .pool_size_order = 8, }, + { .type_class = RCU_JA_POOL, .min_child = 51, .max_child = ja_type_6_max_child, .max_linear_child = ja_type_6_max_linear_child, .order = 10, .nr_pool_order = ja_type_6_nr_pool_order, .pool_size_order = 8, }, - { .type_class = RCU_JA_PIGEON, .min_child = 102, .max_child = 256, .order = 11, }, + /* + * TODO: Upon node removal below min_child, if child pool is + * filled beyond capacity, we need to roll back to pigeon. + */ + { .type_class = RCU_JA_PIGEON, .min_child = 101, .max_child = ja_type_7_max_child, .order = 11, }, }; -CAA_BUILD_BUG_ON(CAA_ARRAY_SIZE(ja_types) > JA_TYPE_MAX_NR); #endif /* !(BITS_PER_LONG < 64) */ +static inline __attribute__((unused)) +void static_array_size_check(void) +{ + CAA_BUILD_BUG_ON(CAA_ARRAY_SIZE(ja_types) > JA_TYPE_MAX_NR); +} + +/* Never declared. Opaque type used to store flagged node pointers. */ +struct rcu_ja_node_flag; + /* - * The rcu_ja_node starts with a byte counting the number of children in - * the node. Then, the node-specific data is placed. - * TODO: where should we put the mutex for the node ? - * -> mutex could be a 0-value node count. - * TODO: where do we keep nr children for pigeon ? + * The rcu_ja_node contains the compressed node data needed for + * read-side. For linear and pool node configurations, it starts with a + * byte counting the number of children in the node. Then, the + * node-specific data is placed. + * The node mutex, if any is needed, protecting concurrent updated of + * each node is placed in a separate hash table indexed by node address. + * For the pigeon configuration, the number of children is also kept in + * a separate hash table, indexed by node address, because it is only + * required for updates. */ + +#define DECLARE_LINEAR_NODE(index) \ + struct { \ + uint8_t nr_child; \ + uint8_t child_value[ja_type_## index ##_max_linear_child]; \ + struct rcu_ja_node_flag *child_ptr[ja_type_## index ##_max_linear_child]; \ + } + +#define DECLARE_POOL_NODE(index) \ + struct { \ + struct { \ + uint8_t nr_child; \ + uint8_t child_value[ja_type_## index ##_max_linear_child]; \ + struct rcu_ja_node_flag *child_ptr[ja_type_## index ##_max_linear_child]; \ + } linear[1U << ja_type_## index ##_nr_pool_order]; \ + } + struct rcu_ja_node { - char data[]; + union { + /* Linear configuration */ + DECLARE_LINEAR_NODE(0) conf_0; + DECLARE_LINEAR_NODE(1) conf_1; + DECLARE_LINEAR_NODE(2) conf_2; + DECLARE_LINEAR_NODE(3) conf_3; + DECLARE_LINEAR_NODE(4) conf_4; + + /* Pool configuration */ + DECLARE_POOL_NODE(5) conf_5; + DECLARE_POOL_NODE(6) conf_6; + + /* Pigeon configuration */ + struct { + struct rcu_ja_node_flag *child[ja_type_7_max_child]; + } conf_7; + /* data aliasing nodes for computed accesses */ + uint8_t data[sizeof(struct rcu_ja_node_flag *) * ja_type_7_max_child]; + } u; }; -/* Never declared. Opaque type used to store flagged node pointers. */ -struct rcu_ja_node_flag; - static -struct rcu_ja_node_flag *ja_node_flag(struct rcu_ja_node *node, unsigned int type) +struct rcu_ja_node_flag *ja_node_flag(struct rcu_ja_node *node, + unsigned int type) { - assert(type < JA_TYPE_NR); + assert(type < RCU_JA_NR_TYPES); return (struct rcu_ja_node_flag *) (((unsigned long) node) | type); } @@ -131,7 +250,7 @@ unsigned int ja_node_type(struct rcu_ja_node_flag *node) unsigned int type; type = (unsigned int) ((unsigned long) node & JA_TYPE_MASK); - assert(type < JA_TYPE_NR); + assert(type < RCU_JA_NR_TYPES); return type; } @@ -143,7 +262,7 @@ struct rcu_ja_node *ja_node_ptr(struct rcu_ja_node_flag *node) struct rcu_ja_node *alloc_rcu_ja_node(struct rcu_ja_type *ja_type) { - return zmalloc(1 << ja_type->node_order); + return calloc(1U << ja_type->order, sizeof(char)); } void free_rcu_ja_node(struct rcu_ja_node *node) @@ -151,48 +270,36 @@ void free_rcu_ja_node(struct rcu_ja_node *node) free(node); } -/* The bitmap for 256 entries is always 32 bytes */ -#define CHAR_BIT_SHIFT 3UL -#define CHAR_BIT_MASK ((1UL << CHAR_BIT_SHIFT) - 1) -#if (CHAR_BIT != (1UL << CHAR_BIT_SHIFT)) -#error "char size not supported." -#endif - -#define ULONG_BIT_MASK (CAA_BITS_PER_LONG - 1) - -#define JA_BITMAP_BITS JA_ENTRY_PER_NODE -#define JA_BITMAP_LEN (JA_BITMAP_BITS / CHAR_BIT) - #define __JA_ALIGN_MASK(v, mask) (((v) + (mask)) & ~(mask)) #define JA_ALIGN(v, align) __JA_ALIGN_MASK(v, (typeof(v)) (align) - 1) #define __JA_FLOOR_MASK(v, mask) ((v) & ~(mask)) #define JA_FLOOR(v, align) __JA_FLOOR_MASK(v, (typeof(v)) (align) - 1) static -char *align_ptr_size(char *ptr) +uint8_t *align_ptr_size(uint8_t *ptr) { - return JA_ALIGN(ptr, sizeof(ptr)); + return (uint8_t *) JA_ALIGN((unsigned long) ptr, sizeof(void *)); } static struct rcu_ja_node_flag *ja_linear_node_get_nth(const struct rcu_ja_type *type, - struct rcu_ja_node *node, - uint8_t n) + struct rcu_ja_node *node, + uint8_t n) { uint8_t nr_child; uint8_t *values; - struct rcu_ja_node_flag *pointers; + struct rcu_ja_node_flag **pointers; struct rcu_ja_node_flag *ptr; unsigned int i; - assert(type->type_class == RCU_JA_LINEAR); + assert(type->type_class == RCU_JA_LINEAR || type->type_class == RCU_JA_POOL); - nr_child = node->data[0]; + nr_child = node->u.data[0]; cmm_smp_rmb(); /* read nr_child before values */ - assert(nr_child <= type->max_child); - assert(nr_child >= type->min_child); + assert(nr_child <= type->max_linear_child); + assert(type->type_class != RCU_JA_LINEAR || nr_child >= type->min_child); - values = &node[1]; + values = &node->u.data[1]; for (i = 0; i < nr_child; i++) { if (values[i] == n) break; @@ -200,142 +307,138 @@ struct rcu_ja_node_flag *ja_linear_node_get_nth(const struct rcu_ja_type *type, if (i >= nr_child) return NULL; cmm_smp_rmb(); /* read values before pointer */ - pointers = align_ptr_size(&values[nr_child]); + pointers = (struct rcu_ja_node_flag **) align_ptr_size(&values[type->max_linear_child]); ptr = pointers[i]; assert(ja_node_ptr(ptr) != NULL); return ptr; } -#if 0 -/* - * Count hweight. Expect most bits to be 0. Algorithm from - * Wegner (1960): count those in n steps (n being the number of - * hot bits). Ref.: Wegner, Peter (1960), "A technique for - * counting ones in a binary computer", Communications of the - * ACM 3 (5): 322, doi:10.1145/367236.367286. - */ static -unsigned int ja_hweight_uchar(unsigned char value) +struct rcu_ja_node_flag *ja_pool_node_get_nth(const struct rcu_ja_type *type, + struct rcu_ja_node *node, + uint8_t n) { - unsigned int count = 0; + struct rcu_ja_node *linear; - for (; value; count++) - value &= value - 1; - return count; + assert(type->type_class == RCU_JA_POOL); + linear = (struct rcu_ja_node *) + &node->u.data[((unsigned long) n >> (CHAR_BIT - type->nr_pool_order)) << type->pool_size_order]; + return ja_linear_node_get_nth(type, linear, n); } -#endif //0 -#if (CAA_BITS_PER_LONG < 64) static -unsigned int ja_hweight_ulong(unsigned long value) +struct rcu_ja_node_flag *ja_pigeon_node_get_nth(const struct rcu_ja_type *type, + struct rcu_ja_node *node, + uint8_t n) { - unsigned long r; - - r = value; - r = r - ((r >> 1) & 0x55555555); - r = (r & 0x33333333) + ((r >> 2) & 0x33333333); - r += r >> 4; - r &= 0x0F0F0F0F; - r += r >> 8; - r += r >> 16; - r &= 0x000000FF; - return r; + assert(type->type_class == RCU_JA_PIGEON); + return ((struct rcu_ja_node_flag **) node->u.data)[n]; } -#else /* !(CAA_BITS_PER_LONG < 64) */ + +/* ja_node_get_nth: get nth item from a node */ static -unsigned int ja_hweight_ulong(unsigned long value) +struct rcu_ja_node_flag *ja_node_get_nth(struct rcu_ja_node_flag *node_flag, + uint8_t n) { - unsigned long r; - - r = value; - r = r - ((r >> 1) & 0x5555555555555555UL); - r = (r & 0x3333333333333333UL) + ((r >> 2) & 0x3333333333333333UL); - r += r >> 4; - r &= 0x0F0F0F0F0F0F0F0FUL; - r += r >> 8; - r += r >> 16; - r += r >> 32; - r &= 0x00000000000000FFUL; - return r; + unsigned int type_index; + struct rcu_ja_node *node; + const struct rcu_ja_type *type; + + node_flag = rcu_dereference(node_flag); + node = ja_node_ptr(node_flag); + assert(node != NULL); + type_index = ja_node_type(node_flag); + type = &ja_types[type_index]; + + switch (type->type_class) { + case RCU_JA_LINEAR: + return ja_linear_node_get_nth(type, node, n); + case RCU_JA_POOL: + return ja_pool_node_get_nth(type, node, n); + case RCU_JA_PIGEON: + return ja_pigeon_node_get_nth(type, node, n); + default: + assert(0); + return (void *) -1UL; + } } -#endif /* !(BITS_PER_LONG < 64) */ static -struct rcu_ja_node_flag *ja_bitmap_node_get_nth(const struct rcu_ja_type *type, - struct rcu_ja_node *node, - uint8_t n) +int ja_linear_node_set_nth(const struct rcu_ja_type *type, + struct rcu_ja_node *node, + uint8_t n, + struct rcu_ja_node_flag *child_node_flag) { - uint8_t *bitmap; - uint8_t byte_nr; - struct rcu_ja_node_flag *pointers; - struct rcu_ja_node_flag *ptr; - unsigned int count; + uint8_t nr_child; + uint8_t *values, *nr_child_ptr; + struct rcu_ja_node_flag **pointers; + unsigned int i; - assert(type->type_class == RCU_JA_BITMAP); + assert(type->type_class == RCU_JA_LINEAR || type->type_class == RCU_JA_POOL); - bitmap = &node->data[0]; - /* - * Check if n is hot in the bitmap. If yes, count the hweight - * prior to n, including n, to get the pointer index. - * The bitmap goes from least significant (0) to most - * significant (255) as bytes increase. - */ - byte_nr = n >> CHAR_BIT_SHIFT; - if (bitmap[byte_nr] & (1U << (n & CHAR_BIT_MASK))) { - uint8_t byte_iter; - unsigned long v; - - count = 0; - /* Count entire ulong prior to the one containing n */ - for (byte_iter = 0; byte_iter < JA_FLOOR(byte_nr, sizeof(unsigned long)); - byte_iter += sizeof(unsigned long)) { - v = *((unsigned long *) &bitmap[byte_iter]); - count += ja_hweight_ulong(v); - } - /* - * Read only the bits prior to and including n within - * the ulong containing n. ja_bitfield_read_le goes from - * less significant to most significant as bytes - * increase. - */ - ja_bitfield_read_le( - (unsigned long *) &bitmap[JA_FLOOR(byte_nr, sizeof(unsigned long))], - unsigned long, 0, (n & ULONG_BIT_MASK) + 1, - &v); - count += ja_hweight_ulong(v); - } else { - return NULL; + nr_child_ptr = &node->u.data[0]; + nr_child = *nr_child_ptr; + assert(nr_child <= type->max_linear_child); + assert(type->type_class != RCU_JA_LINEAR || nr_child >= type->min_child); + + values = &node->u.data[1]; + for (i = 0; i < nr_child; i++) { + if (values[i] == n) + return -EEXIST; + } + if (nr_child >= type->max_linear_child) { + /* No space left in this node type */ + return -ENOSPC; } + pointers = (struct rcu_ja_node_flag **) align_ptr_size(&values[type->max_linear_child]); + pointers[nr_child] = child_node_flag; + (*nr_child_ptr)++; + return 0; +} - assert(count <= type->max_child); - assert(count >= type->min_child); +static +int ja_pool_node_set_nth(const struct rcu_ja_type *type, + struct rcu_ja_node *node, + uint8_t n, + struct rcu_ja_node_flag *child_node_flag) +{ + struct rcu_ja_node *linear; - cmm_smp_rmb(); /* read bitmap before pointers */ - pointers = &bitmap[JA_BITMAP_LEN]; - ptr = pointers[count - 1]; - assert(ja_node_ptr(ptr) != NULL); - return ptr; + assert(type->type_class == RCU_JA_POOL); + linear = (struct rcu_ja_node *) + &node->u.data[((unsigned long) n >> (CHAR_BIT - type->nr_pool_order)) << type->pool_size_order]; + return ja_linear_node_set_nth(type, linear, n, child_node_flag); } static -struct rcu_ja_node_flag *ja_pigeon_node_get_nth(const struct rcu_ja_type *type, - struct rcu_ja_node *node, - uint8_t n) +int ja_pigeon_node_set_nth(const struct rcu_ja_type *type, + struct rcu_ja_node *node, + uint8_t n, + struct rcu_ja_node_flag *child_node_flag) { + struct rcu_ja_node_flag **ptr; + assert(type->type_class == RCU_JA_PIGEON); - return ((struct rcu_ja_node_flag *) node->data)[n]; + ptr = &((struct rcu_ja_node_flag **) node->u.data)[n]; + if (*ptr != NULL) + return -EEXIST; + rcu_assign_pointer(*ptr, child_node_flag); + return 0; } -/* ja_node_get_nth: get nth item from a node */ +/* + * ja_node_set_nth: set nth item within a node. Return an error + * (negative error value) if it is already there. + * TODO: exclusive access on node. + */ static -struct rcu_ja_node_flag *ja_node_get_nth(struct rcu_ja_node_flag *node_flag, - uint8_t n) +int ja_node_set_nth(struct rcu_ja_node_flag *node_flag, uint8_t n, + struct rcu_ja_node_flag *child_node_flag) { unsigned int type_index; struct rcu_ja_node *node; const struct rcu_ja_type *type; - node_flag = rcu_dereference(node_flag); node = ja_node_ptr(node_flag); assert(node != NULL); type_index = ja_node_type(node_flag); @@ -343,19 +446,18 @@ struct rcu_ja_node_flag *ja_node_get_nth(struct rcu_ja_node_flag *node_flag, switch (type->type_class) { case RCU_JA_LINEAR: - return ja_linear_node_get_nth(type, node, n); - case RCU_JA_BITMAP: - return ja_bitmap_node_get_nth(type, node, n); + return ja_linear_node_set_nth(type, node, n, + child_node_flag); + case RCU_JA_POOL: + return ja_pool_node_set_nth(type, node, n, + child_node_flag); case RCU_JA_PIGEON: - return ja_pigeon_node_get_nth(type, node, n); + return ja_pigeon_node_set_nth(type, node, n, + child_node_flag); default: assert(0); - return (void *) -1UL; + return -EINVAL; } -} - -/* - * ja_node_set_nth: set nth item within a node. asserts that it is not - * there yet. - */ + return 0; +}