rcu/kvfree: Add debug check for GP complete for kfree_rcu_cpu list
authorUladzislau Rezki (Sony) <urezki@gmail.com>
Tue, 4 Apr 2023 14:13:00 +0000 (16:13 +0200)
committerPaul E. McKenney <paulmck@kernel.org>
Wed, 10 May 2023 00:26:21 +0000 (17:26 -0700)
commitf32276a37652a9ce05db27cdfb40ac3e3fc98f9f
treea111e1d34cb2a7e9b7a2c63d10ae421712535992
parentcdfa0f6fa6b7183c062046043b649b9a91e3ac52
rcu/kvfree: Add debug check for GP complete for kfree_rcu_cpu list

Under low-memory conditions, kvfree_rcu() will use each object's
rcu_head structure to queue objects in a singly linked list headed by
the kfree_rcu_cpu structure's ->head field.  This list is passed to
call_rcu() as a unit, but there is no indication of which grace period
this list needs to wait for.  This in turn prevents adding debug checks
in the kfree_rcu_work() as was done for the two page-of-pointers channels
in the kfree_rcu_cpu structure.

This commit therefore adds a ->head_free_gp_snap field to the
kfree_rcu_cpu_work structure to record this grace-period number.  It also
adds a WARN_ON_ONCE() to kfree_rcu_monitor() that checks to make sure
that the required grace period has in fact elapsed.

[ paulmck: Fix kerneldoc issue raised by Stephen Rothwell. ]

Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/tree.c