Re: [PATCH 05/23] selftest: vm: add unlikely() to BUG_ON()
From: Dmitry Safonov
Date: Thu Aug 30 2018 - 18:57:59 EST
Hi Igor,
On Fri, 2018-08-31 at 01:34 +0300, Igor Stoppa wrote:
> BUG_ON() is unlikely() to BUG()
This selftest runs in userspace..
So, we should define the macro somehow, as i.e:
rseq/rseq.h:#define rseq_unlikely(x) __builtin_expect(!!(x), 0)
Otherwise,
[selftests]$ make vm/map_populate
cc vm/map_populate.c -o vm/map_populate
vm/map_populate.c: In function âparent_fâ:
vm/map_populate.c:26:7: warning: implicit declaration of function
âunlikelyâ; did you mean âunlinkatâ? [-Wimplicit-function-declaration]
if (unlikely(condition)) { \
^
vm/map_populate.c:38:2: note: in expansion of macro âBUG_ONâ
BUG_ON(ret <= 0, "read(sock)");
^~~~~~
/tmp/cc7evGVG.o: In function `parent_f':
map_populate.c:(.text+0x3d): undefined reference to `unlikely'
map_populate.c:(.text+0xbb): undefined reference to `unlikely'
map_populate.c:(.text+0x135): undefined reference to `unlikely'
map_populate.c:(.text+0x1b0): undefined reference to `unlikely'
Not sure if we care for this at all for userspace test.
I don't mind as it runs each time by kbuild robot and cumulatively may
save something. But it's better be at least compile-tested.
--
Dima