]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
always inlined and such
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 29 Nov 2024 23:26:03 +0000 (18:26 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Sat, 30 Nov 2024 14:47:57 +0000 (09:47 -0500)
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c
lib/test_maple_tree.c

index abfddba63d245a448eb80a28aff4a30ed7ce2695..87ba8274391879cc7e087c9cbbcbbbbb00123ce0 100644 (file)
@@ -3193,7 +3193,7 @@ struct ma_node_state {
        bool alloc;
 };
 
-static inline
+static __always_inline
 void mns_node_part_leaf_init(struct ma_node_part *ma_part,
                struct ma_wr_state *wr_mas, struct ma_node_state *src)
 {
@@ -3242,7 +3242,7 @@ void mns_node_part_init(struct ma_node_part *ma_part,
        ma_part->skip = 1;
 }
 
-static inline
+static __always_inline
 void mns_insert_part(struct ma_node_part *part,
                struct ma_node_state *dst)
 {
@@ -3329,7 +3329,8 @@ void mns_mas_init(struct ma_node_state *mns, struct ma_state *mas)
  * @len: The number of offsets to copy
  *
  */
-static inline void mns_cp(struct ma_node_state *src, struct ma_node_state *dst,
+static __always_inline
+void mns_cp(struct ma_node_state *src, struct ma_node_state *dst,
                unsigned char len)
 {
        unsigned long max;
@@ -3345,7 +3346,6 @@ static inline void mns_cp(struct ma_node_state *src, struct ma_node_state *dst,
        if (src->gaps)
                memcpy(dst->gaps + dst->offset, src->gaps + src->offset, size);
 
-       BUG_ON(src->offset + len > mt_slots[src->type]);
        if (src->offset + len > mt_pivots[src->type]) {
                size = mt_pivots[src->type] - src->offset;
                max = src->max;
@@ -3376,7 +3376,8 @@ static inline void mns_cp(struct ma_node_state *src, struct ma_node_state *dst,
  * Zero any area that needs to be zeroed and set the metadata.
  * metadata needs the largest gap for non-leaves.
  */
-static inline void mns_finalise(struct ma_node_state *p)
+static __always_inline
+void mns_finalise(struct ma_node_state *p)
 {
        unsigned long max_gap;
        unsigned char len;
@@ -3402,6 +3403,8 @@ static inline void mns_finalise(struct ma_node_state *p)
                unsigned char offset;
                unsigned char i;
                unsigned long gap, pstart;
+               unsigned long *pivs;
+               void **slots;
 
                if (!p->alloc)
                        goto finalise_leaf;
@@ -3423,11 +3426,13 @@ static inline void mns_finalise(struct ma_node_state *p)
                                goto finalise_leaf;
                }
 
+               slots = p->slots;
+               pivs = p->pivots;
                /* Special case the first slot before the loop */
-               if (likely(!p->slots[0])) {
+               if (likely(!slots[0])) {
                        //printk("slot 0 is %p\n", p->slots[0]);
                        //printk("first slot check (%lu - %lu + 1\n", p->pivots[0], p->min);
-                       gap = p->pivots[0] - p->min + 1;
+                       gap = pivs[0] - p->min + 1;
                        if (gap > max_gap)
                                max_gap = gap;
                        //printk("gap is now %lu\n", max_gap);
@@ -3439,12 +3444,12 @@ static inline void mns_finalise(struct ma_node_state *p)
 
                for (; i <= offset; i++) {
                        /* data == no gap. */
-                       if (likely(p->slots[i]))
+                       if (slots[i])
                                continue;
 
                        //printk("empty slot at %u\n", i);
-                       pstart = p->pivots[i - 1];
-                       gap = p->pivots[i] - pstart;
+                       pstart = pivs[i - 1];
+                       gap = pivs[i] - pstart;
                        //printk("gap is %lu vs %lu\n", gap, max_gap);
                        if (gap > max_gap)
                                max_gap = gap;
@@ -4472,6 +4477,7 @@ done:
        trace_ma_write(__func__, mas, 0, wr_mas->entry);
        mas_update_gap(mas);
        mas->end = new_end;
+       //mt_dump(mas->tree, mt_dump_hex);
        return;
 }
 
index 396ff1176eedb3b716ccf93142756205e79d8666..bf2f9982ae42cda56b8c7b93c46cb0467c9c1e62 100644 (file)
@@ -40,7 +40,7 @@ atomic_t maple_tree_tests_passed;
 #endif
 
 /* #define BENCH_SLOT_STORE */
-/* #define BENCH_NODE_STORE */
+#define BENCH_NODE_STORE
 /* #define BENCH_AWALK */
 /* #define BENCH_WALK */
 /* #define BENCH_LOAD */
@@ -1831,7 +1831,7 @@ static noinline void __init bench_slot_store(struct maple_tree *mt)
 #if defined(BENCH_NODE_STORE)
 static noinline void __init bench_node_store(struct maple_tree *mt)
 {
-       int i, overwrite = 76, max = 240, count = 20000000;
+       int i, overwrite = 76, max = 240, count = 50000000;
 
        for (i = 0; i < max; i += 10)
                mtree_store_range(mt, i, i + 5, xa_mk_value(i), GFP_KERNEL);