All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
To: Bjoern Doebel <doebel@amazon.com>, linux-kselftest@vger.kernel.org
Cc: brauner@kernel.org, shuah@kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] selftests/pid_namespace: compute pid_max test limits dynamically
Date: Thu, 23 Apr 2026 12:07:20 +0200	[thread overview]
Message-ID: <679c54ef-9799-4df8-8555-c4f54922bea9@virtuozzo.com> (raw)
In-Reply-To: <20260422201151.3830506-1-doebel@amazon.com>



On 4/22/26 22:11, Bjoern Doebel wrote:
> The pid_max kselftest hardcodes pid_max values of 400 and 500, but the
> kernel enforces a minimum of PIDS_PER_CPU_MIN * num_possible_cpus().
> On machines with many possible CPUs (e.g. nr_cpu_ids=128 yields a
> minimum of 1024), writing 400 or 500 to /proc/sys/kernel/pid_max
> returns EINVAL and all three tests fail.
> 
> Compute these limits the same way as the kernel does and set outer_limit
> and inner_limit dynamically based on the result. Original test semantics
> are preserved (outer < inner, nested namespace capped by parent).
> 

Reviewed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>

> Signed-off-by: Bjoern Doebel <doebel@amazon.com>
> Assisted-by: Kiro:claude-opus-4.6
> ---
> v2:
> - use global outer_limit/inner_limit instead of complicated config
>   struct
> - make use of FIXTURE/TEST_F macros
> - reduce buffer size in write_int_to_fd() to 12
> 
>  .../testing/selftests/pid_namespace/pid_max.c | 156 ++++++++++++++----
>  1 file changed, 124 insertions(+), 32 deletions(-)
> 
...
> @@ -328,17 +405,32 @@ static int pid_max_nested_limit_outer(void *data)
>  	return 0;
>  }
>  
> -TEST(pid_max_simple)
> +FIXTURE(pid_max) {
> +	int dummy;

nit: Having dummy variable here does not seem to be required.

> +};
> +
> +FIXTURE_SETUP(pid_max)
>  {
> -	pid_t pid;
> +	int min = pid_min();
>  
> +	outer_limit = min + 100;
> +	inner_limit = min + 200;
> +}
> +
> +FIXTURE_TEARDOWN(pid_max)
> +{
> +}
> +
> +TEST_F(pid_max, simple)


-- 
Best regards, Pavel Tikhomirov
Senior Software Developer, Virtuozzo.


  reply	other threads:[~2026-04-23 10:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21 19:43 [PATCH] selftests/pid_namespace: compute pid_max test limits dynamically Bjoern Doebel
2026-04-22 13:00 ` Pavel Tikhomirov
2026-04-22 19:44   ` Bjoern Doebel
2026-04-22 20:11 ` [PATCH v2] " Bjoern Doebel
2026-04-23 10:07   ` Pavel Tikhomirov [this message]
2026-05-11  9:09   ` Christian Brauner

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=679c54ef-9799-4df8-8555-c4f54922bea9@virtuozzo.com \
    --to=ptikhomirov@virtuozzo.com \
    --cc=brauner@kernel.org \
    --cc=doebel@amazon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=stable@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.