netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: zhailiansen <zhailiansen@gmail.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, yuwang@kuaishou.com,
	wushukun@kuaishou.com, zhailiansen <zhailiansen@kuaishou.com>
Subject: Re: [PATCH] netclassid: on modifying netclassid, only consider the main process.
Date: Mon, 9 Oct 2023 17:14:16 +0200	[thread overview]
Message-ID: <ZSQYyO9JW/9HEjPM@kernel.org> (raw)
In-Reply-To: <20231008030442.35196-1-zhailiansen@kuaishou.com>

On Sun, Oct 08, 2023 at 11:04:42AM +0800, zhailiansen wrote:

Hi,

thanks for your patch.
Some minor comments from my side.

> When modifying netclassid, the command("echo 0x100001 > net_cls.classid") will
> take more time on muti threads of one process, because the process create many

nit: muti -> multiple ?

> fds.
> for example, one process exists 28000 fds and 60000 threads, echo command will
> task 45 seconds.
> Now, we only consider the main process when exec "iterate_fd", and the time is
> 52 milliseconds.

Please consider line-wrapping the patch description at 75 bytes.

This patch seems best targeted at net-next, this information should be
included in the patch. So if post a v2 please consider using:

	Subject: [PATCH v2] ...

> Signed-off-by: zhailiansen <zhailiansen@kuaishou.com>

Please consider signing off using your real name.

e.g. Signed-off-by: Firstname Lastname <...>

> ---
>  net/core/netclassid_cgroup.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/net/core/netclassid_cgroup.c b/net/core/netclassid_cgroup.c
> index d6a70ae..78c903c 100644
> --- a/net/core/netclassid_cgroup.c
> +++ b/net/core/netclassid_cgroup.c
> @@ -88,6 +88,12 @@ static void update_classid_task(struct task_struct *p, u32 classid)
>  	};
>  	unsigned int fd = 0;
>  
> +	/* Only update the leader task, when multi threads in this task,
> +	 * so it can avoid the useless traversal.
> +	 */
> +	if (p && p != p->group_leader)
> +		return;

Can p ever be NULL?
It is dereferenced unconditionally by the existing call to task_lock() below.

> +
>  	do {
>  		task_lock(p);
>  		fd = iterate_fd(p->files, fd, update_classid_sock, &ctx);
> -- 
> 1.8.3.1
> 
> 

      reply	other threads:[~2023-10-09 15:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-08  3:04 [PATCH] netclassid: on modifying netclassid, only consider the main process zhailiansen
2023-10-09 15:14 ` Simon Horman [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=ZSQYyO9JW/9HEjPM@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=wushukun@kuaishou.com \
    --cc=yuwang@kuaishou.com \
    --cc=zhailiansen@gmail.com \
    --cc=zhailiansen@kuaishou.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).