Skip to content

Commit c6ce3e2

Browse files
rehassachdevaMatthew Wilcox
authored andcommitted
radix tree test suite: Add config option for map shift
Add config option "SHIFT=<value>" to Makefile for building test suite with any value of RADIX_TREE_MAP_SHIFT between 3 and 7 inclusive. Signed-off-by: Rehas Sachdeva <[email protected]> [[email protected]: .gitignore, quieten grep, remove on clean] Signed-off-by: Matthew Wilcox <[email protected]>
1 parent 7e73eb0 commit c6ce3e2

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

tools/testing/radix-tree/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
generated/map-shift.h
12
idr.c
23
idr-test
34
main

tools/testing/radix-tree/Makefile

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ CORE_OFILES := radix-tree.o idr.o linux.o test.o find_bit.o
66
OFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \
77
tag_check.o multiorder.o idr-test.o iteration_check.o benchmark.o
88

9-
ifdef BENCHMARK
10-
CFLAGS += -DBENCHMARK=1
9+
ifndef SHIFT
10+
SHIFT=3
1111
endif
1212

13-
targets: $(TARGETS)
13+
targets: mapshift $(TARGETS)
1414

1515
main: $(OFILES)
1616
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o main
@@ -22,11 +22,11 @@ multiorder: multiorder.o $(CORE_OFILES)
2222
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o multiorder
2323

2424
clean:
25-
$(RM) $(TARGETS) *.o radix-tree.c idr.c
25+
$(RM) $(TARGETS) *.o radix-tree.c idr.c generated/map-shift.h
2626

2727
vpath %.c ../../lib
2828

29-
$(OFILES): *.h */*.h \
29+
$(OFILES): *.h */*.h generated/map-shift.h \
3030
../../include/linux/*.h \
3131
../../include/asm/*.h \
3232
../../../include/linux/radix-tree.h \
@@ -37,3 +37,11 @@ radix-tree.c: ../../../lib/radix-tree.c
3737

3838
idr.c: ../../../lib/idr.c
3939
sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@
40+
41+
.PHONY: mapshift
42+
43+
mapshift:
44+
@if ! grep -qw $(SHIFT) generated/map-shift.h; then \
45+
echo "#define RADIX_TREE_MAP_SHIFT $(SHIFT)" > \
46+
generated/map-shift.h; \
47+
fi

tools/testing/radix-tree/linux/kernel.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212
#include <linux/log2.h>
1313
#include "../../../include/linux/kconfig.h"
1414

15-
#ifdef BENCHMARK
16-
#define RADIX_TREE_MAP_SHIFT 6
17-
#else
18-
#define RADIX_TREE_MAP_SHIFT 3
19-
#endif
20-
2115
#define printk printf
2216
#define pr_debug printk
2317
#define pr_cont printk

tools/testing/radix-tree/linux/radix-tree.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#ifndef _TEST_RADIX_TREE_H
22
#define _TEST_RADIX_TREE_H
3+
4+
#include "generated/map-shift.h"
35
#include "../../../../include/linux/radix-tree.h"
46

57
extern int kmalloc_verbose;

0 commit comments

Comments
 (0)