Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp115014ybt; Thu, 18 Jun 2020 20:05:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxI+4HpHurmbF3GFGD8S1M3b3qbCiJGSUEGsK/+WUuI4tz2tvvfzC+OrLcABUC40I/P+s3s X-Received: by 2002:a17:906:35cf:: with SMTP id p15mr1668085ejb.520.1592535912677; Thu, 18 Jun 2020 20:05:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592535912; cv=none; d=google.com; s=arc-20160816; b=JSh5yyYUlDO1u/XJ8ULAEl7fRcY2iY+sH2/kTRTdt6t0cmaLjv7X3QPdLq4bzkkD4F KEbYR2+yoc8UG0D86hnOMOpN7ct5kKV/MKypyky6DyieBe9EJ0VQRUA2yvQZArxcssuh FcPQD+YrxvHvMtHuIb3AKzMI1rUwZAbNfGR4iG6FgOqyjdaTIcHmSeaiyhDuJKJQRvXU acp7NEBPyh4ai5V0wS6IKCUo78DQqtFrkpdFYF1oLc1ts32sFORU+mo3pAeplMyLCczI 6nRXDzcHm8DdhC2w7BYXcuWt/qWytRbIODpgwQH4lg6POwVOMH0OqMgF6Sh+vwJACi3Z mKiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=9LXCKpP66qwXI671DYA6UPeNjnt6Enj2C4p4ett9VYY=; b=bp/6o7i2Py5OEkCagW5YWMbN9A5ILqyZeI1VjmsentYU9CMkusOmMQqp9wut0Roitt WDzhbcI68d5h10H2dQx9z3MVamXyL7pplJClKf54Iq0QWwQ7b2apFbi8dZBiepsCCyut BrRdRYQZY/eJ64IKB71Jz5maAJqtQKjYBtotaVDr+HkJvJlrRyW6EVdCIvvjQgJsbV7D Jq68QEuF8pn+jc1QE1map9k8qBrt9kGbssr/YsfocFyOx+qt4ZBd9Ix//J600AHCZjMC LCwlSprzpqVPaaOdRABmOGoHifhP7WyJUq+We7KdFcACttvfvSrEiBR9cC1pLb+vQlJq g9IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=XeX5C7Rb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y3si2862755edq.381.2020.06.18.20.04.48; Thu, 18 Jun 2020 20:05:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=XeX5C7Rb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729800AbgFSBAR (ORCPT + 99 others); Thu, 18 Jun 2020 21:00:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729754AbgFSBAQ (ORCPT ); Thu, 18 Jun 2020 21:00:16 -0400 Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6E5CC06174E for ; Thu, 18 Jun 2020 18:00:14 -0700 (PDT) Received: by mail-qt1-x843.google.com with SMTP id i16so6036280qtr.7 for ; Thu, 18 Jun 2020 18:00:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=9LXCKpP66qwXI671DYA6UPeNjnt6Enj2C4p4ett9VYY=; b=XeX5C7RbLpLfj/NF/9QQ5oE0/gq5Qb35Hx/00pT6xrl5zj9FIVTPRbnPZnEPHolwBg xXxbPZs6htDEE0uAYB9uEn04NludFSK+0P47Ivy2ewRMj1KSr9Cqn0ugJJD21EV+3Fq2 ASGyYjHICwld1BuQLivZSeNJT6PoKSx81r+uk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=9LXCKpP66qwXI671DYA6UPeNjnt6Enj2C4p4ett9VYY=; b=E8Q18nHfz74f1AN9gTzDGeIuuDD0M8BYSfqhnaUjrzf0Xg4aPlWGjZfbTHwZEpidMv zRMqqTkbaXV1SeDiGQCpF0sB9L6Iy0IRjV1ytOIj7UfflEUE8W+bfDh0al19NsFhpzIL +rvmI5zvC9Gyrigw2Qh6m0fhekMoxK4WN3Z25Z1iznAU6XfX7rNJvVm4fY4+mueIqnGg Ie2wYiJJ00kllW9eionaxc8XyjT8AFGXsKRM17y2MEHI9hq/G/Pdb67c46V6Q+hb6jSP /3zMU8VfGnTkylv6qYK9118a5OKP4qWNyjWPmlOVLubKMCPEFPY5QS675YiUxR6y2L7q wHXw== X-Gm-Message-State: AOAM532tbGY4+cbH5UwOlNj3YS4SHqUNOnyjhaqpADN6CEJuy/Y738l/ GB2XN3uqPJ3KmYlMi/HmsFgecA== X-Received: by 2002:ac8:31f9:: with SMTP id i54mr943075qte.209.1592528413446; Thu, 18 Jun 2020 18:00:13 -0700 (PDT) Received: from localhost ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id i19sm4652426qkh.71.2020.06.18.18.00.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2020 18:00:12 -0700 (PDT) Date: Thu, 18 Jun 2020 21:00:12 -0400 From: Joel Fernandes To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, Davidlohr Bueso , Ingo Molnar , Josh Triplett , Lai Jiangshan , Marco Elver , Mathieu Desnoyers , rcu@vger.kernel.org, Steven Rostedt , "Uladzislau Rezki (Sony)" Subject: Re: [PATCH 6/7] rcutorture: Add support to get the number of wakeups of main GP kthread Message-ID: <20200619010012.GG40119@google.com> References: <20200618202955.4024-1-joel@joelfernandes.org> <20200618202955.4024-6-joel@joelfernandes.org> <20200618224058.GD2723@paulmck-ThinkPad-P72> <20200619000156.GD40119@google.com> <20200619001244.GG2723@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200619001244.GG2723@paulmck-ThinkPad-P72> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 18, 2020 at 05:12:44PM -0700, Paul E. McKenney wrote: > On Thu, Jun 18, 2020 at 08:01:56PM -0400, Joel Fernandes wrote: > > On Thu, Jun 18, 2020 at 03:40:58PM -0700, Paul E. McKenney wrote: > > > On Thu, Jun 18, 2020 at 04:29:54PM -0400, Joel Fernandes (Google) wrote: > > > > This is useful to check for any improvements or degradation related to > > > > number of GP kthread wakeups during testing. > > > > > > > > Signed-off-by: Joel Fernandes (Google) > > > > > > This was a good way to collect the data for your testing, but > > > we can expect rcutorture to only do so much. ;-) > > > > np, I will push this one into a git tag for the next time I need it ;) > > Sounds like a plan! In case it is at all an option, I could put this as a statistic under rcu_torture_stats_print(), that way it all is on the same line. But I take it you are not too thrilled to have it for now. thanks, - Joel > Thanx, Paul > > > thanks, > > > > - Joel > > > > > > > Thanx, Paul > > > > > > > --- > > > > kernel/rcu/Kconfig.debug | 1 + > > > > kernel/rcu/rcu.h | 2 ++ > > > > kernel/rcu/rcutorture.c | 23 ++++++++++++++++++++++- > > > > kernel/rcu/tree.c | 7 +++++++ > > > > 4 files changed, 32 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/kernel/rcu/Kconfig.debug b/kernel/rcu/Kconfig.debug > > > > index 3cf6132a4bb9f..3323e3378af5a 100644 > > > > --- a/kernel/rcu/Kconfig.debug > > > > +++ b/kernel/rcu/Kconfig.debug > > > > @@ -50,6 +50,7 @@ config RCU_TORTURE_TEST > > > > select TASKS_RCU > > > > select TASKS_RUDE_RCU > > > > select TASKS_TRACE_RCU > > > > + select SCHEDSTATS > > > > default n > > > > help > > > > This option provides a kernel module that runs torture tests > > > > diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h > > > > index cf66a3ccd7573..7e867e81d9738 100644 > > > > --- a/kernel/rcu/rcu.h > > > > +++ b/kernel/rcu/rcu.h > > > > @@ -511,6 +511,7 @@ srcu_batches_completed(struct srcu_struct *sp) { return 0; } > > > > static inline void rcu_force_quiescent_state(void) { } > > > > static inline void show_rcu_gp_kthreads(void) { } > > > > static inline int rcu_get_gp_kthreads_prio(void) { return 0; } > > > > +static inline struct task_struct *rcu_get_main_gp_kthread(void) { return 0; } > > > > static inline void rcu_fwd_progress_check(unsigned long j) { } > > > > #else /* #ifdef CONFIG_TINY_RCU */ > > > > bool rcu_dynticks_zero_in_eqs(int cpu, int *vp); > > > > @@ -519,6 +520,7 @@ unsigned long rcu_exp_batches_completed(void); > > > > unsigned long srcu_batches_completed(struct srcu_struct *sp); > > > > void show_rcu_gp_kthreads(void); > > > > int rcu_get_gp_kthreads_prio(void); > > > > +struct task_struct *rcu_get_main_gp_kthread(void); > > > > void rcu_fwd_progress_check(unsigned long j); > > > > void rcu_force_quiescent_state(void); > > > > extern struct workqueue_struct *rcu_gp_wq; > > > > diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c > > > > index d0d265304d147..959a1f84d6904 100644 > > > > --- a/kernel/rcu/rcutorture.c > > > > +++ b/kernel/rcu/rcutorture.c > > > > @@ -23,6 +23,7 @@ > > > > #include > > > > #include > > > > #include > > > > +#include > > > > #include > > > > #include > > > > #include > > > > @@ -460,9 +461,29 @@ static void rcu_sync_torture_init(void) > > > > INIT_LIST_HEAD(&rcu_torture_removed); > > > > } > > > > > > > > +unsigned long rcu_gp_nr_wakeups; > > > > + > > > > +static void rcu_flavor_init(void) > > > > +{ > > > > + rcu_sync_torture_init(); > > > > + > > > > + /* Make sure schedstat is enabled for GP thread wakeup count. */ > > > > + force_schedstat_enabled(); > > > > + rcu_gp_nr_wakeups = rcu_get_main_gp_kthread()->se.statistics.nr_wakeups; > > > > +} > > > > + > > > > +static void rcu_flavor_cleanup(void) > > > > +{ > > > > + unsigned long now_nr = rcu_get_main_gp_kthread()->se.statistics.nr_wakeups; > > > > + > > > > + pr_alert("End-test: Cleanup: Total GP-kthread wakeups: %lu\n", > > > > + now_nr - rcu_gp_nr_wakeups); > > > > +} > > > > + > > > > static struct rcu_torture_ops rcu_ops = { > > > > .ttype = RCU_FLAVOR, > > > > - .init = rcu_sync_torture_init, > > > > + .init = rcu_flavor_init, > > > > + .cleanup = rcu_flavor_cleanup, > > > > .readlock = rcu_torture_read_lock, > > > > .read_delay = rcu_read_delay, > > > > .readunlock = rcu_torture_read_unlock, > > > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > > > > index c3bae7a83d792..a3a175feb310a 100644 > > > > --- a/kernel/rcu/tree.c > > > > +++ b/kernel/rcu/tree.c > > > > @@ -175,6 +175,13 @@ int rcu_get_gp_kthreads_prio(void) > > > > } > > > > EXPORT_SYMBOL_GPL(rcu_get_gp_kthreads_prio); > > > > > > > > +/* Retrieve RCU's main GP kthread task_struct */ > > > > +struct task_struct *rcu_get_main_gp_kthread(void) > > > > +{ > > > > + return rcu_state.gp_kthread; > > > > +} > > > > +EXPORT_SYMBOL_GPL(rcu_get_main_gp_kthread); > > > > + > > > > /* > > > > * Number of grace periods between delays, normalized by the duration of > > > > * the delay. The longer the delay, the more the grace periods between > > > > -- > > > > 2.27.0.111.gc72c7da667-goog > > > >