From: Paolo Bonzini <pbonzini@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Hugh Dickins <hughd@google.com>
Subject: Re: [PATCH 2/2] msync: start async writeout when MS_ASYNC
Date: Thu, 14 Jun 2012 12:19:33 +0200 [thread overview]
Message-ID: <4FD9BAB5.60206@redhat.com> (raw)
In-Reply-To: <20120614030753.048eec9a.akpm@linux-foundation.org>
Il 14/06/2012 12:07, Andrew Morton ha scritto:
>> > If they knew it was a no-op, and relying on it, they might as well not
>> > have called it at all and save a syscall.
> Nope. Back in the day (3+ years ago?), msync(MS_ASYNC) would flush
> pte-dirty bits into page->flags:PG_Dirty. So it was used to make the
> filesystem aware that userspace had modified some MAP_SHARED memory.
> The fs would then perform writeback within (typically) 30 seconds. So
> a legitimate use would be for the app to periodically run
> msync(MS_ASYNC) to avoid having modified data floating about
> un-written-back for arbitrarily long periods.
This is in fact the same thing I would like to do in my application.
The fact that I/O is started immediately rather than within 30 seconds
is an implementation detail.
An application that calls msync(MS_ASYNC) periodically indeed wants to
start I/O _sooner or later_, it doesn't really matter when.
> Nowadays we mark the pte's read-only and take a fault on first write,
> and mark the page dirty at that time.
We mark pages dirty but we don't promise writing them back (sooner or
later we will, of course). Otherwise there would be no need for
sync_file_range(..., SYNC_FILE_RANGE_WRITE).
Paolo
next prev parent reply other threads:[~2012-06-14 10:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-31 20:43 [PATCH 0/2] msync improvements Paolo Bonzini
2012-05-31 20:43 ` [PATCH 1/2] msync: support syncing a small part of the file Paolo Bonzini
2012-06-13 21:26 ` Andrew Morton
2012-06-13 21:51 ` Zan Lynx
2012-06-13 22:08 ` Andrew Morton
2012-06-14 8:57 ` Paolo Bonzini
2012-05-31 20:43 ` [PATCH 2/2] msync: start async writeout when MS_ASYNC Paolo Bonzini
2012-06-13 21:29 ` Andrew Morton
2012-06-14 9:02 ` Paolo Bonzini
2012-06-14 10:07 ` Andrew Morton
2012-06-14 10:19 ` Paolo Bonzini [this message]
2012-06-14 12:24 ` Paolo Bonzini
2012-06-12 15:38 ` [PATCH 0/2] msync improvements Paolo Bonzini
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=4FD9BAB5.60206@redhat.com \
--to=pbonzini@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox