Re: Real-Time Preemption and RCU

From: Esben Nielsen (simlo_at_phys.au.dk)
Date: 03/23/05

  • Next message: Martin Schwidefsky: "Re: S390: bug in signal frame set up when using SA_ONSTACK"
    Date:	Wed, 23 Mar 2005 12:44:52 +0100 (MET)
    To: "Paul E. McKenney" <paulmck@us.ibm.com>
    
    

    On Tue, 22 Mar 2005, Paul E. McKenney wrote:

    > On Tue, Mar 22, 2005 at 09:55:26AM +0100, Esben Nielsen wrote:
    > > On Mon, 21 Mar 2005, Paul E. McKenney wrote:
    > [ . . . ]
    > > > On Mon, Mar 21, 2005 at 12:23:22AM +0100, Esben Nielsen wrote:
    > > > This is in some ways similar to the K42 approach to RCU (which they call
    > > > "generations"). Dipankar put together a similar patch for Linux, but
    > > > the problem was that grace periods could be deferred for an extremely
    > > > long time. Which I suspect is what you were calling out as causing
    > > > RCU batches never to run.
    > >
    > > That is where the preempt_by_nonrt_disable/enable() is supposed to help:
    > > Then it can't take longer than the normal kernel in the situation where
    > > there is no RT tasks running. RT tasks will prolong the grace periods if
    > > they go into RCU regions, but they are supposed to be relatively small -
    > > and deterministic!
    >
    > The part that I am missing is how this helps in the case where a non-RT
    > task gets preempted in the middle of an RCU read-side critical section
    > indefinitely. Or are you boosting the priority of any task that
    > enters an RCU read-side critical section?

    Yes in effect: I set the priority to MAX_RT_PRIO. But actually I am
    playing around (when I get time for it that is :-( ) with cheaper
    solution:
    I assume you enter these regions where you don't want to be
    preempted by non-RT tasks are relatively short. Therefore the risc of
    getting preempted is small. Moving the priority is expensive since you
    need to lock the runqueue. I only want to do the movement when
    there is an preemption. Therefore I added code in schedule() to take care
    of it: If a task is in a rcu-read section, is non-RT and is preempted it's
    priority is set to MAX_RT_PRIO for the time being. It will keep that
    priority until the priority is recalculated, but that shouldn't hurt
    anyone.
    I am not happy about adding code to schedule() but setting the
    priority in there is very cheap because it already has the lock
    on the runqueue. Furthermore, I assume it only happens very rarely. In the
    execution of schedule() my code only takes a single test on wether the
    previous task was in a rcu-section or not. That is not very much code.

    I have not yet tested it (no time :-( )

    > [...]
    > > > Yes, but this is true of every other lock in the system as well, not?
    > >
    > > Other locks are not globaly used but only used for a specific subsystem.
    > > On a real-time system you are supposed to know which subsystems you can
    > > call into and still have a low enough latency as each subsystem has it's
    > > own bound. But with a global RCU locking mechanism all RCU using code is
    > > to be regarded as _one_ such subsystem.
    >
    > Yep. As would the things protected by the dcache lock, task list lock,
    > and so on, right?

    Yep

    >
    > Thanx, Paul
    >
    Esben

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Martin Schwidefsky: "Re: S390: bug in signal frame set up when using SA_ONSTACK"

    Relevant Pages

    • Re: AIM7 40% regression with 2.6.26-rc1
      ... * Re-acquire the kernel semaphore. ... * Acquire/release the underlying lock from the scheduler. ... * This function is called with preemption off. ... * We are executing in schedule() so the code must be extremely careful ...
      (Linux-Kernel)
    • Re: AIM7 40% regression with 2.6.26-rc1
      ... * Re-acquire the kernel semaphore. ... * Acquire/release the underlying lock from the scheduler. ... * This function is called with preemption off. ... * We are executing in schedule() so the code must be extremely careful ...
      (Linux-Kernel)
    • Re: Real-Time Preemption and RCU
      ... Moving the priority is expensive since you ... > need to lock the runqueue. ... > there is an preemption. ... Therefore I added code in schedule() to take care ...
      (Linux-Kernel)
    • Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support
      ... more than just a small region where preemption isn't allowed. ... way priority inversion is handled. ... When lock contention can ... are raw locks rather than normal locks probably because that ...
      (Linux-Kernel)
    • Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support
      ... point that such bitops shouldn't be preemption points. ... way priority inversion is handled. ... When lock contention can ...
      (Linux-Kernel)