Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp8802368rwr; Thu, 11 May 2023 06:30:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5w1HHl6JpNokHjSWhlqTMrAWetXw3wsbW3iEkta86BBPOzYr8MjtKCWXvpgBEkRO6ciGGp X-Received: by 2002:a17:90b:190f:b0:24e:16ae:61ca with SMTP id mp15-20020a17090b190f00b0024e16ae61camr20416170pjb.34.1683811809642; Thu, 11 May 2023 06:30:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683811809; cv=none; d=google.com; s=arc-20160816; b=yEZMybCut+LhXqhxtzh7mB8LdWG+RBVKvdW3WEGtpY8XHDElc7/wk6CnOpwu7e7394 tj3GXdatjZyETJn4HfW8wp1jg2CCumqljNzOTkzUfeK2IajN6qibBPmJLDKD9fDvuM5k 1h+oV6FnaDmWK/+k1EUk95Ioiel0xQmRvebweOJh/xF/eRPrPU4L1hBl7YI/w1doUjFx r9FHb4SJ8v8r/VISL421S3SUs84GkOpYSyDsdsPNZOTBtogc0d81x1UsbHGQrozzlXBd /LcMRqXOqTc/1qSjb+na0gaDvrsRZ6EzGD1m0NLfZvb9xnYZ54icdQFG+/EcWTP9U2QK 5WUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=317Fz8QUimiJg2kKcfYfUmJedbcz95B0Vapr8bFk5xY=; b=k6HYyuNrb1ICfMO8wVsSMVsI9U/b6fxwcQNigM+j1IKrdrwZ3wALuGm0soN3paYKv1 C6AyvWdH8o4zqnEuwOkTzCGOeUtnF4TDZIkfH3HCkLREJSavFNmMrzpFxc6WvSv+TasS gzhAjfNPZJ0jdOBHehdpOTMXujm+oYTlN94UojjQ0iJTLCZ4jIYosi4B25FBB75Ryh2W 68TFK5WwcmXCaUjRa4OzG09CnY9QJan07XOqiUdHYjqj+l5SbORQUrFZpB6/PWcAwVxS TLIVHCgkXGt7Ps0GAeEBqTmCBRTFTUXzzxmpDRL0uLHENU2LqeAc8XRz7Uqw5SlNHCO5 QvFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=K3qiIlTn; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=80VGekiZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b198-20020a6334cf000000b00514477c4403si6705298pga.310.2023.05.11.06.29.54; Thu, 11 May 2023 06:30:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=K3qiIlTn; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=80VGekiZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238032AbjEKN2c (ORCPT + 99 others); Thu, 11 May 2023 09:28:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238018AbjEKN2L (ORCPT ); Thu, 11 May 2023 09:28:11 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE017173B for ; Thu, 11 May 2023 06:26:54 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1683811583; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=317Fz8QUimiJg2kKcfYfUmJedbcz95B0Vapr8bFk5xY=; b=K3qiIlTnud9sLrTAV/N+UouhioiaKLetD4FWjSmOapH4NunU1NNRb9tdC2V6Zy4LXowg30 qgLdPQEoxwEIAdhIdXol+bARY9/Of3ft9J325k8Vz2CxRm/mB2FrITBzR+f5UQnymZe/0F HwW2l7nEb1r7n9ZSQGpUolkiDF0jE+ul/h1pbeCbZYR7uTU3n9dYggvbuh+MltyIRyefxt OqSwlZL2uf1zuwqznEMAAZfL4DOVCd27MWAjbSQKiFCXqUrmENjgtaXIdYfGhdtfL4mjge RV2wVGGooTmD1zkPkzXk6C+oST7sh1hKKOx41uzJFOhF30r5DoMMQEjT2e6KrQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1683811583; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=317Fz8QUimiJg2kKcfYfUmJedbcz95B0Vapr8bFk5xY=; b=80VGekiZSvMCvi7cZ0mcR4fnW1ZISYo1PjmJOca/mJZeoc8W8z3TZBr8ipGtz6HQvSEdHl WGkJ2+Fd/0snSxDQ== To: Peter Zijlstra , Jann Horn Cc: Ingo Molnar , Andrew Morton , Darren Hart , linux-kernel@vger.kernel.org Subject: Re: [PATCH] threads: Update PID limit comment according to futex UAPI change In-Reply-To: <87mt2bc9wz.ffs@tglx> References: <20200302112939.8068-1-jannh@google.com> <20200303102540.GC2579@hirez.programming.kicks-ass.net> <8736apede7.fsf@nanos.tec.linutronix.de> <87mt2bc9wz.ffs@tglx> Date: Thu, 11 May 2023 15:26:22 +0200 Message-ID: <87jzxfc83l.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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...