[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTimE1KecXQhcxsKLSLug-7XpmGbmvsfSmG7kWDNn@mail.gmail.com>
Date: Wed, 17 Nov 2010 15:31:37 -0800
From: Michel Lespinasse <walken@...gle.com>
To: Dave Chinner <david@...morbit.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Nick Piggin <npiggin@...nel.dk>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Hugh Dickins <hughd@...gle.com>,
Rik van Riel <riel@...hat.com>,
Kosaki Motohiro <kosaki.motohiro@...fujitsu.com>,
Theodore Tso <tytso@...gle.com>,
Michael Rubin <mrubin@...gle.com>,
Suleiman Souhlal <suleiman@...gle.com>
Subject: Re: [PATCH 3/3] mlock: avoid dirtying pages and triggering writeback
On Wed, Nov 17, 2010 at 3:11 PM, Dave Chinner <david@...morbit.com> wrote:
>> Really, my understanding is that not pre-allocating filesystem blocks
>> is just fine. This is, after all, what happens with ext3 and it's
>> never been reported as a bug (that I know of).
>
> It's not ext3 you have to worry about - it's the filesystems that
> need special state set up on their pages/buffers for ->writepage to
> work correctly that are the problem. You need to call
> ->write_begin/->write_end to get the state set up properly.
>
> If this state is not set up properly, silent data loss will occur
> during mmap writes either by ENOSPC or failing to set up writes into
> unwritten extents correctly (i.e. we'll be back to where we were in
> 2.6.15).
>
> I don't think ->page_mkwrite can be worked around - we need that to
> be called on the first write fault of any mmap()d page to ensure it
> is set up correctly for writeback. If we don't get write faults
> after the page is mlock()d, then we need the ->page_mkwrite() call
> during the mlock() call.
Just to be clear - I'm proposing to skip the entire do_wp_page() call
by doing a read fault rather than a write fault. If the page wasn't
dirty already, it will stay clean and with a non-writable PTE until it
gets actually written to, at which point we'll get a write fault and
do_wp_page will be invoked as usual.
I am not proposing to skip the page_mkwrite() while upgrading the PTE
permissions, which I think is what you were arguing against ?
--
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists