lkml.org 
[lkml]   [2010]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/2] mm,migration: Prevent rmap_walk_[anon|ksm] seeing the wrong VMA information


    On Thu, 6 May 2010, Mel Gorman wrote:
    > >
    > > What makes this ok is the fact that it must be running under the RCU read
    > > lock, and anon_vma's thus cannot be released.
    >
    > This is very subtle in itself. RCU guarantees that the anon_vma exists
    > but does it guarantee that it's the same one we expect and that it
    > hasn't been freed and reused?

    Nothing. And we shouldn't care.

    If it's been freed and re-used, then all the anon_vma's (and vma's)
    associated with the original anon_vma (and page) have been free'd.

    And that, in turn, means that we don't really need to lock anything at
    all. The fact that we end up locking an anon_vma that _used_ to be the
    root anon_vma is immaterial - the lock won't _help_, but it shouldn't hurt
    either, since it's still a valid spinlock.

    Now, the above is only true as far as the anon_vma itself is concerned.
    It's entirely possible that any _other_ data structures would need to be
    double-checked after getting the lock. For example, is the _page_ still
    associated with that anon_vma? But that's an external issue as far as the
    anon_vma locking is concerned - presumably the 'rmap_walk()' caller will
    have made sure that the page itself is stable somehow.

    Linus


    \
     
     \ /
      Last update: 2010-05-06 16:21    [W:0.021 / U:60.000 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site