• A
    bpf: Define cgroup_bpf_enabled for CONFIG_CGROUP_BPF=n · 13193b0f
    Andrey Ignatov 提交于
    Static key is used to enable/disable cgroup-bpf related code paths at
    run time.
    
    Though it's not defined when cgroup-bpf is disabled at compile time,
    i.e. CONFIG_CGROUP_BPF=n, and if some code wants to use it, it has to do
    this:
    
    	#ifdef CONFIG_CGROUP_BPF
    		if (cgroup_bpf_enabled) {
    			/* ... some work ... */
    		}
    	#endif
    
    This code can be simplified by setting cgroup_bpf_enabled to 0 for
    CONFIG_CGROUP_BPF=n case:
    
    	if (cgroup_bpf_enabled) {
    		/* ... some work ... */
    	}
    
    And it aligns well with existing BPF_CGROUP_RUN_PROG_* macros that
    defined for both states of CONFIG_CGROUP_BPF.
    Signed-off-by: NAndrey Ignatov <rdna@fb.com>
    Acked-by: NAlexei Starovoitov <ast@kernel.org>
    Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
    13193b0f
bpf-cgroup.h 6.9 KB