lkml.org 
[lkml]   [1999]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: Removing swap lockmap...
    Hi,

    In article <87iue47gy4.fsf@atlas.CARNet.hr>, Zlatko Calusic
    <Zlatko.Calusic@CARNet.hr> writes:

    > I removed swap lockmap all together and, to my surprise, I can't
    > produce any ill behaviour on my system, not even under very heavy
    > swapping (in low memory condition).

    Just because you can't reproduce it doesn't mean it works perfectly.
    There was a very good reason why the swap lock map was still required
    until recently. The race condition it fixed wass an obscure one but
    still important. However, very recent VM changes make me wonder if it
    is still absolutely necessary.

    The problem was that if we swapped out a page, we might sometimes remove
    the swap cache for the page before the IO was complete. If we can
    _guarantee_ that the swap cache will persist until after the IO is
    complete, then any future attempt to use that swap page will find that
    the page is locked and will wait for the IO to complete.

    However, if in fact the swap cache for the page _ever_ gets removed
    before the IO completes, then a future read in of the page might start
    before the current write had completed. This has been observed in
    practice. The swap lock protects against this.

    Now that we always keep the swap cache intact in mm/vmscan.c and only
    reclaim it in mm/filemap.c, we might in fact be safe omiting the swap
    lock. I'd be nervous about it without a _thorough_ audit of the code,
    though, as this particular race is hard to reproduce.

    --Stephen

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:49    [W:2.564 / U:0.276 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site