All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michel Lespinasse <walken@google.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Nick Piggin <npiggin@kernel.dk>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Hugh Dickins <hughd@google.com>, Rik van Riel <riel@redhat.com>,
	Kosaki Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Theodore Tso <tytso@google.com>,
	Michael Rubin <mrubin@google.com>,
	Suleiman Souhlal <suleiman@google.com>
Subject: Re: [PATCH 3/3] mlock: avoid dirtying pages and triggering writeback
Date: Wed, 17 Nov 2010 14:05:30 -0800	[thread overview]
Message-ID: <AANLkTim4tO_aKzXLXJm-N-iEQ9rNSa0=HGJVDAz33kY6@mail.gmail.com> (raw)
In-Reply-To: <1290007734.2109.941.camel@laptop>

On Wed, Nov 17, 2010 at 7:28 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Wed, 2010-11-17 at 23:57 +1100, Nick Piggin wrote:
>> On Wed, Nov 17, 2010 at 04:23:58AM -0800, Michel Lespinasse wrote:
>> > When faulting in pages for mlock(), we want to break COW for anonymous
>> > or file pages within VM_WRITABLE, non-VM_SHARED vmas. However, there is
>> > no need to write-fault into VM_SHARED vmas since shared file pages can
>> > be mlocked first and dirtied later, when/if they actually get written to.
>> > Skipping the write fault is desirable, as we don't want to unnecessarily
>> > cause these pages to be dirtied and queued for writeback.
>>
>> It's not just to break COW, but to do block allocation and such
>> (filesystem's page_mkwrite op). That needs to at least be explained
>> in the changelog.
>
> Agreed, the 0/3 description actually does mention this.
>
>> Filesystem doesn't have a good way to fully pin required things
>> according to mlock, but page_mkwrite provides some reasonable things
>> (like block allocation / reservation).
>
> Right, but marking all pages dirty isn't really sane. I can imagine
> making the reservation but not marking things dirty solution, although
> it might be lots harder to implement, esp since some filesystems don't
> actually have a page_mkwrite() implementation.

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).

If filesystem people's feedback is that they really want mlock() to
continue pre-allocating blocks, maybe we can just do it using
fallocate() rather than page_mkwrite() callbacks ?

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.

WARNING: multiple messages have this Message-ID (diff)
From: Michel Lespinasse <walken@google.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Nick Piggin <npiggin@kernel.dk>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Hugh Dickins <hughd@google.com>, Rik van Riel <riel@redhat.com>,
	Kosaki Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Theodore Tso <tytso@google.com>,
	Michael Rubin <mrubin@google.com>,
	Suleiman Souhlal <suleiman@google.com>
Subject: Re: [PATCH 3/3] mlock: avoid dirtying pages and triggering writeback
Date: Wed, 17 Nov 2010 14:05:30 -0800	[thread overview]
Message-ID: <AANLkTim4tO_aKzXLXJm-N-iEQ9rNSa0=HGJVDAz33kY6@mail.gmail.com> (raw)
In-Reply-To: <1290007734.2109.941.camel@laptop>

On Wed, Nov 17, 2010 at 7:28 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Wed, 2010-11-17 at 23:57 +1100, Nick Piggin wrote:
>> On Wed, Nov 17, 2010 at 04:23:58AM -0800, Michel Lespinasse wrote:
>> > When faulting in pages for mlock(), we want to break COW for anonymous
>> > or file pages within VM_WRITABLE, non-VM_SHARED vmas. However, there is
>> > no need to write-fault into VM_SHARED vmas since shared file pages can
>> > be mlocked first and dirtied later, when/if they actually get written to.
>> > Skipping the write fault is desirable, as we don't want to unnecessarily
>> > cause these pages to be dirtied and queued for writeback.
>>
>> It's not just to break COW, but to do block allocation and such
>> (filesystem's page_mkwrite op). That needs to at least be explained
>> in the changelog.
>
> Agreed, the 0/3 description actually does mention this.
>
>> Filesystem doesn't have a good way to fully pin required things
>> according to mlock, but page_mkwrite provides some reasonable things
>> (like block allocation / reservation).
>
> Right, but marking all pages dirty isn't really sane. I can imagine
> making the reservation but not marking things dirty solution, although
> it might be lots harder to implement, esp since some filesystems don't
> actually have a page_mkwrite() implementation.

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).

If filesystem people's feedback is that they really want mlock() to
continue pre-allocating blocks, maybe we can just do it using
fallocate() rather than page_mkwrite() callbacks ?

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2010-11-17 22:05 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-17 12:23 [PATCH 0/3] Avoid dirtying pages during mlock Michel Lespinasse
2010-11-17 12:23 ` Michel Lespinasse
2010-11-17 12:23 ` [PATCH 1/3] do_wp_page: remove the 'reuse' flag Michel Lespinasse
2010-11-17 12:23   ` Michel Lespinasse
2010-11-17 12:23 ` [PATCH 2/3] do_wp_page: clarify dirty_page handling Michel Lespinasse
2010-11-17 12:23   ` Michel Lespinasse
2010-11-17 12:23 ` [PATCH 3/3] mlock: avoid dirtying pages and triggering writeback Michel Lespinasse
2010-11-17 12:23   ` Michel Lespinasse
2010-11-17 12:57   ` Nick Piggin
2010-11-17 12:57     ` Nick Piggin
2010-11-17 15:28     ` Peter Zijlstra
2010-11-17 15:28       ` Peter Zijlstra
2010-11-17 22:05       ` Michel Lespinasse [this message]
2010-11-17 22:05         ` Michel Lespinasse
2010-11-17 22:18         ` Peter Zijlstra
2010-11-17 22:18           ` Peter Zijlstra
2010-11-17 23:11         ` Dave Chinner
2010-11-17 23:11           ` Dave Chinner
2010-11-17 23:31           ` Michel Lespinasse
2010-11-17 23:31             ` Michel Lespinasse
2010-11-19  1:46             ` Dave Chinner
2010-11-19  1:46               ` Dave Chinner
2010-11-17 23:52           ` Ted Ts'o
2010-11-17 23:52             ` Ted Ts'o
2010-11-18  0:53             ` Andrew Morton
2010-11-18  0:53               ` Andrew Morton
2010-11-18 11:03               ` Michel Lespinasse
2010-11-18 11:03                 ` Michel Lespinasse
2010-11-18 13:37           ` Christoph Hellwig
2010-11-18 13:37             ` Christoph Hellwig
2010-11-18 17:41             ` Hugh Dickins
2010-11-18 17:41               ` Hugh Dickins
2010-11-19  7:23               ` Michel Lespinasse
2010-11-19  7:23                 ` Michel Lespinasse
2010-11-19 13:38                 ` Theodore Tso
2010-11-19 13:42                 ` Theodore Tso
2010-11-19 13:42                   ` Theodore Tso
2010-11-19 15:06                   ` Christoph Hellwig
2010-11-19 15:06                     ` Christoph Hellwig
2010-11-19 22:54                 ` Andrew Morton
2010-11-19 22:54                   ` Andrew Morton
2010-11-19 23:22                   ` Ted Ts'o
2010-11-19 23:22                     ` Ted Ts'o
2010-11-20  0:29                     ` Dustin Kirkland
2010-11-19 23:31                   ` Michel Lespinasse
2010-11-19 23:31                     ` Michel Lespinasse
2010-11-19 23:54                 ` Dave Chinner
2010-11-19 23:54                   ` Dave Chinner
2010-11-18  5:46       ` Nick Piggin
2010-11-18  5:46         ` Nick Piggin
2010-11-18 10:43         ` Theodore Tso
2010-11-18 10:43           ` Theodore Tso
2010-11-18 13:39           ` Christoph Hellwig
2010-11-18 13:39             ` Christoph Hellwig
2010-11-18 18:00             ` Hugh Dickins
2010-11-18 18:00               ` Hugh Dickins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTim4tO_aKzXLXJm-N-iEQ9rNSa0=HGJVDAz33kY6@mail.gmail.com' \
    --to=walken@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mrubin@google.com \
    --cc=npiggin@kernel.dk \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=suleiman@google.com \
    --cc=tytso@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.