public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Richard Palethorpe <rpalethorpe@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3 2/2] Refactor exit_group01 using new API
Date: Wed, 1 Nov 2023 13:50:32 +0100	[thread overview]
Message-ID: <ZUJJmPJYqumtFZxh@yuki> (raw)
In-Reply-To: <878r82yhyh.fsf@suse.de>

Hi!
> This could fail due to PID reuse or maybe because state == 'Z'.
> 
> Perhaps instead we could check the threads are put into the Z state?
> 
> I guess that the child threads are reparented to init and it reaps
> them. So you will have to prevent that by setting PR_SET_CHILD_SUBREAPER
> on the main test process with prctl.
> 
> The man pages are not clear on this though. I guess this is how it works
> from reading the kernel code.

What about we:

1) allocate a piece of shared memory
2) each thread would run a loop that would increment a counter in that
   memory
3) the test process will wait() the main child
4) then monitor the shared memory to make sure that counters are not
   incremented anymore

Also child threads shouldn't be reparented to init, as long as at least
one of the threads runs the child process is technically alive and I
guess that wait() will not return until last thread in the group is
dead.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2023-11-01 12:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-08 10:23 [LTP] [PATCH v3 0/2] Rewrite exit_group01 test Andrea Cervesato
2023-09-08 10:23 ` [LTP] [PATCH v3 1/2] Add tst_gettid wrapper around gettid syscall Andrea Cervesato
2023-11-01 12:29   ` Cyril Hrubis
2023-09-08 10:23 ` [LTP] [PATCH v3 2/2] Refactor exit_group01 using new API Andrea Cervesato
2023-10-16 10:03   ` Richard Palethorpe
2023-11-01 12:50     ` Cyril Hrubis [this message]
2023-11-16 13:24       ` Richard Palethorpe

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=ZUJJmPJYqumtFZxh@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=rpalethorpe@suse.de \
    /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