lkml.org 
[lkml]   [2010]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH tip/urgent] rcu: add rcu_access_pointer and rcu_dereference_protected
    On Wed, Apr 07, 2010 at 06:20:48PM +0100, David Howells wrote:
    > Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:
    >
    > > In other cases, there will be a reference counter or a "not yet fully
    > > initialized" flag that can (and should) be tested.
    >
    > Why would you be using rcu_access_pointer() there? Why wouldn't you be using
    > rcu_dereference_protected()?

    Excellent question. I am writing up the documentation now, and will
    either (1) have a good use case or (2) remove the condition.

    > Also, one other thing: Should the default versions of these functions make
    > some reference to 'c' to prevent compiler warnings? Should:
    >
    > #define rcu_dereference_check(p, c) rcu_dereference_raw(p)
    >
    > for example, be:
    >
    > #define rcu_dereference_check(p, c) \
    > ({ \
    > if (1 || !(c)) \
    > rcu_dereference_raw(p); \
    > })
    >
    > I'm not sure it's necessary, but it's possible to envisage a situation where
    > someone calculates something specifically for use in 'c', which will cause an
    > warning from the compiler if c isn't then checked.

    I did try this. The problem is that it breaks the build for non-lockdep
    configurations due to the lockdep-check primitives not being defined. :-(

    Thanx, Paul


    \
     
     \ /
      Last update: 2010-04-08 01:03    [W:0.022 / U:58.972 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site