From: Jakub Kicinski <kuba@kernel.org>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Kuniyuki Iwashima <kuniyu@google.com>,
netdev@vger.kernel.org, eric.dumazet@gmail.com
Subject: Re: [PATCH net-next] net: remove RTNL use for /proc/sys/net/core/rps_default_mask
Date: Tue, 1 Jul 2025 17:46:12 -0700 [thread overview]
Message-ID: <20250701174612.55d55715@kernel.org> (raw)
In-Reply-To: <20250627130839.4082270-1-edumazet@google.com>
On Fri, 27 Jun 2025 13:08:39 +0000 Eric Dumazet wrote:
> diff --git a/net/core/net-sysfs.h b/net/core/net-sysfs.h
> index 8a5b04c2699aaee13ccc3a5b1543eecd0fc10d29..ff3440d721963b2f90b6a83666a63b3f95e61421 100644
> --- a/net/core/net-sysfs.h
> +++ b/net/core/net-sysfs.h
> @@ -11,4 +11,8 @@ int netdev_queue_update_kobjects(struct net_device *net,
> int netdev_change_owner(struct net_device *, const struct net *net_old,
> const struct net *net_new);
>
> +#if IS_ENABLED(CONFIG_SYSCTL) && IS_ENABLED(CONFIG_RPS)
> +extern struct mutex rps_default_mask_mutex;
> +#endif
Perhaps subjective but hiding definitions under ifdefs often forces
the ifdef to spread, IOW it prevents us from using:
if (IS_ENABLED(CONFIG_..))
and relying on compiler to remove the dead code. So I'd skip the ifdef.
> #endif
> diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
> index 5dbb2c6f371defbf79d4581f9b6c1c3fb13fa9d9..672520e43fefadf4c8c667ff6c77acf3935bc567 100644
> --- a/net/core/sysctl_net_core.c
> +++ b/net/core/sysctl_net_core.c
> @@ -96,50 +96,40 @@ static int dump_cpumask(void *buffer, size_t *lenp, loff_t *ppos,
>
> #ifdef CONFIG_RPS
>
> -static struct cpumask *rps_default_mask_cow_alloc(struct net *net)
> -{
> - struct cpumask *rps_default_mask;
> -
> - if (net->core.rps_default_mask)
> - return net->core.rps_default_mask;
> -
> - rps_default_mask = kzalloc(cpumask_size(), GFP_KERNEL);
> - if (!rps_default_mask)
> - return NULL;
> -
> - /* pairs with READ_ONCE in rx_queue_default_mask() */
> - WRITE_ONCE(net->core.rps_default_mask, rps_default_mask);
> - return rps_default_mask;
> -}
> +DEFINE_MUTEX(rps_default_mask_mutex);
nit: sparse says ../sysfs.h is not included here so it doesn't see the
declaration for the header:
net/core/sysctl_net_core.c:99:1: warning: symbol 'rps_default_mask_mutex' was not declared. Should it be static?
--
pw-bot: cr
next prev parent reply other threads:[~2025-07-02 0:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-27 13:08 [PATCH net-next] net: remove RTNL use for /proc/sys/net/core/rps_default_mask Eric Dumazet
2025-06-27 21:18 ` Kuniyuki Iwashima
2025-07-02 0:46 ` Jakub Kicinski [this message]
2025-07-02 6:07 ` Eric Dumazet
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=20250701174612.55d55715@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=horms@kernel.org \
--cc=kuniyu@google.com \
--cc=netdev@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).