From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C30E747F764 for ; Thu, 1 Oct 2026 13:29:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790861345; cv=none; b=uzCoFE7XI5dFiMlQ/KvU3UV50clAf2ay2zEPM0Y5xiKS7UlyOR7AK7IJx3rhCbDxzQdtJVIipg05Hteg3fsO/jfRxaI84SuuyTOGQNGbFit1wuiaI/827/yT4O61Y/GXn8uy6SOraEstCiPXhz99D20YhWop+k8DIRajQXrMZWc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790861345; c=relaxed/simple; bh=W5Z61Nq5ztKiixSzOg/KI+CWrMFLg5vyI2wky8v9fwc=; h=Content-Type:Date:Message-Id:Cc:Subject:From:To:In-Reply-To: References:MIME-Version; b=TT8LLeiBuYjtJpJ9dojwegMP7M7av/PeXHeP/4F+F0TWMaWfJAlfolpZKZDqlYqapfWxcMZJQMXHZy2xO1ecJTp5LLSmtebDFW/i762vBCgYAdIRl6HZoo0cSdVWcpKebKU/YIO+PzljKtdUuvrRhv3qc0wMwxQ2GYNDz2gKmQg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=p+dPQ6Ip; arc=none smtp.client-ip=209.85.215.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="p+dPQ6Ip" Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-cbedd5aece4so230846a12.0 for ; Thu, 01 Oct 2026 06:29:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790861343; x=1791466143; darn=vger.kernel.org; h=mime-version:content-transfer-encoding:references:in-reply-to:to :from:subject:cc:message-id:date:content-type:from:to:cc:subject :date:message-id:reply-to:content-type; bh=41trAFy/D/tRuSshg4paU2rmIdPH/gR2P5hv3iAAWQ4=; b=p+dPQ6IphpwIxRgcwWEZEA2sA7DrF0VLrDqOYBO8qziVvYdxIuDfAyjWtp8Wa9RPqM KH4q4SAzVOMaj+JRkfrXeb71FkAekMj4+IcaWrp7Qnf/5WPlWy4L6VItMpzzO0GYIe3d 4nl2tUjcjHnqlqpowD1oIU2/TaAGgklhtV1q8DeoeTULFaAAcS2YyDFCEd8vpRVt5ONU xOaMV1iXUneSZGBacoaiWxG7UPP9vlJstglZNnNgBVfSeCU3YTVs2OcS0RpRoYyFSvCQ Ia8kJ52zq2rof+1MaM4VJEjWsIXCuZc+x/8AQwLpXax4YYICLyvGL1o1fYi7FUzcgJF0 BPWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790861343; x=1791466143; h=mime-version:content-transfer-encoding:references:in-reply-to:to :from:subject:cc:message-id:date:content-type:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=41trAFy/D/tRuSshg4paU2rmIdPH/gR2P5hv3iAAWQ4=; b=oH2tEzNAreHfm7rg8Nfp/HBl0e6sXpsGQWzMbiyuHHTf8jxqtgRa9Vn695fy3mnqgp 1JU+IuWfvVilWnMUqoA9OSjzg3+qsiXXMAxEIoq6fmJMU30n62YoAMj0WLwy+uDHDLZC GvuqQEelBlbpmL61mub5gAhWAXgclTV0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:396d with SMTP id adf61e73a8af0-3deace089c9mr2562419637.49.1790861342684; Thu, 01 Oct 2026 06:29:02 -0700 (PDT) Received: from localhost ([153.61.198.250]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cc7e5285aa8sm1549511a12.0.2026.10.01.06.29.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Oct 2026 06:29:02 -0700 (PDT) Content-Type: text/plain; charset=UTF-8 Date: Thu, 01 Oct 2026 13:29:01 +0000 Message-Id: Cc: "Eduard Zingerman" , "Kumar Kartikeya Dwivedi" , "Martin KaFai Lau" , "Song Liu" , "Yonghong Song" , "Jiri Olsa" , "Emil Tsalapatis" , "Ihor Solodrai" , "Amery Hung" , "Tejun Heo" , "Meta kernel team" , , , , "Yafang Shao" Subject: Re: [PATCH] bpf, cgroup: fix cgroup struct_ops query for a second attach type From: "Alexei Starovoitov" To: "Shakeel Butt" , "Daniel Borkmann" , "John Fastabend" , "Andrii Nakryiko" In-Reply-To: <20260930135159.3926039-1-shakeel.butt@linux.dev> References: <20260930135159.3926039-1-shakeel.butt@linux.dev> X-Mailer: mkdraft (claude review draft; edit before sending) Content-Transfer-Encoding: 8bit Precedence: bulk X-Mailing-List: cgroups@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Wed, Sep 30, 2026 at 06:51 AM Shakeel Butt wrote: > +#define cgroup_bpf_enabled_runtime(atype) \ > + static_key_enabled(&cgroup_bpf_enabled_key[atype]) [...] > @@ -1448,7 +1449,7 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, > return -ENOENT; > from_atype = to_atype = atype; > flags = 0; > - if (!cgroup_bpf_enabled(atype)) > + if (!cgroup_bpf_enabled_runtime(atype)) > goto skip_count; No need for a new macro. When the key is off nothing is attached, so progs[atype] and effective[atype] are empty and the loop below leaves total_cnt at 0. All other attach types go through that loop without such check. Just drop the check and the skip_count label. pw-bot: cr