diff mbox series

rcu-tasks: Stop RCU Tasks scanning tasks which record on dyntick-idle entry

Message ID 20220520045645.1692124-1-qiang1.zhang@intel.com (mailing list archive)
State Superseded
Headers show
Series rcu-tasks: Stop RCU Tasks scanning tasks which record on dyntick-idle entry | expand

Commit Message

Zqiang May 20, 2022, 4:56 a.m. UTC
When the RCU Tasks scanning on-rq tasks, there is no need to scanning
tasks which record on dyntick-idle entry, at this time, these tasks are
not remain within an RCU Tasks read-side critical section.

This commit skip scanning tasks which record on dyntick-idle entry in
rcu_tasks_pertask().

Signed-off-by: Zqiang <qiang1.zhang@intel.com>
---
 kernel/rcu/tasks.h | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

kernel test robot May 20, 2022, 7:33 a.m. UTC | #1
Hi Zqiang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on paulmck-rcu/dev]
[also build test ERROR on v5.18-rc7 next-20220519]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Zqiang/rcu-tasks-Stop-RCU-Tasks-scanning-tasks-which-record-on-dyntick-idle-entry/20220520-125904
base:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev
config: m68k-defconfig (https://download.01.org/0day-ci/archive/20220520/202205201526.INo2g6TS-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/47ee19cf17eefb7dd696eabb583e5dcba4cd89e1
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Zqiang/rcu-tasks-Stop-RCU-Tasks-scanning-tasks-which-record-on-dyntick-idle-entry/20220520-125904
        git checkout 47ee19cf17eefb7dd696eabb583e5dcba4cd89e1
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from kernel/rcu/update.c:606:
   kernel/rcu/tasks.h: In function 'task_is_on_dyntick_idle':
>> kernel/rcu/tasks.h:212:34: error: 'struct task_struct' has no member named 'rcu_tasks_idle_cpu'
     212 |                                 t->rcu_tasks_idle_cpu >= 0;
         |                                  ^~
   At top level:
   kernel/rcu/tasks.h:209:13: warning: 'task_is_on_dyntick_idle' defined but not used [-Wunused-function]
     209 | static bool task_is_on_dyntick_idle(struct task_struct *t)
         |             ^~~~~~~~~~~~~~~~~~~~~~~


vim +212 kernel/rcu/tasks.h

   208	
   209	static bool task_is_on_dyntick_idle(struct task_struct *t)
   210	{
   211		return IS_ENABLED(CONFIG_NO_HZ_FULL) && !is_idle_task(t) &&
 > 212					t->rcu_tasks_idle_cpu >= 0;
   213	}
   214
diff mbox series

Patch

diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index f6459343e4b6..7898da987581 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -206,6 +206,12 @@  static void set_tasks_gp_state(struct rcu_tasks *rtp, int newstate)
 	rtp->gp_jiffies = jiffies;
 }
 
+static bool task_is_on_dyntick_idle(struct task_struct *t)
+{
+	return IS_ENABLED(CONFIG_NO_HZ_FULL) && !is_idle_task(t) &&
+				t->rcu_tasks_idle_cpu >= 0;
+}
+
 #ifndef CONFIG_TINY_RCU
 /* Return state name. */
 static const char *tasks_gp_state_getname(struct rcu_tasks *rtp)
@@ -812,7 +818,8 @@  static void rcu_tasks_pregp_step(struct list_head *hop)
 /* Per-task initial processing. */
 static void rcu_tasks_pertask(struct task_struct *t, struct list_head *hop)
 {
-	if (t != current && READ_ONCE(t->on_rq) && !is_idle_task(t)) {
+	if (t != current && READ_ONCE(t->on_rq) && !is_idle_task(t) &&
+				!task_is_on_dyntick_idle(t)) {
 		get_task_struct(t);
 		t->rcu_tasks_nvcsw = READ_ONCE(t->nvcsw);
 		WRITE_ONCE(t->rcu_tasks_holdout, true);
@@ -842,8 +849,7 @@  static void check_holdout_task(struct task_struct *t,
 	if (!READ_ONCE(t->rcu_tasks_holdout) ||
 	    t->rcu_tasks_nvcsw != READ_ONCE(t->nvcsw) ||
 	    !READ_ONCE(t->on_rq) ||
-	    (IS_ENABLED(CONFIG_NO_HZ_FULL) &&
-	     !is_idle_task(t) && t->rcu_tasks_idle_cpu >= 0)) {
+	    task_is_on_dyntick_idle(t)) {
 		WRITE_ONCE(t->rcu_tasks_holdout, false);
 		list_del_init(&t->rcu_tasks_holdout_list);
 		put_task_struct(t);