lkml.org 
[lkml]   [2011]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH 3/3] kref: Remove the memory barriers
    From
    On Sat, Dec 10, 2011 at 10:58 PM, Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
    > On Sat, 2011-12-10 at 22:07 +0800, Ming Lei wrote:
    >> > While true, it fails to show why this is a problem. I say it is not a
    >>
    >> IMO, the added two barriers are pairs of the implicit barrier in kref_put, so
    >> that we can order between kref_init/kref_get and kref_put.
    >
    > Yeah so?

    I think so, see below:


    CPU0 CPU1

    atomic_set(v)
    smp_mb()
    smp_mb()
    atomic_dec_and_test(v)

    Without the barrier after atomic_set, CPU1 may see a stale
    value of v first, then decrease it, so may miss a release operation.

    The pair of smp_mb can make order between atomic_set
    and atomic_dec_and_test, can't it?

    > If there's a destruction race with kref_put() the barrier won't

    Sorry, could you say what the destruction race is?

    > solve it. Other than that the actual order of get/put is irrelevant.


    thanks,
    --
    Ming Lei


    \
     
     \ /
      Last update: 2011-12-10 16:59    [W:0.019 / U:1.200 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site