]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
rcu: Remove kfree_call_rcu_nobatch()
authorJoel Fernandes (Google) <joel@joelfernandes.org>
Fri, 30 Aug 2019 16:36:33 +0000 (12:36 -0400)
committerPaul E. McKenney <paulmck@kernel.org>
Fri, 24 Jan 2020 18:24:31 +0000 (10:24 -0800)
Now that the kfree_rcu() special-casing has been removed from tree RCU,
this commit removes kfree_call_rcu_nobatch() since it is no longer needed.

Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Documentation/admin-guide/kernel-parameters.txt
include/linux/rcutiny.h
include/linux/rcutree.h
kernel/rcu/rcuperf.c
kernel/rcu/tree.c

index 3ce270b56f3a69e133b82c5c98aaf400e43f252a..ed83d6d90cc321cd378c0a4bdd298dfdbfccc05e 100644 (file)
                        Number of loops doing rcuperf.kfree_alloc_num number
                        of allocations and frees.
 
-       rcuperf.kfree_no_batch= [KNL]
-                       Use the non-batching (less efficient) version of kfree_rcu().
-                       This is useful for comparing with the batched version.
-
        rcuperf.nreaders= [KNL]
                        Set number of RCU readers.  The value -1 selects
                        N, where N is the number of CPUs.  A value
index 1bd166aab6f32071da09e8aea638acd81ec1e58a..b2b2dc990da99b7cb0191a6c380dffccc0b58c3e 100644 (file)
@@ -39,11 +39,6 @@ static inline void kfree_call_rcu(struct rcu_head *head, rcu_callback_t func)
        call_rcu(head, func);
 }
 
-static inline void kfree_call_rcu_nobatch(struct rcu_head *head, rcu_callback_t func)
-{
-       call_rcu(head, func);
-}
-
 void rcu_qs(void);
 
 static inline void rcu_softirq_qs(void)
index 6a65d3a16dbd545b232f2f06bcf6b70c61addd8f..2f787b9029d1ed0770da54db6d1a6b0ae89d7849 100644 (file)
@@ -34,7 +34,6 @@ static inline void rcu_virt_note_context_switch(int cpu)
 
 void synchronize_rcu_expedited(void);
 void kfree_call_rcu(struct rcu_head *head, rcu_callback_t func);
-void kfree_call_rcu_nobatch(struct rcu_head *head, rcu_callback_t func);
 
 void rcu_barrier(void);
 bool rcu_eqs_special_set(int cpu);
index c1e25fd10f2a9c1984fe805a1d80ab0b4cbf60f8..da94b89cd531078c54ddaacfb1dce4a4d770484d 100644 (file)
@@ -593,7 +593,6 @@ rcu_perf_shutdown(void *arg)
 torture_param(int, kfree_nthreads, -1, "Number of threads running loops of kfree_rcu().");
 torture_param(int, kfree_alloc_num, 8000, "Number of allocations and frees done in an iteration.");
 torture_param(int, kfree_loops, 10, "Number of loops doing kfree_alloc_num allocations and frees.");
-torture_param(int, kfree_no_batch, 0, "Use the non-batching (slower) version of kfree_rcu().");
 
 static struct task_struct **kfree_reader_tasks;
 static int kfree_nrealthreads;
@@ -632,14 +631,7 @@ kfree_perf_thread(void *arg)
                        if (!alloc_ptr)
                                return -ENOMEM;
 
-                       if (!kfree_no_batch) {
-                               kfree_rcu(alloc_ptr, rh);
-                       } else {
-                               rcu_callback_t cb;
-
-                               cb = (rcu_callback_t)(unsigned long)offsetof(struct kfree_obj, rh);
-                               kfree_call_rcu_nobatch(&(alloc_ptr->rh), cb);
-                       }
+                       kfree_rcu(alloc_ptr, rh);
                }
 
                cond_resched();
index a8dd612098bf4541d51d544b22feab63070c617c..31d2d9255d959955356e376ef0ae9b8596a6393a 100644 (file)
@@ -2763,8 +2763,10 @@ static void kfree_rcu_work(struct work_struct *work)
                rcu_lock_acquire(&rcu_callback_map);
                trace_rcu_invoke_kfree_callback(rcu_state.name, head, offset);
 
-               /* Could be possible to optimize with kfree_bulk in future */
-               kfree((void *)head - offset);
+               if (!WARN_ON_ONCE(!__is_kfree_rcu_offset(offset))) {
+                       /* Could be optimized with kfree_bulk() in future. */
+                       kfree((void *)head - offset);
+               }
 
                rcu_lock_release(&rcu_callback_map);
                cond_resched_tasks_rcu_qs();
@@ -2835,16 +2837,6 @@ static void kfree_rcu_monitor(struct work_struct *work)
                spin_unlock_irqrestore(&krcp->lock, flags);
 }
 
-/*
- * This version of kfree_call_rcu does not do batching of kfree_rcu() requests.
- * Used only by rcuperf torture test for comparison with kfree_rcu_batch().
- */
-void kfree_call_rcu_nobatch(struct rcu_head *head, rcu_callback_t func)
-{
-       __call_rcu(head, func);
-}
-EXPORT_SYMBOL_GPL(kfree_call_rcu_nobatch);
-
 /*
  * Queue a request for lazy invocation of kfree() after a grace period.
  *
@@ -2864,8 +2856,6 @@ void kfree_call_rcu(struct rcu_head *head, rcu_callback_t func)
        unsigned long flags;
        struct kfree_rcu_cpu *krcp;
 
-       head->func = func;
-
        local_irq_save(flags);  // For safely calling this_cpu_ptr().
        krcp = this_cpu_ptr(&krc);
        if (krcp->initialized)