From: Simon Horman <simon.horman@corigine.com>
To: Zhengchao Shao <shaozhengchao@huawei.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, kuniyu@amazon.com,
liuhangbin@gmail.com, jiri@resnulli.us, hkallweit1@gmail.com,
andy.ren@getcruise.com, weiyongjun1@huawei.com,
yuehaibing@huawei.com
Subject: Re: [PATCH net-next] net: remove redundant NULL check in remove_xps_queue()
Date: Tue, 25 Jul 2023 09:04:54 +0200 [thread overview]
Message-ID: <ZL90FnzgLUAPc1Sk@corigine.com> (raw)
In-Reply-To: <20230724023735.2751602-1-shaozhengchao@huawei.com>
On Mon, Jul 24, 2023 at 10:37:35AM +0800, Zhengchao Shao wrote:
> There are currently two paths that call remove_xps_queue():
> 1. __netif_set_xps_queue -> remove_xps_queue
> 2. clean_xps_maps -> remove_xps_queue_cpu -> remove_xps_queue
> There is no need to check dev_maps in remove_xps_queue() because
> dev_maps has been checked on these two paths.
>
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
I have verified the reasoning above is correct.
I am, however, slightly less sure that this is a good idea.
> ---
> net/core/dev.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index f95e0674570f..76a91b849829 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -2384,8 +2384,7 @@ static bool remove_xps_queue(struct xps_dev_maps *dev_maps,
> struct xps_map *map = NULL;
> int pos;
>
> - if (dev_maps)
> - map = xmap_dereference(dev_maps->attr_map[tci]);
> + map = xmap_dereference(dev_maps->attr_map[tci]);
> if (!map)
> return false;
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2023-07-25 7:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-24 2:37 [PATCH net-next] net: remove redundant NULL check in remove_xps_queue() Zhengchao Shao
2023-07-25 7:04 ` Simon Horman [this message]
2023-07-26 2:25 ` shaozhengchao
2023-07-26 3:10 ` patchwork-bot+netdevbpf
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=ZL90FnzgLUAPc1Sk@corigine.com \
--to=simon.horman@corigine.com \
--cc=andy.ren@getcruise.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.com \
--cc=liuhangbin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shaozhengchao@huawei.com \
--cc=weiyongjun1@huawei.com \
--cc=yuehaibing@huawei.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).