MPTCP Linux Development
 help / color / mirror / Atom feed
From: Geliang Tang <geliang@kernel.org>
To: Matthieu Baerts <matttbe@kernel.org>
Cc: MPTCP Upstream <mptcp@lists.linux.dev>
Subject: Re: [PATCH mptcp-next 1/4] selftests: mptcp: join: properly kill background tasks
Date: Tue, 11 Nov 2025 16:17:03 +0800	[thread overview]
Message-ID: <a8768ce5597666aca5effeb794303245d8edc67c.camel@kernel.org> (raw)
In-Reply-To: <894506e8-df54-4fb7-8337-c5fdc99ecb73@kernel.org>

Hi Matt,

On Tue, 2025-11-11 at 07:53 +0100, Matthieu Baerts wrote:
> Hi Geliang,
> 
> Thank you for the reviews.
> 
> 11 Nov 2025 03:46:06 Geliang Tang <geliang@kernel.org>:
> 
> > Hi Matt,
> > 
> > This for this fix.
> > 
> > On Sat, 2025-11-08 at 15:20 +0100, Matthieu Baerts (NGI0) wrote:
> > > The 'run_tests' function is executed in the background, but
> > > killing
> > > its
> > > associated PID would not kill the children tasks running in the
> > > background.
> > > 
> > > To properly kill all background tasks, 'kill -- -PID' could be
> > > used,
> > > but
> > > this requires kill from procps-ng. Instead, all children tasks
> > > are
> > > listed using 'ps', and 'kill' is called with all PIDs of this
> > > group.
> 
> (...)
> 
> > > diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> > > b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> > > index ce6c92826be7..91ec75ddcb96 100644
> > > --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> > > +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh
> > > @@ -359,6 +359,27 @@ mptcp_lib_kill_wait() {
> > >     wait "${1}" 2>/dev/null
> > >  }
> > >  
> > > +# $1: PID
> > > +mptcp_lib_pid_list_children() {
> > > +   local curr="${1}"
> > > +   # evoke 'ps' only once
> > > +   local pids="${2:-"$(ps o pid,ppid)"}"
> > > +
> > > +   echo "${curr}"
> > > +
> > > +   local pid
> > > +   for pid in $(echo "${pids}" | awk "\$2 == ${curr} { print
> > > \$1 }"); do
> > > +       mptcp_lib_pid_list_children "${pid}" "${pids}"
> > 
> > To be honest, I don't understand why this
> > mptcp_lib_pid_list_children
> > function is calling itself here. Is this recursion?
> 
> Yes it is a recursion: children processes can have children ones.
> 
> mptcp_lib_pid_list_children() will print the PID it is called with,
> and call
> itself with all children (can be none).
> 
> In our case with mptcp_join.sh, it means getting the run_tests job
> plus
> the other background tasks: mptcp_connect (x2), the timeout, and
> eventually the task modifying the endpoints.

Thanks for your explanation, this patch looks good to me.

I'll reply my RB tag in the cover letter.

And for patch 6 of "selftests: mptcp: join: fix some flaky tests"
sending to -net too.

-Geliang

> 
> Cheers,
> Matt


  reply	other threads:[~2025-11-11  8:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-08 14:20 [PATCH mptcp-next 0/4] selftests: mptcp: get stats just before timing out Matthieu Baerts (NGI0)
2025-11-08 14:20 ` [PATCH mptcp-next 1/4] selftests: mptcp: join: properly kill background tasks Matthieu Baerts (NGI0)
2025-11-11  2:46   ` Geliang Tang
2025-11-11  6:53     ` Matthieu Baerts
2025-11-11  8:17       ` Geliang Tang [this message]
2025-11-11 10:51         ` Matthieu Baerts
2025-11-12 10:00         ` Matthieu Baerts
2025-11-08 14:20 ` [PATCH mptcp-next 2/4] selftests: mptcp: connect: avoid double packet traces Matthieu Baerts (NGI0)
2025-11-08 14:20 ` [PATCH mptcp-next 3/4] selftests: mptcp: wait for port instead of sleep Matthieu Baerts (NGI0)
2025-11-08 14:20 ` [PATCH mptcp-next 4/4] selftests: mptcp: get stats just before timing out Matthieu Baerts (NGI0)
2025-11-13  7:15   ` Geliang Tang
2025-11-13  9:25     ` Matthieu Baerts
2025-11-13  7:25   ` Paolo Abeni
2025-11-13  9:30     ` Matthieu Baerts
2025-11-08 15:51 ` [PATCH mptcp-next 0/4] " MPTCP CI
2025-11-12 10:02 ` Geliang Tang
2025-11-12 10:35   ` Matthieu Baerts

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=a8768ce5597666aca5effeb794303245d8edc67c.camel@kernel.org \
    --to=geliang@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.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