[PATCH v1 5/5] kvfree_rcu: Fix comments according to current code

From: Uladzislau Rezki (Sony)
Date: Wed Apr 28 2021 - 09:45:25 EST


We used to have an "emergency path" and comments related
to it. According to current kvfree_rcu() design that path
is not considered as emergency anymore.

This patch rephrases and updates comments regarding this.

Signed-off-by: Uladzislau Rezki (Sony) <urezki@xxxxxxxxx>
---
kernel/rcu/tree.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 229e909ad437..91b978e90c3b 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3332,9 +3332,11 @@ static void kfree_rcu_work(struct work_struct *work)
}

/*
- * Emergency case only. It can happen under low memory
- * condition when an allocation gets failed, so the "bulk"
- * path can not be temporary maintained.
+ * This is used when the "bulk" path can not be temporary
+ * maintained for the double-argument of kvfree_rcu(). It
+ * happens because a page-cache is empty, thus objects are
+ * queued to the linked-list instead. This path is named
+ * as "Channel 3".
*/
for (; head; head = next) {
unsigned long offset = (unsigned long)head->func;
@@ -3380,8 +3382,8 @@ static inline bool queue_kfree_rcu_work(struct kfree_rcu_cpu *krcp)
if ((krcp->bkvhead[0] && !krwp->bkvhead_free[0]) ||
(krcp->bkvhead[1] && !krwp->bkvhead_free[1]) ||
(krcp->head && !krwp->head_free)) {
- // Channel 1 corresponds to SLAB ptrs.
- // Channel 2 corresponds to vmalloc ptrs.
+ // Channel 1 corresponds to SLAB ptrs. bulk path.
+ // Channel 2 corresponds to vmalloc ptrs. bulk path.
for (j = 0; j < FREE_N_CHANNELS; j++) {
if (!krwp->bkvhead_free[j]) {
krwp->bkvhead_free[j] = krcp->bkvhead[j];
@@ -3389,7 +3391,8 @@ static inline bool queue_kfree_rcu_work(struct kfree_rcu_cpu *krcp)
}
}

- // Channel 3 corresponds to emergency path.
+ // Channel 3 corresponds to objects queued to the
+ // linked-list for both SLAB and vmalloc pointers.
if (!krwp->head_free) {
krwp->head_free = krcp->head;
krcp->head = NULL;
--
2.20.1