netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: lirongqing <lirongqing@baidu.com>
Cc: kadlec@netfilter.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH] net/netfilter: use kvfree_rcu to simplify the code
Date: Wed, 12 Mar 2025 16:37:29 +0100	[thread overview]
Message-ID: <Z9GqOZIlyVPj0eNl@calendula> (raw)
In-Reply-To: <20250122074450.3185-1-lirongqing@baidu.com>

> diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
> index 2b8aac2..c751b0a 100644
> --- a/include/linux/netfilter.h
> +++ b/include/linux/netfilter.h
> @@ -111,28 +111,17 @@ struct nf_hook_entry {
>  	void				*priv;
>  };
>  
> -struct nf_hook_entries_rcu_head {
> -	struct rcu_head head;
> -	void	*allocation;
> -};
> -
>  struct nf_hook_entries {
>  	u16				num_hook_entries;
> +	struct rcu_head rcu;

This structure is accessed from the packet path.

>  	/* padding */
>  	struct nf_hook_entry		hooks[];
>  
>  	/* trailer: pointers to original orig_ops of each hook,
> -	 * followed by rcu_head and scratch space used for freeing
> -	 * the structure via call_rcu.
>  	 *
>  	 *   This is not part of struct nf_hook_entry since its only
>  	 *   needed in slow path (hook register/unregister):
>  	 * const struct nf_hook_ops     *orig_ops[]
> -	 *
> -	 *   For the same reason, we store this at end -- its
> -	 *   only needed when a hook is deleted, not during
> -	 *   packet path processing:
> -	 * struct nf_hook_entries_rcu_head     head

I think it is convenient to keep struct rcu_head at the end of it.

      parent reply	other threads:[~2025-03-12 15:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-22  7:44 [PATCH] net/netfilter: use kvfree_rcu to simplify the code lirongqing
2025-01-22  9:59 ` Simon Horman
2025-03-12 15:37 ` Pablo Neira Ayuso [this message]

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=Z9GqOZIlyVPj0eNl@calendula \
    --to=pablo@netfilter.org \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kadlec@netfilter.org \
    --cc=kuba@kernel.org \
    --cc=lirongqing@baidu.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).