From: Thomas Gleixner <tglx@linutronix.de>
To: Peter Zijlstra <peterz@infradead.org>, Jann Horn <jannh@google.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Darren Hart <dvhart@infradead.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] threads: Update PID limit comment according to futex UAPI change
Date: Thu, 11 May 2023 15:26:22 +0200 [thread overview]
Message-ID: <87jzxfc83l.ffs@tglx> (raw)
In-Reply-To: <87mt2bc9wz.ffs@tglx>
On Thu, May 11 2023 at 14:47, Thomas Gleixner wrote:
>> #define FUTEX_TID_MASK 0x3fffffff
>
> That futex mask is irrelevant because there is another limitiation for
> the PID space namely posix CPU timers:
>
> static inline clockid_t make_process_cpuclock(const unsigned int pid,
> const clockid_t clock)
> {
> return ((~pid) << 3) | clock;
> }
>
> That existed even before we fiddled with robust futexes and puts a hard
> limit of 29 bits on the PID space.
Actually it's worse than this. The limit is 28 bits because posix CPU
timers rely on this:
static const struct k_clock *clockid_to_kclock(const clockid_t id)
{
clockid_t idx = id;
if (id < 0) {
return (id & CLOCKFD_MASK) == CLOCKFD ?
&clock_posix_dynamic : &clock_posix_cpu;
}
....
So TID must be smaller than 2^28 because if bit 28 would be set, then
the resulting clock would be positive after shift.
Sigh...
next prev parent reply other threads:[~2023-05-11 13:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-02 11:29 [PATCH] threads: Update PID limit comment according to futex UAPI change Jann Horn
2020-03-03 10:25 ` Peter Zijlstra
2020-03-03 14:12 ` Thomas Gleixner
2023-05-11 12:47 ` Thomas Gleixner
2023-05-11 13:26 ` Thomas Gleixner [this message]
2020-03-21 16:50 ` [tip: sched/core] " tip-bot2 for Jann Horn
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=87jzxfc83l.ffs@tglx \
--to=tglx@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=dvhart@infradead.org \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.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 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).