From patchwork Sun Jun 18 20:50:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 109687 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2649081vqr; Sun, 18 Jun 2023 14:36:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6n7uLN9sHf/6om+nf5xhZqZr9DTx+2oNqN5evCg0RPVfWs4zs0wchAt6wMrces04qw9y7N X-Received: by 2002:a05:6870:9202:b0:1a9:aef7:261b with SMTP id e2-20020a056870920200b001a9aef7261bmr5304106oaf.48.1687124209589; Sun, 18 Jun 2023 14:36:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687124209; cv=none; d=google.com; s=arc-20160816; b=b702p7jK2O/iv2XTaO8BrHCdVeUalRAUmHJMY/ckcUZkQi4lwa1G4Vgo0qB1CghqyX HyKWHa8FwwoOtt0iBMGPDNLOxwI64/IjRKFqL96dAo+F7kFHp2OFBeLO2cYZhWK29mkV 0Q1WKSKQ2Zsfm2Lg7wWwEetg4/xK3CO/vHCmpRN/0a5YItUHnQm2GQ8jn8uV89XYI6uq iYxeJQOICbKrQ1SmUGGwpv7phUatdoStova0ygsnH56r6v7cHzIryX0JRTE877yiE37j 1QbVA5/0ruaNyNI3F4Jzmc1PXRgsIQU248BtVrD+pU6cpqThzt006vMcWL4AehOUyVT2 ZrxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=MrEQ3I65cqng6jyKbh0tu2RLyql6fYc51c1USigvkrU=; b=g4nl17/dvHm9AOll2lhNpBllHWcFfp/VwmU1vfqwF4/JKzMKUDS+4ADLD5k/px2Qqa tC6VaIKhxorhCKIdNoo3uGPF77ekDscre/aQqhwV0BEChvv7IWGC71mMIOy+BOee2MlP Lj9Q6jdzclJ187OqEXpa3hksdoed1CodG1o4bKX3Wg02tufNcBJwOLKfsnDYzfcDlLd6 f7TR4BlJofIl4K9NpcSGrNkHyAmpEGHbdFV1gsihF0xialxo0rli+6QFGTqdO50w0TsM J9yXq9irUrkuCd6hiMSUPEquUrgpbwQ8Rycau5pToDP6wj2IsAGk6tGswKaum+qmAIZm 74+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=W+inexBV; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=rpe3sI96; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j24-20020a637a58000000b005533f42dee0si6224293pgn.786.2023.06.18.14.36.35; Sun, 18 Jun 2023 14:36:49 -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=W+inexBV; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=rpe3sI96; 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 S229844AbjFRUvL (ORCPT + 99 others); Sun, 18 Jun 2023 16:51:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229610AbjFRUuL (ORCPT ); Sun, 18 Jun 2023 16:50: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 ABB6EE54; Sun, 18 Jun 2023 13:50:09 -0700 (PDT) Date: Sun, 18 Jun 2023 20:50:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1687121408; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MrEQ3I65cqng6jyKbh0tu2RLyql6fYc51c1USigvkrU=; b=W+inexBV4Pp2XLD4WPfjL7bLFSrAmJHKux4gQimypHtXVUf54QX+7dXy+L8c67WXTBIrQY Eiz1R+6hc8QdRr2/GqFnrKJmPQzJKlZJLQKcaw0WfK+w0tihTOt4qfLADSuFEej8LWf2XB SXKNLOq3n7Bad+9jhpVhlEgr8R7EsnH8XKa6HRLqstmOraGykR6rurK1Oe627rMzqcjPjG iMoGPatlUCBgEKqeLKLqeWz174ckD/8F9zH1PORBrUVAwi4K8HxxZuGByUYSvp9spa3q/z vPB1EK8EVp9xruNqKS0RjDqXhcqtW4g3VuFjW0xv8d3oTT8UIJIn+13Q2KJQ/A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1687121408; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MrEQ3I65cqng6jyKbh0tu2RLyql6fYc51c1USigvkrU=; b=rpe3sI96Otmw2MHpyCFZ059UrXFmrgLYuc2McEmOv3o53JmuDoJJfGSdwkEE1sIGiMurOG XOV3F2geZiH8fnBw== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] posix-timers: Cleanup comments about timer ID tracking Cc: Thomas Gleixner , Frederic Weisbecker , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230425183313.038444551@linutronix.de> References: <20230425183313.038444551@linutronix.de> MIME-Version: 1.0 Message-ID: <168712140755.404.17638032400776880983.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764176295816725605?= X-GMAIL-MSGID: =?utf-8?q?1769077954870455420?= The following commit has been merged into the timers/core branch of tip: Commit-ID: 8d44b958a1a088195524c884f0437660e0522380 Gitweb: https://git.kernel.org/tip/8d44b958a1a088195524c884f0437660e0522380 Author: Thomas Gleixner AuthorDate: Tue, 25 Apr 2023 20:49:01 +02:00 Committer: Thomas Gleixner CommitterDate: Sun, 18 Jun 2023 22:41:48 +02:00 posix-timers: Cleanup comments about timer ID tracking Describe the hash table properly and remove the IDR leftover comments. Signed-off-by: Thomas Gleixner Reviewed-by: Frederic Weisbecker Link: https://lore.kernel.org/r/20230425183313.038444551@linutronix.de --- kernel/time/posix-timers.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index 0c61f29..79909a2 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -35,20 +35,17 @@ #include "timekeeping.h" #include "posix-timers.h" -/* - * Management arrays for POSIX timers. Timers are now kept in static hash table - * with 512 entries. - * Timer ids are allocated by local routine, which selects proper hash head by - * key, constructed from current->signal address and per signal struct counter. - * This keeps timer ids unique per process, but now they can intersect between - * processes. - */ +static struct kmem_cache *posix_timers_cache; /* - * Lets keep our timers in a slab cache :-) + * Timers are managed in a hash table for lockless lookup. The hash key is + * constructed from current::signal and the timer ID and the timer is + * matched against current::signal and the timer ID when walking the hash + * bucket list. + * + * This allows checkpoint/restore to reconstruct the exact timer IDs for + * a process. */ -static struct kmem_cache *posix_timers_cache; - static DEFINE_HASHTABLE(posix_timers_hashtable, 9); static DEFINE_SPINLOCK(hash_lock); @@ -66,15 +63,6 @@ static const struct k_clock clock_realtime, clock_monotonic; #endif /* - * The timer ID is turned into a timer address by idr_find(). - * Verifying a valid ID consists of: - * - * a) checking that idr_find() returns other than -1. - * b) checking that the timer id matches the one in the timer itself. - * c) that the timer owner is in the callers thread group. - */ - -/* * CLOCKs: The POSIX standard calls for a couple of clocks and allows us * to implement others. This structure defines the various * clocks.