Skip to content

Commit 189a688

Browse files
joelagnelpaulmckrcu
authored andcommitted
rcu: Remove kfree_call_rcu_nobatch()
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) <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 77a40f9 commit 189a688

File tree

5 files changed

+5
-33
lines changed

5 files changed

+5
-33
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3991,10 +3991,6 @@
39913991
Number of loops doing rcuperf.kfree_alloc_num number
39923992
of allocations and frees.
39933993

3994-
rcuperf.kfree_no_batch= [KNL]
3995-
Use the non-batching (less efficient) version of kfree_rcu().
3996-
This is useful for comparing with the batched version.
3997-
39983994
rcuperf.nreaders= [KNL]
39993995
Set number of RCU readers. The value -1 selects
40003996
N, where N is the number of CPUs. A value

include/linux/rcutiny.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ static inline void kfree_call_rcu(struct rcu_head *head, rcu_callback_t func)
3939
call_rcu(head, func);
4040
}
4141

42-
static inline void kfree_call_rcu_nobatch(struct rcu_head *head, rcu_callback_t func)
43-
{
44-
call_rcu(head, func);
45-
}
46-
4742
void rcu_qs(void);
4843

4944
static inline void rcu_softirq_qs(void)

include/linux/rcutree.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ static inline void rcu_virt_note_context_switch(int cpu)
3434

3535
void synchronize_rcu_expedited(void);
3636
void kfree_call_rcu(struct rcu_head *head, rcu_callback_t func);
37-
void kfree_call_rcu_nobatch(struct rcu_head *head, rcu_callback_t func);
3837

3938
void rcu_barrier(void);
4039
bool rcu_eqs_special_set(int cpu);

kernel/rcu/rcuperf.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,6 @@ rcu_perf_shutdown(void *arg)
593593
torture_param(int, kfree_nthreads, -1, "Number of threads running loops of kfree_rcu().");
594594
torture_param(int, kfree_alloc_num, 8000, "Number of allocations and frees done in an iteration.");
595595
torture_param(int, kfree_loops, 10, "Number of loops doing kfree_alloc_num allocations and frees.");
596-
torture_param(int, kfree_no_batch, 0, "Use the non-batching (slower) version of kfree_rcu().");
597596

598597
static struct task_struct **kfree_reader_tasks;
599598
static int kfree_nrealthreads;
@@ -632,14 +631,7 @@ kfree_perf_thread(void *arg)
632631
if (!alloc_ptr)
633632
return -ENOMEM;
634633

635-
if (!kfree_no_batch) {
636-
kfree_rcu(alloc_ptr, rh);
637-
} else {
638-
rcu_callback_t cb;
639-
640-
cb = (rcu_callback_t)(unsigned long)offsetof(struct kfree_obj, rh);
641-
kfree_call_rcu_nobatch(&(alloc_ptr->rh), cb);
642-
}
634+
kfree_rcu(alloc_ptr, rh);
643635
}
644636

645637
cond_resched();

kernel/rcu/tree.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2763,8 +2763,10 @@ static void kfree_rcu_work(struct work_struct *work)
27632763
rcu_lock_acquire(&rcu_callback_map);
27642764
trace_rcu_invoke_kfree_callback(rcu_state.name, head, offset);
27652765

2766-
/* Could be possible to optimize with kfree_bulk in future */
2767-
kfree((void *)head - offset);
2766+
if (!WARN_ON_ONCE(!__is_kfree_rcu_offset(offset))) {
2767+
/* Could be optimized with kfree_bulk() in future. */
2768+
kfree((void *)head - offset);
2769+
}
27682770

27692771
rcu_lock_release(&rcu_callback_map);
27702772
cond_resched_tasks_rcu_qs();
@@ -2835,16 +2837,6 @@ static void kfree_rcu_monitor(struct work_struct *work)
28352837
spin_unlock_irqrestore(&krcp->lock, flags);
28362838
}
28372839

2838-
/*
2839-
* This version of kfree_call_rcu does not do batching of kfree_rcu() requests.
2840-
* Used only by rcuperf torture test for comparison with kfree_rcu_batch().
2841-
*/
2842-
void kfree_call_rcu_nobatch(struct rcu_head *head, rcu_callback_t func)
2843-
{
2844-
__call_rcu(head, func);
2845-
}
2846-
EXPORT_SYMBOL_GPL(kfree_call_rcu_nobatch);
2847-
28482840
/*
28492841
* Queue a request for lazy invocation of kfree() after a grace period.
28502842
*
@@ -2864,8 +2856,6 @@ void kfree_call_rcu(struct rcu_head *head, rcu_callback_t func)
28642856
unsigned long flags;
28652857
struct kfree_rcu_cpu *krcp;
28662858

2867-
head->func = func;
2868-
28692859
local_irq_save(flags); // For safely calling this_cpu_ptr().
28702860
krcp = this_cpu_ptr(&krc);
28712861
if (krcp->initialized)

0 commit comments

Comments
 (0)