lkml.org 
[lkml]   [2012]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH RFC] rcu: Make __rcu_read_lock() inlinable
    On 03/26/2012 04:52 AM, Paul E. McKenney wrote:

    > +void rcu_switch_from(void)
    > {
    > - current->rcu_read_lock_nesting++;
    > - barrier(); /* needed if we ever invoke rcu_read_lock in rcutree.c */
    > + current->rcu_read_lock_nesting_save =
    > + __this_cpu_read(rcu_read_lock_nesting);
    > + barrier();
    > + __this_cpu_write(rcu_read_lock_nesting, 0);

    - __this_cpu_write(rcu_read_lock_nesting, 0);
    + __this_cpu_write(rcu_read_lock_nesting, 1);

    if prev or next task has non-zero rcu_read_unlock_special,
    "__this_cpu_write(rcu_read_lock_nesting, 1)" will prevent wrong qs reporting
    when rcu_read_unlock() is called in any interrupt/tracing while doing switch_to().

    > +}
    > +
    > +/*
    > + * Restore the incoming task's value for rcu_read_lock_nesting at the
    > + * end of a context switch.
    > + */
    > +void rcu_switch_to(void)
    > +{
    > + __this_cpu_write(rcu_read_lock_nesting,
    > + current->rcu_read_lock_nesting_save);
    > + barrier();
    > + current->rcu_read_lock_nesting_save = 0;
    > }

    - barrier();
    - current->rcu_read_lock_nesting_save = 0;

    rcu_read_lock_nesting_save is set but not used before next set here, just remove it.


    I don't like it hooks too much into scheduler.

    Approaches:
    0) stay using function call
    1) hook into kbuild(https://lkml.org/lkml/2011/3/27/170,https://lkml.org/lkml/2011/3/27/171)
    2) hook into scheduler(still need more works for rcu_read_unlock())
    3) Add rcu_read_lock_nesting to thread_info like preempt_count
    4) resolve header-file dependence

    For me
    3=4>1>2>0

    Thanks,
    Lai


    \
     
     \ /
      Last update: 2012-03-27 10:03    [W:0.048 / U:90.028 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site