Messages in this thread | | | From | Thomas Gleixner <> | Subject | Re: [PATCH] threads: Update PID limit comment according to futex UAPI change | Date | Thu, 11 May 2023 15:26:22 +0200 |
| |
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...
| |