Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp32692ybb; Fri, 27 Mar 2020 15:27:55 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu9YGDG/CQOdDeVugq4JTmOfO2YomkghqD/+9adYreV8g3LpMLxTg9sv5UWP8aFcxVc/ij1 X-Received: by 2002:aca:130f:: with SMTP id e15mr801606oii.160.1585348075614; Fri, 27 Mar 2020 15:27:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585348075; cv=none; d=google.com; s=arc-20160816; b=k0ENheuWxwu3boxMGrJD7BVehI2f9bdyQtig1ZdF/vXmC/Ad0gIssjg70/+K+e18py Aq1et9R5pXMWH5PR/JCtuzPoh0rqf5laYJxC6A0uJVTcWzxl+y4+Fp6m9+92nS0QVcyW Tw1KxNADKJSUdnTUop1QrBDVBmIihOqEkrpIJfEqFxpWV9K8OrH7khFEhkF0DlNLfgVQ /T/OPioZRmghOnnOGgApIeb1dJlWjURkd/dfLFiHdESnnSrXlxB2cw5oZ0wspBLcaLCu dmjMgECeG38EzuiKuXvehHcEhnpbzOLudKHbx2qBDjrHx/4gLr0NmX5A1PW0KkpXora0 7vnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=tpsqSIAEL2THNcLGx+QHJ/1b685OgEUO10B5dcxvkMY=; b=YBK+eusjTXi2WyCRyG7+vlM8/C6ySyO9opZjiZyUjShL6VWjVxI2KcXxq8mdCAnZqg 9eMsBcSZXRjfRPjOpWISTrW9Hf0o+pvZqyeXqqBiyr8JU/9OVwHLsERJBHRfwgcnIIfa 6QRY1s5YKmSyJwx3DfTfIekSJgofU2kYoEq3w0T40b8utijWmFNe+Nl+jVknJCBltHEB na0BMMREMYhOoMb2dEIxbk5OZBrFrGiJFOaI90L9/VxHNYE3UJv83KUTXIiv4zMGAQ4a IEPZ8Kgb+/hftTtlmqfntEJSvAQlUC3ozP9GI1LPkgTGYUbqViZhwARNPk+f3yJKoGas xJDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Gdl4q6co; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z29si2889140oog.56.2020.03.27.15.27.42; Fri, 27 Mar 2020 15:27:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Gdl4q6co; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728104AbgC0WZ6 (ORCPT + 99 others); Fri, 27 Mar 2020 18:25:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:43254 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727857AbgC0WZI (ORCPT ); Fri, 27 Mar 2020 18:25:08 -0400 Received: from paulmck-ThinkPad-P72.home (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4B99E216FD; Fri, 27 Mar 2020 22:25:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585347906; bh=bzEBBx1NMqRoc2oUn+LWRfpri+mzDzy4uPnalAtsjCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gdl4q6coniYgo4uyWFywW/lHIeBmfycAA5OglSdv/z0+7REr8GZ/uQyVrXiSOOfIx OAtrPflXM7WERAk53Bp1gUyDS18rLVgNwpzYRa71pNBcBy2AmPJvmU5limZUKkvwd2 gaTHps1wrPI5hFoO2yc/XzeHo4hQQlQKjitsvGQQ= From: paulmck@kernel.org To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org, "Paul E. McKenney" Subject: [PATCH v3 tip/core/rcu 24/34] rcu-tasks: Add grace-period and IPI counts to statistics Date: Fri, 27 Mar 2020 15:24:46 -0700 Message-Id: <20200327222456.12470-24-paulmck@kernel.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20200327222346.GA12082@paulmck-ThinkPad-P72> References: <20200327222346.GA12082@paulmck-ThinkPad-P72> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Paul E. McKenney" This commit adds a grace-period count and a count of IPIs sent since boot, which is printed in response to rcutorture writer stalls and at the end of rcutorture testing. These counts will be used to evaluate various schemes to reduce the number of IPIs sent. Signed-off-by: Paul E. McKenney --- kernel/rcu/tasks.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index 4150f8d..f9a828c 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -30,6 +30,8 @@ typedef void (*postgp_func_t)(struct rcu_tasks *rtp); * @gp_state: Grace period's most recent state transition (debugging). * @gp_jiffies: Time of last @gp_state transition. * @gp_start: Most recent grace-period start in jiffies. + * @n_gps: Number of grace periods completed since boot. + * @n_ipis: Number of IPIs sent to encourage grace periods to end. * @pregp_func: This flavor's pre-grace-period function (optional). * @pertask_func: This flavor's per-task scan function (optional). * @postscan_func: This flavor's post-task scan function (optional). @@ -47,6 +49,8 @@ struct rcu_tasks { int gp_state; unsigned long gp_jiffies; unsigned long gp_start; + unsigned long n_gps; + unsigned long n_ipis; struct task_struct *kthread_ptr; rcu_tasks_gp_func_t gp_func; pregp_func_t pregp_func; @@ -208,6 +212,7 @@ static int __noreturn rcu_tasks_kthread(void *arg) set_tasks_gp_state(rtp, RTGS_WAIT_GP); rtp->gp_start = jiffies; rtp->gp_func(rtp); + rtp->n_gps++; /* Invoke the callbacks. */ set_tasks_gp_state(rtp, RTGS_INVOKE_CBS); @@ -285,11 +290,12 @@ static void __init rcu_tasks_bootup_oddness(void) /* Dump out rcutorture-relevant state common to all RCU-tasks flavors. */ static void show_rcu_tasks_generic_gp_kthread(struct rcu_tasks *rtp, char *s) { - pr_info("%s: %s(%d) since %lu %c%c %s\n", + pr_info("%s: %s(%d) since %lu g:%lu i:%lu %c%c %s\n", rtp->kname, tasks_gp_state_getname(rtp), data_race(rtp->gp_state), jiffies - data_race(rtp->gp_jiffies), + data_race(rtp->n_gps), data_race(rtp->n_ipis), ".k"[!!data_race(rtp->kthread_ptr)], ".C"[!!data_race(rtp->cbs_head)], s); @@ -592,6 +598,7 @@ static void rcu_tasks_be_rude(struct work_struct *work) // Wait for one rude RCU-tasks grace period. static void rcu_tasks_rude_wait_gp(struct rcu_tasks *rtp) { + rtp->n_ipis += cpumask_weight(cpu_online_mask); schedule_on_each_cpu(rcu_tasks_be_rude); } @@ -852,6 +859,7 @@ static void trc_wait_for_one_reader(struct task_struct *t, atomic_inc(&trc_n_readers_need_end); per_cpu(trc_ipi_to_cpu, cpu) = true; t->trc_ipi_to_cpu = cpu; + rcu_tasks_trace.n_ipis++; if (smp_call_function_single(cpu, trc_read_check_handler, t, 0)) { // Just in case there is some other reason for -- 2.9.5