On 03/06/2018 08:42 PM, Andrey Konovalov wrote:
>>> - if (s->flags & SLAB_KASAN && !(s->flags & SLAB_TYPESAFE_BY_RCU)) >>> - return; >>> - do_slab_free(s, page, head, tail, cnt, addr); >>> + slab_free_freelist_hook(s, &head, &tail); >>> + if (head != NULL) >> >> That's an additional branch in non-debug fast-path. Find a way to avoid this. > > Hm, there supposed to be a branch here. We either have objects that we > need to free, or we don't, and we need to do different things in those > cases. Previously this was done with a hardcoded "if (s->flags & > SLAB_KASAN && ..." statement, not it's a different "if (head != > NULL)". > They are different. "if (s->flags & SLAB_KASAN && ..." can be optimized away by compiler when CONFIG_KASAN=n, "if (head != NULL)" - can not.