On Wed, Jan 03, 2018 at 01:39:27PM -0600, Christopher Lameter wrote: > +/* How many objects left in slab page */ > +unsigned kobjects_left_in_slab_page(const void *object) > +{ > + struct page *page; > + > + if (unlikely(ZERO_OR_NULL_PTR(object))) > + return 0; > + > + page = virt_to_head_page(object); > + > + if (unlikely(!PageSlab(page))) { > + WARN_ON(1); > + return 1; > + } I see this construct all over the kernel. Here's a better one: if (WARN_ON(!PageSlab(page))) return 1; There's a built-in unlikely() in the definition of WARN_ON, so this works nicely.