Re: [PATCH] RCU: implement rcu_read_[un]lock_preempt()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Peter Zijlstra
Date: Monday, July 28, 2008 - 11:15 pm

On Tue, 2008-07-29 at 10:47 +0900, Tejun Heo wrote:

But the fact is that PREEMPT_RCU is upstream now..


Nope, we'd want something like:

  rcu_read_lock();

  cpu = get_cpu();
  data = percpu_ptr(ptr, cpu);
  fiddle_per_cpu_data();
  put_cpu();

  do_more_rcu_protected_stuff();

  rcu_read_unlock();

This clearly shows the intent - on -rt we can then easily convert the
per-cpu stuff to use a lock instead of disabling preemption. Making the
whole code sequence preemptible.

If you would have mixed it into the rcu ops, its unclear what code needs
protection from what.


preempt_disable() is just like the BKL, its opaque in that it isn't
bound to some data and doesn't tell you what it protects. So getting rid
of them afterwards is pain.

Therefore we prefer APIs such as, get_cpu() etc.. that show intent and
don;t like stuff you just now proposed of mixing intents. Because when
changing the preemption model you might need different solution for
different intents.

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

Messages in current thread:
[PATCH] RCU: implement rcu_read_[un]lock_preempt(), Tejun Heo, (Sun Jul 13, 10:57 pm)
Re: [PATCH] RCU: implement rcu_read_[un]lock_preempt(), Peter Zijlstra, (Tue Jul 15, 11:07 pm)
Re: [PATCH] RCU: implement rcu_read_[un]lock_preempt(), Peter Zijlstra, (Mon Jul 28, 8:13 am)
Re: [PATCH] RCU: implement rcu_read_[un]lock_preempt(), Peter Zijlstra, (Mon Jul 28, 11:15 pm)