From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexei Starovoitov Subject: Re: [PATCH v4 bpf-next 1/6] bpf: Define cgroup_bpf_enabled for CONFIG_CGROUP_BPF=n Date: Fri, 25 May 2018 09:29:11 -0700 Message-ID: <20180525162909.rcdopnt56sbif7bt@ast-mbp> References: <677e2ddff0a1ff3d19ceb897e68f86e0246526a7.1527263217.git.rdna@fb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, davem@davemloft.net, kafai@fb.com, ast@kernel.org, daniel@iogearbox.net, kernel-team@fb.com To: Andrey Ignatov Return-path: Received: from mail-pl0-f66.google.com ([209.85.160.66]:38057 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967114AbeEYQ3P (ORCPT ); Fri, 25 May 2018 12:29:15 -0400 Received: by mail-pl0-f66.google.com with SMTP id c11-v6so3444591plr.5 for ; Fri, 25 May 2018 09:29:15 -0700 (PDT) Content-Disposition: inline In-Reply-To: <677e2ddff0a1ff3d19ceb897e68f86e0246526a7.1527263217.git.rdna@fb.com> Sender: netdev-owner@vger.kernel.org List-ID: On Fri, May 25, 2018 at 08:55:22AM -0700, Andrey Ignatov wrote: > 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: Andrey Ignatov Acked-by: Alexei Starovoitov