lkml.org 
[lkml]   [2008]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH 04/10] AXFS: axfs_inode.c
    Date
    On Thursday 21 August 2008, Jared Hulbert wrote:
    > > Have you seen any benefit of the rwsem over a simple mutex? I would guess
    > > that you can never even get into the situation where you get concurrent
    > > readers since I haven't found a single down_read() in your code, only
    > > downgrade_write()
    >
    > We implemented a rwsem here because you can get concurrent readers.
    > My understanding is that downgrade_write() puts the rewem into the
    > same state as down_read().  Am I mistaken?

    Your interpretation of downgrade_write is correct, but if every thread
    always does

    down_write();
    serialized_code();
    downgrade_write();
    parallel_code();
    up_read();

    Then you still won't have any concurrency, because each thread trying
    to down_write() will be blocked until the previous one has done its up_read(),
    causing parallel_code() to be serialized as well.

    In addition to that, I'd still consider it better to use a simple mutex
    if parallel_code() is a much faster operation than serialized_code(), as it
    is in your case, where only the memcpy is parallel and that is much slower
    than the deflate.

    Arnd <><
    --
    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: 2008-08-21 17:17    [W:3.426 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site