]> www.infradead.org Git - linux.git/commit
rcu: Delete a redundant check in rcu_check_gp_kthread_starvation()
authorZhen Lei <thunder.leizhen@huawei.com>
Wed, 12 Jul 2023 15:15:56 +0000 (23:15 +0800)
committerFrederic Weisbecker <frederic@kernel.org>
Mon, 11 Sep 2023 19:45:29 +0000 (21:45 +0200)
commitb934b7ff5ea755473d9737d79ab303722ceba22e
treed87392f51db884d7231da3cb3ec7f8d78bb58dff
parent0bb80ecc33a8fb5a682236443c1e740d5c917d1d
rcu: Delete a redundant check in rcu_check_gp_kthread_starvation()

The rcu_check_gp_kthread_starvation() function uses task_cpu() to sample
the last CPU that the grace-period kthread ran on, and task_cpu() samples
the thread_info structure's ->cpu field.  But this field will always
contain a number corresponding to a CPU that was online some time in
the past, thus never a negative number.  This invariant is checked by
a WARN_ON_ONCE() in set_task_cpu().

This means that if the grace-period kthread exists, that is, if the "gpk"
local variable is non-NULL, the "cpu" local variable will be non-negative.
This in turn means that the existing check for non-negative "cpu" is
redundant with the enclosing check for non-NULL "gpk".

This commit threefore removes the redundant check of "cpu".

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
kernel/rcu/tree_stall.h