Re: call_rcu from trace_preempt

Daniel Wagner
2015-06-16T17:12:07Z

On 06/16/2015 05:41 PM, Steven Rostedt wrote:
> On Tue, 16 Jun 2015 14:38:53 +0200
> Daniel Wagner <wagi@monom.org> wrote:
>> *map, void *key)
>> if (l) {
>> hlist_del_rcu(&l->hash_node);
>> htab->count--;
>> - kfree_rcu(l, rcu);
>> + /* kfree_rcu(l, rcu); */
>
> So this kfree_rcu() is only being used to defer a free, and has nothing
> to do with having to free 'l' from rcu?

Not 100% sure but I got the impression kfree_rcu only defers the free.

>> +static int free_thread(void *arg)
>> +{
>> + unsigned long flags;
>> + struct htab_elem *l;
>> +
>> + while (!kthread_should_stop()) {
>> + spin_lock_irqsave(&elem_freelist_lock, flags);
>> + while (!list_empty(&elem_freelist)) {
>> + l = list_entry(elem_freelist.next,
>> + struct htab_elem, list);
>> + list_del(&l->list);
>> + kfree(l);
>> + }
>> + spin_unlock_irqrestore(&elem_freelist_lock, flags);
>
> Wow! This is burning up CPU isn't it?

Sure, this is a very busy thread :) I was just experimenting if defering
it to a thread would paper of the problem.

> If you just need to delay the kfree, why not use irq_work for that job?

Good point. I tried that tomorrow.

cheers,
daniel