[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87jzxfc83l.ffs@tglx>
Date: Thu, 11 May 2023 15:26:22 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Peter Zijlstra <peterz@...radead.org>, Jann Horn <jannh@...gle.com>
Cc: Ingo Molnar <mingo@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Darren Hart <dvhart@...radead.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] threads: Update PID limit comment according to futex
UAPI change
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...
Powered by blists - more mailing lists