Messages in this thread Patch in this message | | | From | "Uladzislau Rezki (Sony)" <> | Subject | [PATCH v1 2/5] kvfree_rcu: Switch to vfree_bulk() in kfree_rcu_work() | Date | Wed, 28 Apr 2021 15:44:19 +0200 |
| |
Replace calling a vfree() in a loop per object by the vfree_bulk() variant. In that case we just need to pass an array of vmalloc'ed pointers and number of elements in it.
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com> --- kernel/rcu/tree.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 9ea1d4eef1ad..6bf170d01cd5 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3280,7 +3280,7 @@ static void kfree_rcu_work(struct work_struct *work) struct rcu_head *head, *next; struct kfree_rcu_cpu *krcp; struct kfree_rcu_cpu_work *krwp; - int i, j; + int i; krwp = container_of(to_rcu_work(work), struct kfree_rcu_cpu_work, rcu_work); @@ -3313,13 +3313,7 @@ static void kfree_rcu_work(struct work_struct *work) kfree_bulk(bkvhead[i]->nr_records, bkvhead[i]->records); } else { // vmalloc() / vfree(). - for (j = 0; j < bkvhead[i]->nr_records; j++) { - trace_rcu_invoke_kvfree_callback( - rcu_state.name, - bkvhead[i]->records[j], 0); - - vfree(bkvhead[i]->records[j]); - } + vfree_bulk(bkvhead[i]->nr_records, bkvhead[i]->records); } rcu_lock_release(&rcu_callback_map); -- 2.20.1
| |