Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5527430rwr; Tue, 9 May 2023 02:48:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4ljK6hJ7Hf4jlzZW+Go9xaLMItWKmYWo3J57Kqp6DA0D3NKnauPnp+cSiFkHMiT6lyV0sp X-Received: by 2002:a17:902:c949:b0:1ab:8f4:af21 with SMTP id i9-20020a170902c94900b001ab08f4af21mr17728548pla.42.1683625690803; Tue, 09 May 2023 02:48:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683625690; cv=none; d=google.com; s=arc-20160816; b=W+KNbNO/wryWGnJngsCBF0BuPaE6P64wjDtUlMBiTaE5GyCNvdnF8VaUkq2H660yEv DTLO/Ep931ojZ7+3ihw2fiZlWYSbL4W0hemUPjy4TnX+RCjNYpG6FP2hoe3nl6j4XXSU o+yhXbIRQyONFmXr5V3uUguVi7//IC2L5zJAyLLFvkoaVDwvROzsL+gCynC2m6Hrswde YLiOTEccef+fcU1fCyP+e+WPHCC4GKvEKAUAmmfp5qAEENc/HNLcjTsxrq0cvndnbWVs iH28QYMepgSyG0cmNMlREqeDPV8ePxrCjtTBq6xVJgA37iKF884FELxygMWN1i0VB2f+ kMIw== 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=NIGDXOvxTL/bkGzowYhEa+foQBHABLn1MZXkESGwuHs=; b=vYTHmO9ZxYg6ghWANbNs889rReMrsz2Vb0RudFM6dlRJ7ldTQ5KMzVmpYGFMaMy9u+ 0Xybq7Qs0kJWfAGCfBPfPY8kI7WLnFvejtNgJiNEFRdku06HykxzwuL7kQ0+5QHxRu/a bUMBB/tHkIOkkqUJYbOHKRwa9XHbYFNvN5R69WartrIgEEb0grm2riTmmjPdHM0USHE/ u1SmmYjWn1Jlhytve86zdhbyxXpKvhO0fFDHILmFG1pkw1PcXE0xGq+bc8bDo6RyyeB1 vrifuSoOhMgrAQMBJUHPHmkPLdV0LS1PmnYzOFxKjrHeIqWzaUKc23aOxXSoINUlr7OK 99BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=YALPAzc1; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=L+CxZUW+; 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 l8-20020a170902f68800b001ab08e28e01si1137610plg.361.2023.05.09.02.47.57; Tue, 09 May 2023 02:48:10 -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=YALPAzc1; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=L+CxZUW+; 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 S234919AbjEIJaL (ORCPT + 99 others); Tue, 9 May 2023 05:30:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234704AbjEIJaF (ORCPT ); Tue, 9 May 2023 05:30:05 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A827AD1D for ; Tue, 9 May 2023 02:30:04 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1683624601; 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=NIGDXOvxTL/bkGzowYhEa+foQBHABLn1MZXkESGwuHs=; b=YALPAzc1fLbLrc6eFhaqKhJmEuDfc5Uwdutho3QRSndJBKSRIQjy091XI9hKBhBx8ZsuD9 NjfLOKNynX/eU7W3DAu5A6e1YIV8v2X4AFaxYixpllWJXx3jzVadrYbId+vBlThiaJ6oiX J/Zt0EGTojjjeLg9cpvoZa921GZUE0Sn4nqRSgiIMHTS3k6aOYLA1gQwyzxYfzFvSL9v+f LKQHuk3btvHz9E7exUXkGIbxMKow978vPEPYauLD0yRXc0QsD6d4Z4SYvg/DhtCOm0oPOX FO3mhq2RqVFVRS/zJN+PjW2N5bj6j/Y44XU3mkM/MWQdqi8K8mFcpiagBHBNgg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1683624601; 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=NIGDXOvxTL/bkGzowYhEa+foQBHABLn1MZXkESGwuHs=; b=L+CxZUW+ETVVWrwOj6eom5QQxn7dk6fbIFO7+UsOB77hsxTR2KHNaERExxCYapDLRjGJyl 5he1UYov/naRIDCg== To: Frederic Weisbecker Cc: LKML , Anna-Maria Behnsen , Peter Zijlstra , syzbot+5c54bd3eb218bb595aa9@syzkaller.appspotmail.com, Dmitry Vyukov , Sebastian Siewior , Michael Kerrisk , Andrei Vagin Subject: Re: [patch 02/20] posix-timers: Ensure timer ID search-loop limit is valid In-Reply-To: <878rdy32ri.ffs@tglx> References: <20230425181827.219128101@linutronix.de> <20230425183312.932345089@linutronix.de> <87zg6i2xn3.ffs@tglx> <87v8h62vwp.ffs@tglx> <878rdy32ri.ffs@tglx> Date: Tue, 09 May 2023 11:30:01 +0200 Message-ID: <87v8h126p2.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,URIBL_BLOCKED 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 Mon, May 08 2023 at 23:57, Thomas Gleixner wrote: > On Sat, May 06 2023 at 01:36, Thomas Gleixner wrote: >> The only alternative solution I could come up with is a paritioned >> xarray where the index space would be segmented for each TGID, i.e. >> >> segment.start = TGID * MAX_TIMERS_PER_PROCESS >> segment.end = segment.start + MAX_TIMERS_PER_PROCESS - 1 >> >> where MAX_TIMERS_PER_PROCESS could be a copius 2^16 which would work for >> both 32bit and 64bit TID limits. >> >> That would avoid the hash table lookups and the related issues, but OTH >> it would require to allocate one extra page per TGID if the application >> uses a single posix timer. >> >> Not sure whether that's worth it though. > > More thoughts on this. If we go there and accept the extra page of > memory then we can just go all the way and make the xarray per process, > actually per signal. Thinking more about it. The current scheme how timer ID allocation works is really interesting vs. CRIU. Assume a process creates/deletes timers frequently. It's not hard to move the next ID close to INT_MAX, i.e. 2G Now checkpoint that thing and restore it which means to do the create/delete dance to move next ID up to the last one-1. Will only take a couple of hours.... Thanks, tglx