Re: [PATCH v5 1/2] mm: introduce helper to check slub_debug_enabled

From
Matthew Wilcox <willy@infradead.org>
Date
2021-07-05 03:20:50
Also in
linux-mediatek, linux-mm, lkml
Reply to
unknown sender, 2021-07-05
On Mon, Jul 05, 2021 at 10:40:57AM +0800, yee.lee@mediatek.com wrote:
From: Marco Elver <elver@google.com>

Introduce a helper to check slub_debug_enabled, so that we can confine
the use of #ifdef to the definition of the slub_debug_enabled_unlikely()
helper.
We don't usually embed '_unlikely' in function names; we
just do:

static inline bool slub_debug_enabled(void)
{
	return static_branch_unlikely(&slub_debug_enabled);
}

eg:

static inline bool cpusets_enabled(void)
{
        return static_branch_unlikely(&cpusets_enabled_key);
}

#define cgroup_bpf_enabled(type) static_branch_unlikely(&cgroup_bpf_enabled_key[type])

static inline int ip_tunnel_collect_metadata(void)
{
        return static_branch_unlikely(&ip_tunnel_metadata_cnt);
}

static inline bool frontswap_enabled(void)
{
        return static_branch_unlikely(&frontswap_enabled_key);
}


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Thread (5 messages) 5 messages, 3 authors, last reply 2021-07-05
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help