mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tao Chen <chen.dylane@linux.dev>
To: Jakub Sitnicki <jakub@cloudflare.com>
Cc: daniel@iogearbox.net, razor@blackwall.org, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, ast@kernel.org, andrii@kernel.org,
	martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org,
	yonghong.song@linux.dev, john.fastabend@gmail.com,
	kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com,
	jolsa@kernel.org, mattbobrowski@google.com, rostedt@goodmis.org,
	mhiramat@kernel.org, mathieu.desnoyers@efficios.com,
	horms@kernel.org, willemb@google.com, pablo@netfilter.org,
	kadlec@netfilter.org, hawk@kernel.org, bpf@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org
Subject: Re: [PATCH bpf-next v3 5/7] bpf: Remove attach_type in bpf_netns_link
Date: Wed, 9 Jul 2025 16:58:26 +0800	[thread overview]
Message-ID: <540c2855-da19-4562-ac17-d85225886732@linux.dev> (raw)
In-Reply-To: <874ivlg4fq.fsf@cloudflare.com>

在 2025/7/9 16:21, Jakub Sitnicki 写道:
> On Wed, Jul 09, 2025 at 11:08 AM +08, Tao Chen wrote:
>> Use attach_type in bpf_link, and remove it in bpf_netns_link.
>>
>> Acked-by: Jiri Olsa <jolsa@kernel.org>
>> Signed-off-by: Tao Chen <chen.dylane@linux.dev>
>> ---
>>   kernel/bpf/net_namespace.c | 6 ++----
>>   1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/kernel/bpf/net_namespace.c b/kernel/bpf/net_namespace.c
>> index 63702c86275..6d27bd97c95 100644
>> --- a/kernel/bpf/net_namespace.c
>> +++ b/kernel/bpf/net_namespace.c
>> @@ -11,7 +11,6 @@
>>   
>>   struct bpf_netns_link {
>>   	struct bpf_link	link;
>> -	enum bpf_attach_type type;
>>   	enum netns_bpf_attach_type netns_type;
>>   
>>   	/* We don't hold a ref to net in order to auto-detach the link
> 
> Nit: Doesn't that create a hole? Maybe move netns_type to the end.
> 

Hi Jakub,
You are right, i will change it in v4, thanks.

pahole -C bpf_netns_link vmlinux
struct bpf_netns_link {
	struct bpf_link            link __attribute__((__aligned__(8))); /* 
0    80 */

	/* XXX last struct has 7 bytes of padding */

	/* --- cacheline 1 boundary (64 bytes) was 16 bytes ago --- */
	enum netns_bpf_attach_type netns_type;           /*    80     4 */

	/* XXX 4 bytes hole, try to pack */

	struct net *               net;                  /*    88     8 */
	struct list_head           node;                 /*    96    16 */

	/* size: 112, cachelines: 2, members: 4 */
	/* sum members: 108, holes: 1, sum holes: 4 */
	/* paddings: 1, sum paddings: 7 */
	/* forced alignments: 1 */
	/* last cacheline: 48 bytes */
} __attribute__((__aligned__(8)));

> [...]


-- 
Best Regards
Tao Chen

  reply	other threads:[~2025-07-09  8:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-09  3:07 [PATCH bpf-next v3 0/7] Add attach_type in bpf_link Tao Chen
2025-07-09  3:07 ` [PATCH bpf-next v3 1/7] bpf: " Tao Chen
2025-07-09 13:15   ` Daniel Borkmann
2025-07-09  3:07 ` [PATCH bpf-next v3 2/7] bpf: Remove attach_type in bpf_cgroup_link Tao Chen
2025-07-09 13:07   ` Daniel Borkmann
2025-07-09  3:07 ` [PATCH bpf-next v3 3/7] bpf: Remove attach_type in sockmap_link Tao Chen
2025-07-09 13:07   ` Daniel Borkmann
2025-07-09  3:07 ` [PATCH bpf-next v3 4/7] bpf: Remove location field in tcx_link Tao Chen
2025-07-09 10:39   ` Daniel Borkmann
2025-07-09  3:08 ` [PATCH bpf-next v3 5/7] bpf: Remove attach_type in bpf_netns_link Tao Chen
2025-07-09  8:21   ` Jakub Sitnicki
2025-07-09  8:58     ` Tao Chen [this message]
2025-07-09  3:08 ` [PATCH bpf-next v3 6/7] bpf: Remove attach_type in bpf_tracing_link Tao Chen
2025-07-09  3:08 ` [PATCH bpf-next v3 7/7] netkit: Remove location field in netkit_link Tao Chen
2025-07-09  7:37   ` Nikolay Aleksandrov
2025-07-09 10:39   ` Daniel Borkmann
2025-07-09  8:22 ` [PATCH bpf-next v3 0/7] Add attach_type in bpf_link Jakub Sitnicki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=540c2855-da19-4562-ac17-d85225886732@linux.dev \
    --to=chen.dylane@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=coreteam@netfilter.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@google.com \
    --cc=haoluo@google.com \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=jakub@cloudflare.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kadlec@netfilter.org \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mattbobrowski@google.com \
    --cc=mhiramat@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=razor@blackwall.org \
    --cc=rostedt@goodmis.org \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=willemb@google.com \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®