From patchwork Wed Dec 11 20:40:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 13904132 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4AF8E7717D for ; Wed, 11 Dec 2024 20:40:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 555FD6B0093; Wed, 11 Dec 2024 15:40:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4DF1B6B0095; Wed, 11 Dec 2024 15:40:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 380126B0096; Wed, 11 Dec 2024 15:40:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 162526B0093 for ; Wed, 11 Dec 2024 15:40:24 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B8C651612C0 for ; Wed, 11 Dec 2024 20:40:23 +0000 (UTC) X-FDA: 82883845212.23.2CED5BA Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf04.hostedemail.com (Postfix) with ESMTP id 0F66840005 for ; Wed, 11 Dec 2024 20:39:56 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="TLjeuHU/"; spf=none (imf04.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733949611; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=8w+OGQ6QKcXo2HV5fhO/TU0Z+8P3bRc/gsxK6gKbv30=; b=k3Hayj1LGj63uD6EoP7XDEir/kiTquY9r37NK29Y9LlpHJch732UMH9D3jGqj70Z407rgH +55zoQWfvXtObHw/dQmN6GtKRGwTjp3HUqklJ9jWyqvN0c0bm1PZNrFvbbJ+Q/hrWXPQbv 2pmoMlNMSsyEW2LpbNGe8UOTjPuMn14= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733949611; a=rsa-sha256; cv=none; b=5PNo9ipLmTjsr8XnZJ+vVo4ODr59n+/cPeA5OM//BxQWsJ8Xjr6OerU/qIWbAm+dABkl3e EThsRWVuo07wyDC+jEx7Z/mfMomEmehuV/mIm2y2uwhmqyYo6ndZr0bsfgfI/B4WIDMzuz xIb+NVEBiXg4nd/u46dC3v6lezkjglk= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="TLjeuHU/"; spf=none (imf04.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=8w+OGQ6QKcXo2HV5fhO/TU0Z+8P3bRc/gsxK6gKbv30=; b=TLjeuHU/LbEof1dpusel4s1cch rC4osdtGSg/inNJIz8NufvWg8/fya8Y2v7o7QbLO1Vi/VWJd2vODujhIhuhxGPALkSh2GKpEh/xXR hL+JNfjy8PQ42JRpm+V24q3ZEvl/Ua4GMpH31wOETmkl+hHtLAIY4jutyESQA0thayRqKyCOpebJ4 QZ6dab8b/58KhhL7m/ioJFBSsRtvHrnsK9AcfwO+LHsgFq7/yzA7h8sZEPoHJdgkJquqnGXZBUt5A YPd92zTp7jc9AbzivB17ApDMzZCLMjTTR4K7pNcXDt5JUD1tb52nzrxOPLNVEBlXUMlWOjthmKiLj q7nj3FPQ==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tLTVM-00000000m42-1i8h; Wed, 11 Dec 2024 20:40:20 +0000 From: "Matthew Wilcox (Oracle)" To: Tejun Heo Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH] percpu_ref: Fix documentation of maximum value Date: Wed, 11 Dec 2024 20:40:14 +0000 Message-ID: <20241211204017.184512-1-willy@infradead.org> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 0F66840005 X-Stat-Signature: zxjy544f1r4a1uzqbkuskcpmwh68ri58 X-Rspam-User: X-HE-Tag: 1733949596-824684 X-HE-Meta: U2FsdGVkX1/LmFeXc8J3GgJh6m+ufeRI4vQsdr9jen+yFYLHJFVuJ7xprzmotVnQtH0dLVK1Xg1DQKFmJVBLR5cSSjW2c4XBtt+ecIhlDDuB1yDl9FdgBrcyP48XudZ+iZFNfJE1h2ULdyX0vXzWRVdKO5LYh6wTix6F/cGT00mL0CimdictYWq9ikBEh68Bd8PpN8zjYhY+Ppv0PKdmn058+WuVVDeBh4qXPmrI+AnwnAwO48DQTI6Zbs7iZfbP2nvCAvwVV31iUpO9DEbSQkMnxnftg2Db891HLFpIGr+fsrPEB7XVSVBu+olp8R6EA/kSpxqf24gzIdakUovmgqWwG/kIh7WetkXaM/7cfQBZiDtSU1WjuIU6wpJ0xCAkBjltGWeCx5awjNlJHNcUdLr1QFJMwH6yMoKaWjRdmirX80R688T18H1BbCrDiWjGskkBNsXPZe88YiMPGQMxkenkwBGn0PhUDgA4xXeucbO+gptzcDlWkj5LT1JlvCuafw0v9YtN2mvNnSc+tX7KF0kFP6KzZZXdJ6XvraQnPRxP/CBGYdlpxTDMSam+An878sT9quh2noanzio/D+X0trhM7AU0+IArL0QbBUJ9ETb2D2PXXpT3V//K3ehQbaHM30AXUBJ94jZdLU7aaMMfaOpsP0LYgPA9Cmpp42vgnVhU7aTaLORAv3MD5pgZV4X2wJleNED+zFkkdxdR32bhHOgXnBLqbRTzv2vBv1QUXcEfGHnvK96lIzhC+DzoIg44J9CK/0/FF/mZ/5VUEP4VRbZR3ACe3eoAykXWyb3QUpGfX9YIRQx0ItL+hjzNC+ZHmHvcJf3DMiu9y1H4HR/rllucyUwPviUHJAfXlaZhWLRBLzpzU3EpnyrMGPYh5PGMgEUApj78B2WCRynbAOMqaXJKUu5NLQ6ZSqMwsG0SN3tIlrYP2iTHNba/TQbO8cu/wAgmJmKGq1b7olPa5IA GruhtT0e T4oJmKZxauGgK9qXDZSFk4JNgCVfOD5LOLl4YcbJvEKoiNZSoGoMYi1vtqoWBiXokmEa3C2ViBgdYJOLKWgr1ymAl+BphYG7jthJN0VpYS35lHm2QJj/N3U4LpV+CzwessHWVNhtXw5YCd5qCnJrscaZiG7BIdiEfXLegRfjVejJVEpPTdAOTMEShS756v1JnwF/sZkhgqq5dp29QkEJmYTQfqnh6R/SD5TgvmzKqjo5WUSPpf0uNPvZMhYtQDD+DrAoUg6tRtJ172Ck28nqdDdu9t8PQnWFodJPm X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Tejun changd percpu_ref to use long instead of int back in 2014 but missed updating this bit of the documentation. Also add the documentation to the htmldocs. Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Tejun Heo --- Documentation/driver-api/basics.rst | 3 +++ include/linux/percpu-refcount.h | 5 +++-- lib/percpu-refcount.c | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Documentation/driver-api/basics.rst b/Documentation/driver-api/basics.rst index d78b7c328ff7..a3f0a0639053 100644 --- a/Documentation/driver-api/basics.rst +++ b/Documentation/driver-api/basics.rst @@ -90,6 +90,9 @@ Reference counting .. kernel-doc:: lib/refcount.c :export: +.. kernel-doc:: include/linux/percpu-refcount.h +.. kernel-doc:: lib/percpu-refcount.c + Atomics ------- diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h index d73a1c08c3e3..1e3212e2c827 100644 --- a/include/linux/percpu-refcount.h +++ b/include/linux/percpu-refcount.h @@ -12,8 +12,8 @@ * start shutting down you call percpu_ref_kill() _before_ dropping the initial * refcount. * - * The refcount will have a range of 0 to ((1U << 31) - 1), i.e. one bit less - * than an atomic_t - this is because of the way shutdown works, see + * The refcount will have a range of 0 to LONG_MAX, i.e. one bit less + * than an atomic_long_t - this is because of the way shutdown works, see * percpu_ref_kill()/PERCPU_COUNT_BIAS. * * Before you call percpu_ref_kill(), percpu_ref_put() does not check for the @@ -269,6 +269,7 @@ static inline bool percpu_ref_tryget(struct percpu_ref *ref) /** * percpu_ref_tryget_live_rcu - same as percpu_ref_tryget_live() but the * caller is responsible for taking RCU. + * @ref: percpu_ref to try-get * * This function is safe to call as long as @ref is between init and exit. */ diff --git a/lib/percpu-refcount.c b/lib/percpu-refcount.c index 668f6aa6a75d..dfb9faa4ba83 100644 --- a/lib/percpu-refcount.c +++ b/lib/percpu-refcount.c @@ -289,7 +289,7 @@ static void __percpu_ref_switch_mode(struct percpu_ref *ref, * @confirm_switch: optional confirmation callback * * There's no reason to use this function for the usual reference counting. - * Use percpu_ref_kill[_and_confirm](). + * Use percpu_ref_kill() or percpu_ref_kill_and_confirm(). * * Schedule switching of @ref to atomic mode. All its percpu counts will * be collected to the main atomic counter. On completion, when all CPUs