lkml.org 
[lkml]   [2003]   [Dec]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH linux-2.6.0-test10-mm1] filemap_fdatawait.patch
    On Wed, Dec 31, 2003 at 02:10:42AM -0800, Andrew Morton wrote:
    > Suparna Bhattacharya <suparna@in.ibm.com> wrote:
    > >
    > > > OK, but the thread which is running fdatawrite/fdatawait isn't interested
    > > > in that page, because it must have been dirtied _after_ this thread has
    > > > passed through filemap_fdatawrite(), yes?
    > >
    > > Not exactly. The page could actually have been dirtied _before_ this
    > > thread passes through filemap_datawrite, but is just being parallely
    > > written back by a background thread.
    >
    > I still don't see it. If the page was dirtied before this thread entered
    > filemap_fdatawrite() then this thread will either start writeout
    > immediately, or will wait on the writeout and start new writeout. And
    > the page lock avoids the timing window which you have mentioned.

    From filemap_fdatawait:

    while (!list_empty(&mapping->locked_pages)) {
    struct page *page;

    page = list_entry(mapping->locked_pages.next,struct page,list);
    list_del(&page->list);
    if (PageDirty(page))
    list_add(&page->list, &mapping->dirty_pages);
    else
    list_add(&page->list, &mapping->clean_pages);

    ----> if (!PageWriteback(page)) {
    if (++progress > 32) {
    if (need_resched()) {
    spin_unlock(&mapping->page_lock);
    __cond_resched();
    goto restart;
    }
    }
    ----> continue;
    }

    If PG_writeback is not set, it moves on to process the next page -- without
    falling through to wait_on_page_writeback, isn't that so ?
    Another thread could have pulled the page off io_pages, put it on locked
    pages, and not set PG_writeback as yet.

    How does the page lock guard against this ?
    filemap_fdatawait seems to ignore the page lock.

    Regards
    Suparna

    --
    Suparna Bhattacharya (suparna@in.ibm.com)
    Linux Technology Center
    IBM Software Lab, India

    -
    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: 2005-03-22 13:59    [W:4.175 / U:0.084 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site