From nobody Sat Jun 13 11:25:20 2026 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58F5544E044 for ; Thu, 7 May 2026 17:37:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778175447; cv=none; b=T29QVleTqAZW4hk9Y+rh8bs2fy3gWN5gXiajHjcEFmm3S0Z64MzzZqRwScHrViUeQs7voStlbFaOwtD5SsE8Fs1TtWNQfo0M/hK4/o1iHHqRvyb2vBYBSNtZQF0xpfSEth/PTChU+XlBzBchN+KyAd1XsCbhRps/ffY4RIonYCA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778175447; c=relaxed/simple; bh=4z/1dmBLjBhdxfo/+CaTY6REGE9UNUbRRcoALV01/lI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FyGR8cPGfgVbNMNHOvnpRj6IecZoVV9EVDUW71mgqytJi7IevMxyPwYXz2DcrFrOgEilsEQQBDzJufPaWO5t45FEjy9u15hv5DbO8qmT2TbIIEVfPXeyuo2KtKQgQt2CFZPMZY8K3xRzUcmC2cuTOXZamFWpHfhovNJFm0K1aus= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cg/gbNaq; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cg/gbNaq" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-44a786a9b8aso128789f8f.0 for ; Thu, 07 May 2026 10:37:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778175444; x=1778780244; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=T4m72sXmjSg5D7jXc6/EKa8YJmIxljirw3qApIHaCe8=; b=cg/gbNaqN3pnfi/JCDo9JF0f67Wh+2tJYOTJnaOttt+31xpnfLNsy+I8zUJWHYm0ry LWkKQsUrVxpAzksarTPqCdbV8+TSx8cv2P5PR+q+ye+PS5+h6Oyy9TOWb4wBVxdjupZm EXEW211e0ZTRq5RqVAVSC4N90QnrnF27v/wH5u0JE3GcEonFFgsXkV2VnlBH73Xv0ySK /k9fc3nl7QJXqk2omeiRPbEN03baTGt8LnkESY73KPs7KE4oaD1JQO4UAVXaQ/BALV8Y XBRVs1F1JcC3guRsrs0xFlRGMbhM/YA7PGSPpjrS6YzHbC5Z1wbEdHLk5iEGGnVF0VII V5Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778175444; x=1778780244; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=T4m72sXmjSg5D7jXc6/EKa8YJmIxljirw3qApIHaCe8=; b=H5BaH/Mk9aeAQuIeVzJSF0gwt2eszsZmejWstj11WO3+PnvkAQUnG6hyWlXpYnbqo0 rWwBcT7LyOLamjqE/Xzi1lGButYEAMbKZgzy67tAOC7SDB+sia05DO71BjtFuzgCPNLy IU2gcOh4kMaWCOhPWGgGXlHWTwvlIKTTYP1+z45YpeK9yNTHG3Wt7Sl6Ox807ub+DwTp Y7mKzPEPrjoqGASAAlmhthc5eMxiZDzJxj5KcTTmtK5m/+4ocwnkIW4JSnrVE2vVRWWE gpEPm7c9dvREZJpT/95TMY+33MfO2Q6v6RKf4NsLEdFSOWe/HbvgurwbKTni7Bwyxsmw 6vCQ== X-Forwarded-Encrypted: i=1; AFNElJ9YjfVk+g55pdlu3sCYB18OHG1TjCyyGS+wVqPUdzkkjQktT/CPvtoRFsNVa1Lo3nMTxC0MCxHgQxbGX44=@vger.kernel.org X-Gm-Message-State: AOJu0YyYs+C6ke2KtNYF/MnMEDKhXz6JmBen5FgVrMo/e6msHcfGM1wn iA0G+ABAgjSS/owc5F6lkL8jJd+sGbwBUBLcdoq9N6Uwe27+yjCQlrA1 X-Gm-Gg: AeBDieukrKc0VJnHgiiNkHXEqhkJh8WDi+zDZnS0khMgc3hfBLEYvzCZOnJgeMj2URt s3ZJn0NV4j+Tr9/iM12T/MYoYY+jlCG2ujp6scMwTd9a0AKXc+/6C5Yvk6nhacukUoB1sMUWIGk tDzWcbVj+r1FFiqfM0qplz46omHUo6JwEqjgRsHA9KvBWw0O6JJu4NqiwiAROu60sbL9mXoEMh3 5WuKf/NHIvq6AgXiQT0kGhsQ+Z9gDFIrHDRCm3gmDe0bCjG5d4MkxRmYdFEl7S2tCwDawRIA4i4 WAS6KbHY//tmG3BRF9V9aHoU7h3k7BH4Ta1CeYWt3xU7J7B5GXYulI9egbuwtFX5vG+QohY6w4E qTobYtq2JK9SqY2FFGrqf7mLMWua/jkK6pMQlQC5TeAGyt6QyuCxc9BVDlbkwFRi56FdUt7Pd7/ QrEFoycY9pM7UZAdlxHi8y/XC4g9/3ahE5Nwvmxvrki5rA7JA6 X-Received: by 2002:a05:600c:4f82:b0:489:1dc6:d6e with SMTP id 5b1f17b1804b1-48e5325025fmr65769755e9.1.1778175443552; Thu, 07 May 2026 10:37:23 -0700 (PDT) Received: from localhost ([2a03:2880:31ff:31::]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e642e2b29sm1783655e9.1.2026.05.07.10.37.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2026 10:37:23 -0700 (PDT) From: Gustavo Luiz Duarte Date: Thu, 07 May 2026 10:37:07 -0700 Subject: [PATCH RFC 1/2] rcu: Expose per-CPU segmented callback counts via debugfs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260507-rcu-pending-cbs-stats-v1-1-8f4eb3553bc9@gmail.com> References: <20260507-rcu-pending-cbs-stats-v1-0-8f4eb3553bc9@gmail.com> In-Reply-To: <20260507-rcu-pending-cbs-stats-v1-0-8f4eb3553bc9@gmail.com> To: "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Vlastimil Babka , Harry Yoo , Andrew Morton , Hao Li , Christoph Lameter , David Rientjes , Roman Gushchin , Breno Leitao Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Gustavo Luiz Duarte X-Mailer: b4 0.13.0 The existing rcu_segcb_stats tracepoint requires active tracing, so there is no always-on, low-overhead way to inspect how many callbacks are pending on each CPU and at which stage of the grace-period pipeline. Add a debugfs file at /sys/kernel/debug/rcu/pending_cbs that prints per-CPU callback counts broken down by segcblist segment, plus a "total" row aggregating across CPUs: - done: Callbacks ready to invoke (GP completed). - wait: Callbacks waiting for the current GP. - next_ready: Callbacks to be handled by the next GP. - next: Newly queued callbacks not yet assigned a GP. - lazy: Callbacks deferred via the RCU lazy mechanism. The interface has zero steady-state overhead: it reads the existing per-CPU rcu_segcblist.seglen[] counters on demand. These counters are already maintained by the RCU callback infrastructure for its own bookkeeping, so no new runtime accounting is introduced. Example output: cpu done wait next_ready next lazy 0 7 11 0 0 0 1 0 3 2 0 0 2 0 1 8 0 0 3 0 1 1 0 0 total 7 16 11 0 0 Signed-off-by: Gustavo Luiz Duarte --- kernel/rcu/tree_stall.h | 67 +++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 67 insertions(+) diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h index b67532cb8770..d9fc9bfdaf96 100644 --- a/kernel/rcu/tree_stall.h +++ b/kernel/rcu/tree_stall.h @@ -71,6 +71,73 @@ late_initcall(kernel_rcu_stall_sysfs_init); =20 #endif // CONFIG_SYSFS =20 +#ifdef CONFIG_DEBUG_FS + +#include +#include + +/* + * Debugfs interface for displaying per-CPU RCU callback counts broken down + * by callback-list segment. This allows monitoring how many callbacks are + * waiting for grace periods without any steady-state overhead. + */ +static int rcu_pending_cbs_show(struct seq_file *m, void *v) +{ + int cpu; + long done, wait, nxtrdy, nxt, lazy; + long total_done =3D 0, total_wait =3D 0, total_nxtrdy =3D 0; + long total_nxt =3D 0, total_lazy =3D 0; + struct rcu_data *rdp; + struct rcu_segcblist *rsclp; + + seq_printf(m, "%-8s %10s %10s %10s %10s %10s\n", + "cpu", "done", "wait", "next_ready", "next", "lazy"); + + for_each_possible_cpu(cpu) { + rdp =3D per_cpu_ptr(&rcu_data, cpu); + rsclp =3D &rdp->cblist; + + if (!rcu_segcblist_is_enabled(rsclp)) + continue; + + done =3D rcu_segcblist_get_seglen(rsclp, RCU_DONE_TAIL); + wait =3D rcu_segcblist_get_seglen(rsclp, RCU_WAIT_TAIL); + nxtrdy =3D rcu_segcblist_get_seglen(rsclp, RCU_NEXT_READY_TAIL); + nxt =3D rcu_segcblist_get_seglen(rsclp, RCU_NEXT_TAIL); + lazy =3D READ_ONCE(rdp->lazy_len); + + seq_printf(m, "%-8d %10ld %10ld %10ld %10ld %10ld\n", + cpu, done, wait, nxtrdy, nxt, lazy); + + total_done +=3D done; + total_wait +=3D wait; + total_nxtrdy +=3D nxtrdy; + total_nxt +=3D nxt; + total_lazy +=3D lazy; + } + + seq_printf(m, "%-8s %10ld %10ld %10ld %10ld %10ld\n", + "total", total_done, total_wait, total_nxtrdy, + total_nxt, total_lazy); + + return 0; +} +DEFINE_SHOW_ATTRIBUTE(rcu_pending_cbs); + +static struct dentry *rcu_debugfs_dir; + +static int __init rcu_debugfs_init(void) +{ + rcu_debugfs_dir =3D debugfs_create_dir("rcu", NULL); + debugfs_create_file("pending_cbs", 0444, rcu_debugfs_dir, + NULL, &rcu_pending_cbs_fops); + + return 0; +} +late_initcall(rcu_debugfs_init); + +#endif // #ifdef CONFIG_DEBUG_FS + #ifdef CONFIG_PROVE_RCU #define RCU_STALL_DELAY_DELTA (5 * HZ) #else --=20 2.53.0-Meta From nobody Sat Jun 13 11:25:20 2026 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAC8A44D6AC for ; Thu, 7 May 2026 17:37:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778175448; cv=none; b=jrhSDniztJz+yAjqwxa1B7H8TOWAhzvsaBY8yldxmgzzUNqXmlkKlCJAPS1ijHtkMiWeM/qGQbBiOA/Oxz8CqnP1laKipVDfr+eWGwBHpegT8++VOsrJcW/rNCLETyhHlkovki+Jz12zvpCsxRgE8p7Au4gSHSvw8VKZ7svdwSY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778175448; c=relaxed/simple; bh=l7KGEw/jIvRFRP4JsY7iWYkaxDnkz7gre6btZ5ip+6w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=C3t4FO60OLfTcIf2Vn2VGZPe1/BwcAbGQQBW2/aL74VogTU8Y9p2XZmfmj/6qRlsnYFNSXCYq5Ysq4GzuKPh2ALZhkU2uTa73GwelcKKxLnt7WKjeEUIM4zXawTyGdP2aZzk4aCMJV+V/dnxIExPtuv8WJloJWfx778jmxJP1s0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CrBT2vLC; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CrBT2vLC" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-449cdc12a8aso121995f8f.2 for ; Thu, 07 May 2026 10:37:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778175445; x=1778780245; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=7VghPIaZzCAjxosZReVf3XTbKbvkZLjDIPPTIuyF9bg=; b=CrBT2vLCrVUTDc7uz7LhB7xXh7Kr/0C0IpFH5OlO0pGnU/JsgLfJTcyoNjyHhrH+ks 7BchJynWeLMhcFZFPuGRQkDQTfgPU10B/nWrXcB5R6Ywch0YaZn7arcuquHQ0wMiSB99 xnxX11nD/mhI3KmVcvV0NLoYBKaOC6rWemtAHxiA0ffVOb4vQMBkycGs2MfiHM71HYQK pko0g48WnqZEiA3RedtcuJWM1u3BBWyRcmClRd1bSU9xzZneqXE8OTTTuNsKFnJRnwdv 69dvZ6EnUVL6jmZZIndxZJtH38hlKaJERqjQq7PIBVg12ZjX6E/cZp63K6P9kJMDuELO mNQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778175445; x=1778780245; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=7VghPIaZzCAjxosZReVf3XTbKbvkZLjDIPPTIuyF9bg=; b=K0NjNK/R1LD1QhnXDGQf/Tmge4B5+6GHBhCT4+jxp/1SDkhpV5JPKFpha/qqzT54Vn SJAkNjj4x2EJ5ISve7J+1pfz8iCu9bzQtxQEiRa3PeMFJz5TPtVSjFAonGYm79zwt0/y Kn7ySJLsAp4XLp0d1fBUUjidTPwEoD5tiwxFrvhEh1psp424crC7gkGpnSH/FnkQWkP7 A39qkta17uDUs/7A+mSWdT5lA6oeNbaFT/YAfPt+kKlM37kKMIvMIYImwupGDMrvqF5/ yOpNDHMjyhgHgKpAm4qsx/J5tD/oc6ufMlqkvs3Xt7y614UAribuUaOoDzs06IfPBYvp yHsg== X-Forwarded-Encrypted: i=1; AFNElJ/mteiEUjaS76EuObKkW3SKfGqvXC2t07IhPO81bnH2dDpN3IpjWPN3CDWPznxOSqjZfQEUSRmJYf2HBZM=@vger.kernel.org X-Gm-Message-State: AOJu0YwfW/T27JQY3Oy2c5RJW90O5k9A8MvIN7H4qOy7ClRyg4IGJHi0 hz6O0+M1B7lN9tye966oEsmB7is3JtsEt/W0K1X1316qAlmu/TdhpNKl X-Gm-Gg: AeBDieshoCPOKhkGzu3MalJ0NeIMlB+YzvYcAs52Q/DsyrQqkBTU2cVObO+2bmuA7gA Nin3Rw0jwxHJMrGaeqdJ8j91UOJnCdqqQmp6RFbybaVRtbNyzpvuDfdVGmNDmuamsA4R9f1N1LQ B3P33aKCppUxqhHL6sq5xcmV2qerJP/qI4mR6SS6sbTFH+0yZ0RB+xFcNn3FxBBNHlIKLNWon6W P2cdRVYEZwP7Z1HuYLz++zJjuCgaadH50EBqpT9LwZdcjdiqvYompR23HgPL+y9H+aCtu6OJnny AdmmHDsHqebG56Vz72bzg1X3/G5Yr1OxKIjiorvI7E8XhMtAt7XYoW0+C24iwUQ+nrPW00yVL8u ZrCAvdvgebHdPkZQJiwPuUX4TpvrEOQ4m8uRJHLDADaposzJpQtY6t8E8oLkIunbeW8TOb5Jwx5 TrRElBckj7z6ObhalVUYTPNzHB0Y1I7YoS1mBwP0uXhkBqnXxv X-Received: by 2002:a05:600c:4f82:b0:489:1dc6:d6e with SMTP id 5b1f17b1804b1-48e5325025fmr65770315e9.1.1778175445266; Thu, 07 May 2026 10:37:25 -0700 (PDT) Received: from localhost ([2a03:2880:31ff:2a::]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e64300592sm896785e9.13.2026.05.07.10.37.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2026 10:37:24 -0700 (PDT) From: Gustavo Luiz Duarte Date: Thu, 07 May 2026 10:37:08 -0700 Subject: [PATCH RFC 2/2] rcu: Include kfree_rcu/kvfree_rcu batched counts in pending_cbs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260507-rcu-pending-cbs-stats-v1-2-8f4eb3553bc9@gmail.com> References: <20260507-rcu-pending-cbs-stats-v1-0-8f4eb3553bc9@gmail.com> In-Reply-To: <20260507-rcu-pending-cbs-stats-v1-0-8f4eb3553bc9@gmail.com> To: "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Vlastimil Babka , Harry Yoo , Andrew Morton , Hao Li , Christoph Lameter , David Rientjes , Roman Gushchin , Breno Leitao Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Gustavo Luiz Duarte X-Mailer: b4 0.13.0 The batched kfree_rcu()/kvfree_rcu() path (CONFIG_KVFREE_RCU_BATCHED) manages its own per-CPU queues in struct kfree_rcu_cpu, bypassing the main RCU segmented callback list. Objects queued through this path were not visible in the debugfs pending_cbs file. Add a kfree_rcu_pending() helper that returns the number of objects waiting in the kfree_rcu batching layer for a given CPU, and include this count as a "kfree_rcu" column in the debugfs output. Example output: cpu done wait next_ready next lazy kfree_rcu 0 0 0 0 5 5 12 1 0 0 0 3 3 8 total 0 0 0 8 8 20 Signed-off-by: Gustavo Luiz Duarte --- kernel/rcu/rcu.h | 1 + kernel/rcu/tree_stall.h | 17 +++++++++++------ mm/slab_common.c | 18 ++++++++++++++++++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h index fa6d30ce73d1..a28c3c7dc4da 100644 --- a/kernel/rcu/rcu.h +++ b/kernel/rcu/rcu.h @@ -652,6 +652,7 @@ void rcu_fwd_progress_check(unsigned long j); void rcu_force_quiescent_state(void); extern struct workqueue_struct *rcu_gp_wq; extern struct kthread_worker *rcu_exp_gp_kworker; +int kfree_rcu_pending(int cpu); void rcu_gp_slow_register(atomic_t *rgssp); void rcu_gp_slow_unregister(atomic_t *rgssp); #endif /* #else #ifdef CONFIG_TINY_RCU */ diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h index d9fc9bfdaf96..5fd63730d5f5 100644 --- a/kernel/rcu/tree_stall.h +++ b/kernel/rcu/tree_stall.h @@ -84,14 +84,17 @@ late_initcall(kernel_rcu_stall_sysfs_init); static int rcu_pending_cbs_show(struct seq_file *m, void *v) { int cpu; + int kfree; long done, wait, nxtrdy, nxt, lazy; long total_done =3D 0, total_wait =3D 0, total_nxtrdy =3D 0; long total_nxt =3D 0, total_lazy =3D 0; + int total_kfree =3D 0; struct rcu_data *rdp; struct rcu_segcblist *rsclp; =20 - seq_printf(m, "%-8s %10s %10s %10s %10s %10s\n", - "cpu", "done", "wait", "next_ready", "next", "lazy"); + seq_printf(m, "%-8s %10s %10s %10s %10s %10s %10s\n", + "cpu", "done", "wait", "next_ready", "next", "lazy", + "kfree_rcu"); =20 for_each_possible_cpu(cpu) { rdp =3D per_cpu_ptr(&rcu_data, cpu); @@ -105,20 +108,22 @@ static int rcu_pending_cbs_show(struct seq_file *m, v= oid *v) nxtrdy =3D rcu_segcblist_get_seglen(rsclp, RCU_NEXT_READY_TAIL); nxt =3D rcu_segcblist_get_seglen(rsclp, RCU_NEXT_TAIL); lazy =3D READ_ONCE(rdp->lazy_len); + kfree =3D kfree_rcu_pending(cpu); =20 - seq_printf(m, "%-8d %10ld %10ld %10ld %10ld %10ld\n", - cpu, done, wait, nxtrdy, nxt, lazy); + seq_printf(m, "%-8d %10ld %10ld %10ld %10ld %10ld %10d\n", + cpu, done, wait, nxtrdy, nxt, lazy, kfree); =20 total_done +=3D done; total_wait +=3D wait; total_nxtrdy +=3D nxtrdy; total_nxt +=3D nxt; total_lazy +=3D lazy; + total_kfree +=3D kfree; } =20 - seq_printf(m, "%-8s %10ld %10ld %10ld %10ld %10ld\n", + seq_printf(m, "%-8s %10ld %10ld %10ld %10ld %10ld %10d\n", "total", total_done, total_wait, total_nxtrdy, - total_nxt, total_lazy); + total_nxt, total_lazy, total_kfree); =20 return 0; } diff --git a/mm/slab_common.c b/mm/slab_common.c index d5a70a831a2a..93b5d64399f2 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -1280,6 +1280,11 @@ void kvfree_call_rcu(struct rcu_head *head, void *pt= r) } EXPORT_SYMBOL_GPL(kvfree_call_rcu); =20 +int kfree_rcu_pending(int cpu) +{ + return 0; +} + void __init kvfree_rcu_init(void) { } @@ -2216,4 +2221,17 @@ void __init kvfree_rcu_init(void) shrinker_register(kfree_rcu_shrinker); } =20 +/** + * kfree_rcu_pending() - Return number of objects pending in kfree_rcu bat= ches. + * @cpu: CPU number to query. + * + * Returns the number of objects queued in kfree_rcu()/kvfree_rcu() batches + * on @cpu that are waiting for a grace period. These objects are tracked + * separately from the main RCU callback list. + */ +int kfree_rcu_pending(int cpu) +{ + return krc_count(per_cpu_ptr(&krc, cpu)); +} + #endif /* CONFIG_KVFREE_RCU_BATCHED */ --=20 2.53.0-Meta