lkml.org 
[lkml]   [2013]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v3 07/15] KVM: MMU: introduce nulls desc
    On 12/06/2013 08:22 AM, Marcelo Tosatti wrote:
    > On Thu, Dec 05, 2013 at 11:30:27PM +0800, Xiao Guangrong wrote:
    >> In some cases, the lockless walker will do endless-walking on desc and
    >> without rewalk, consider this case:
    >>
    >> there are two descs: desc1 and desc2 who is pointed by desc1->next:
    >> desc1->next = desc2.
    >>
    >> CPU 0 CPU 1
    >>
    >> lockless walk on desc1
    >> deleting desc1 from the rmap
    >> lockless walk on desc2 (desc1->next)
    >> delete desc2 from the rmap
    >> add desc1
    >> add desc2, then desc2->next = desc1
    >>
    >> lockless walk on desc1
    >> delete desc2
    >> delete desc1
    >> add desc2
    >> add desc1; the desc1->next = desc2
    >> lockless walk on desc2
    >>
    >> ……
    >>
    >> Then, the walker is endlessly walking on desc1 and desc2 without any rewalk.
    >
    > The counter can be local to the walker. If its more than maximum rmap
    > size, break.
    >
    > (but still, please consider carefully whether lockless list walking is
    > really necessary or can be avoided).

    Yep, Marcelo, you're right.

    After thinking more, i do not have any idea to simplify this. Your approach
    (lockless on the first level) seems a better solution. Will do it based on that
    ways.

    Thanks!


    --
    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/

    \
     
     \ /
      Last update: 2013-12-10 08:41    [W:2.823 / U:0.180 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site