Re: [PATCH] radix tree test suite: put definition of bitmap_clear() into lib/bitmap.c
From: Yury Norov
Date: Wed Jul 10 2024 - 12:45:08 EST
On Wed, Jul 10, 2024 at 04:31:34PM +0000, Wei Yang wrote:
> On Wed, Jul 10, 2024 at 09:17:00AM -0700, Yury Norov wrote:
> >On Wed, Jul 10, 2024 at 09:55:54AM +0000, Wei Yang wrote:
> >> Instead of keeping a bitmap.c in radix-tree own directory, we can use
> >> the common implementation in lib/ directory.
> >>
> >> Just move the definition and link some related libs, no functional
> >> change.
> >>
> >> Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx>
> >> CC: Matthew Wilcox <willy@xxxxxxxxxxxxx>
> >
> >Hi Wei,
> >
> >bitmap_clear() is not used in radix tests, and in fact not used
> >anywhere in tools at all. Unless you have plans on it, it's
> >better to drop bitmap_clear() from tools, instead of bloating
> >the library.
>
> I guess you didn't try to compile the test. After remove the bitmap_clear(),
> we see this error.
No, I didn't.
> cc -fsanitize=address -fsanitize=undefined main.o xarray.o radix-tree.o idr.o linux.o test.o maple.o slab.o find_bit.o bitmap.o hweight.o vsprintf.o regression1.o regression2.o regression3.o regression4.o tag_check.o multiorder.o idr-test.o iteration_check.o iteration_check_2.o benchmark.o -lpthread -lurcu -o main
> /usr/bin/ld: xarray.o: in function `xas_squash_marks':
> /home/richard/git/linux/tools/testing/radix-tree/../../../lib/xarray.c:139: undefined reference to `bitmap_clear'
Ok then. If xarray userspace test pulls code directly from kernel
part, we still need bitmap_clear.
Since the function was introduced, we wrote an inline version of
it. We usually try to keep tools implementation synced with the
mother kernel, particularly for extra testing coverage.
Can you please send a v2 that syncs tools implementation with the
kernel one, and can you also mention how it is used in the code,
so those lazy folks like me will not get fooled with grep.
Thanks,
Yury