From: Mateusz Nosek <mateusznosek0@xxxxxxxxx> By small refactoring two 'unlikely' branches are changed so that if not one of them is true then only one branch occurs in 'likely' path of the function in question. Change verified in assembly generated by gcc 8.3.0. Signed-off-by: Mateusz Nosek <mateusznosek0@xxxxxxxxx> --- mm/slab.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/slab.c b/mm/slab.c index 2cb494d98fe9..e04ea756bcbc 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -4186,9 +4186,10 @@ size_t __ksize(const void *objp) struct kmem_cache *c; size_t size; - BUG_ON(!objp); - if (unlikely(objp == ZERO_SIZE_PTR)) + if (unlikely(ZERO_OR_NULL_PTR(objp))) { + BUG_ON(!objp); return 0; + } c = virt_to_cache(objp); size = c ? c->object_size : 0; -- 2.20.1