Re: [PATCH] stack and rcu interaction bug in smp_call_function_mask()

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Nick Piggin <nickpiggin@...>
Cc: Venki Pallipadi <venkatesh.pallipadi@...>, Jens Axboe <jens.axboe@...>, Ingo Molnar <mingo@...>, <npiggin@...>, linux-kernel <linux-kernel@...>, <suresh.b.siddha@...>
Date: Thursday, August 21, 2008 - 4:50 pm

Nick Piggin wrote:

So the upshot of this is that when using stack allocation, the rcu stuff
is more or less useless, because rcu has no influence over the lifetime
of the stack-allocated structures.  We need to move to all allocation,
so that rcu can control the memory lifetime.

Doesn't that just mean we should avoid RCU for stack allocated data
altogether, and instead have the queue controlled by an rwlock?  A cpu
which adds a call to the queue does something like:

   1. write_lock(&queue_lock);
   2. add element
   3. write_unlock(&queue_lock);
   4. csd_flag_wait(...);
   5. write_lock(&queue_lock);
   6. remove element
   7. write_unlock(&queue_lock);

and a CPU running a function would do:

   1. read_lock(&queue_lock);
   2. do stuff
   3. if (refs-- == 1) data->csd.flags &= ~CSD_FLAG_WAIT;
   4. read_unlock(&queue_lock);

And of course using multiple queues would mitigate the locking cost.

Perhaps it would make sense to have separate queue(s) for heap vs stack
allocated data (=async vs sync calls, in effect)?

    J
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] stack and rcu interaction bug in smp_call_functi..., Jeremy Fitzhardinge, (Thu Aug 21, 4:50 pm)
Re: [PATCH] stack and rcu interaction bug in smp_call_functi..., Jeremy Fitzhardinge, (Mon Aug 11, 12:26 am)
Re: [PATCH] stack and rcu interaction bug in smp_call_functi..., Jeremy Fitzhardinge, (Mon Aug 11, 2:27 pm)
Re: [PATCH] stack and rcu interaction bug in smp_call_functi..., Arjan van de Ven, (Mon Aug 11, 12:34 am)
Re: [PATCH] stack and rcu interaction bug in smp_call_functi..., Jeremy Fitzhardinge, (Mon Aug 11, 2:18 pm)
Re: [PATCH] stack and rcu interaction bug in smp_call_functi..., Jeremy Fitzhardinge, (Fri Aug 8, 10:17 pm)