From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Greg Troxel <gdt@ir.bbn.com>
Cc: mtk.manpages@gmail.com, Richard Hansen <rhansen@bbn.com>,
Steven Whitehouse <swhiteho@redhat.com>,
Christoph Hellwig <hch@infradead.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
lkml <linux-kernel@vger.kernel.org>,
Linux API <linux-api@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH] mm: msync: require either MS_ASYNC or MS_SYNC
Date: Fri, 04 Apr 2014 09:11:19 +0200 [thread overview]
Message-ID: <533E5B17.8010804@gmail.com> (raw)
In-Reply-To: <rmivbuqy3hr.fsf@fnord.ir.bbn.com>
Hi Greg,
On 04/03/2014 02:57 PM, Greg Troxel wrote:
>
> "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> writes:
>
>> I think the only reasonable solution is to better document existing
>> behavior and what the programmer should do. With that in mind, I've
>> drafted the following text for the msync(2) man page:
>>
>> NOTES
>> According to POSIX, exactly one of MS_SYNC and MS_ASYNC must be
>> specified in flags. However, Linux permits a call to msync()
>> that specifies neither of these flags, with semantics that are
>> (currently) equivalent to specifying MS_ASYNC. (Since Linux
>> 2.6.19, MS_ASYNC is in fact a no-op, since the kernel properly
>> tracks dirty pages and flushes them to storage as necessary.)
>> Notwithstanding the Linux behavior, portable, future-proof appli‐
>> cations should ensure that they specify exactly one of MS_SYNC
>> and MS_ASYNC in flags.
>>
>> Comments on this draft welcome.
>
> I think it's a step backwards to document unspecified behavior. If
> anything, the man page should make it clear that providing neither flag
> results in undefined behavior and will lead to failure on systems on
> than Linux. While I can see the point of not changing the previous
> behavior to protect buggy code, there's no need to document it in the
> man page and further enshrine it.
The Linux behavior is what it is. For the reasons I mentioned already,
it's unlikely to change. And, when the man pages omit to explain what
Linux actually does, there will one day come a request to actually
document the behavior. So, I don't think it's quite enough to say the
behavior is undefined. On the other hand, it does not hurt to further
expand the portability warning. I made the text now:
NOTES
According to POSIX, either MS_SYNC or MS_ASYNC must be specified
in flags, and indeed failure to include one of these flags will
cause msync() to fail on some systems. However, Linux permits a
call to msync() that specifies neither of these flags, with
semantics that are (currently) equivalent to specifying MS_ASYNC.
(Since Linux 2.6.19, MS_ASYNC is in fact a no-op, since the ker‐
nel properly tracks dirty pages and flushes them to storage as
necessary.) Notwithstanding the Linux behavior, portable,
future-proof applications should ensure that they specify either
MS_SYNC or MS_ASYNC in flags.
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Greg Troxel <gdt@ir.bbn.com>
Cc: mtk.manpages@gmail.com, Richard Hansen <rhansen@bbn.com>,
Steven Whitehouse <swhiteho@redhat.com>,
Christoph Hellwig <hch@infradead.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
lkml <linux-kernel@vger.kernel.org>,
Linux API <linux-api@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH] mm: msync: require either MS_ASYNC or MS_SYNC
Date: Fri, 04 Apr 2014 09:11:19 +0200 [thread overview]
Message-ID: <533E5B17.8010804@gmail.com> (raw)
In-Reply-To: <rmivbuqy3hr.fsf@fnord.ir.bbn.com>
Hi Greg,
On 04/03/2014 02:57 PM, Greg Troxel wrote:
>
> "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> writes:
>
>> I think the only reasonable solution is to better document existing
>> behavior and what the programmer should do. With that in mind, I've
>> drafted the following text for the msync(2) man page:
>>
>> NOTES
>> According to POSIX, exactly one of MS_SYNC and MS_ASYNC must be
>> specified in flags. However, Linux permits a call to msync()
>> that specifies neither of these flags, with semantics that are
>> (currently) equivalent to specifying MS_ASYNC. (Since Linux
>> 2.6.19, MS_ASYNC is in fact a no-op, since the kernel properly
>> tracks dirty pages and flushes them to storage as necessary.)
>> Notwithstanding the Linux behavior, portable, future-proof applia??
>> cations should ensure that they specify exactly one of MS_SYNC
>> and MS_ASYNC in flags.
>>
>> Comments on this draft welcome.
>
> I think it's a step backwards to document unspecified behavior. If
> anything, the man page should make it clear that providing neither flag
> results in undefined behavior and will lead to failure on systems on
> than Linux. While I can see the point of not changing the previous
> behavior to protect buggy code, there's no need to document it in the
> man page and further enshrine it.
The Linux behavior is what it is. For the reasons I mentioned already,
it's unlikely to change. And, when the man pages omit to explain what
Linux actually does, there will one day come a request to actually
document the behavior. So, I don't think it's quite enough to say the
behavior is undefined. On the other hand, it does not hurt to further
expand the portability warning. I made the text now:
NOTES
According to POSIX, either MS_SYNC or MS_ASYNC must be specified
in flags, and indeed failure to include one of these flags will
cause msync() to fail on some systems. However, Linux permits a
call to msync() that specifies neither of these flags, with
semantics that are (currently) equivalent to specifying MS_ASYNC.
(Since Linux 2.6.19, MS_ASYNC is in fact a no-op, since the kera??
nel properly tracks dirty pages and flushes them to storage as
necessary.) Notwithstanding the Linux behavior, portable,
future-proof applications should ensure that they specify either
MS_SYNC or MS_ASYNC in flags.
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Greg Troxel <gdt@ir.bbn.com>
Cc: mtk.manpages@gmail.com, Richard Hansen <rhansen@bbn.com>,
Steven Whitehouse <swhiteho@redhat.com>,
Christoph Hellwig <hch@infradead.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
lkml <linux-kernel@vger.kernel.org>,
Linux API <linux-api@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH] mm: msync: require either MS_ASYNC or MS_SYNC
Date: Fri, 04 Apr 2014 09:11:19 +0200 [thread overview]
Message-ID: <533E5B17.8010804@gmail.com> (raw)
In-Reply-To: <rmivbuqy3hr.fsf@fnord.ir.bbn.com>
Hi Greg,
On 04/03/2014 02:57 PM, Greg Troxel wrote:
>
> "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> writes:
>
>> I think the only reasonable solution is to better document existing
>> behavior and what the programmer should do. With that in mind, I've
>> drafted the following text for the msync(2) man page:
>>
>> NOTES
>> According to POSIX, exactly one of MS_SYNC and MS_ASYNC must be
>> specified in flags. However, Linux permits a call to msync()
>> that specifies neither of these flags, with semantics that are
>> (currently) equivalent to specifying MS_ASYNC. (Since Linux
>> 2.6.19, MS_ASYNC is in fact a no-op, since the kernel properly
>> tracks dirty pages and flushes them to storage as necessary.)
>> Notwithstanding the Linux behavior, portable, future-proof appli‐
>> cations should ensure that they specify exactly one of MS_SYNC
>> and MS_ASYNC in flags.
>>
>> Comments on this draft welcome.
>
> I think it's a step backwards to document unspecified behavior. If
> anything, the man page should make it clear that providing neither flag
> results in undefined behavior and will lead to failure on systems on
> than Linux. While I can see the point of not changing the previous
> behavior to protect buggy code, there's no need to document it in the
> man page and further enshrine it.
The Linux behavior is what it is. For the reasons I mentioned already,
it's unlikely to change. And, when the man pages omit to explain what
Linux actually does, there will one day come a request to actually
document the behavior. So, I don't think it's quite enough to say the
behavior is undefined. On the other hand, it does not hurt to further
expand the portability warning. I made the text now:
NOTES
According to POSIX, either MS_SYNC or MS_ASYNC must be specified
in flags, and indeed failure to include one of these flags will
cause msync() to fail on some systems. However, Linux permits a
call to msync() that specifies neither of these flags, with
semantics that are (currently) equivalent to specifying MS_ASYNC.
(Since Linux 2.6.19, MS_ASYNC is in fact a no-op, since the ker‐
nel properly tracks dirty pages and flushes them to storage as
necessary.) Notwithstanding the Linux behavior, portable,
future-proof applications should ensure that they specify either
MS_SYNC or MS_ASYNC in flags.
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
next prev parent reply other threads:[~2014-04-04 7:11 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-01 18:25 [PATCH] mm: msync: require either MS_ASYNC or MS_SYNC Richard Hansen
2014-04-01 18:25 ` Richard Hansen
[not found] ` <533B04A9.6090405-A08e6c8yq/Q@public.gmane.org>
2014-04-01 19:32 ` Michael Kerrisk (man-pages)
2014-04-01 19:32 ` Michael Kerrisk (man-pages)
2014-04-01 19:32 ` Michael Kerrisk (man-pages)
2014-04-02 0:53 ` Richard Hansen
2014-04-02 0:53 ` Richard Hansen
[not found] ` <533B1439.3010403-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-04-02 10:45 ` chrubis-AlSwsSmVLrQ
2014-04-02 10:45 ` chrubis
2014-04-02 10:45 ` chrubis
2014-04-02 11:10 ` Christoph Hellwig
2014-04-02 11:10 ` Christoph Hellwig
2014-04-02 11:10 ` Christoph Hellwig
[not found] ` <20140402111032.GA27551-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2014-04-02 11:45 ` Steven Whitehouse
2014-04-02 11:45 ` Steven Whitehouse
2014-04-02 11:45 ` Steven Whitehouse
2014-04-02 23:44 ` Richard Hansen
2014-04-02 23:44 ` Richard Hansen
2014-04-02 23:44 ` Richard Hansen
2014-04-03 8:25 ` Michael Kerrisk (man-pages)
2014-04-03 8:25 ` Michael Kerrisk (man-pages)
2014-04-03 11:51 ` Christopher Covington
2014-04-03 11:51 ` Christopher Covington
2014-04-04 6:54 ` Michael Kerrisk (man-pages)
2014-04-04 6:54 ` Michael Kerrisk (man-pages)
2014-04-04 6:54 ` Michael Kerrisk (man-pages)
2014-04-03 12:57 ` Greg Troxel
2014-04-03 12:57 ` Greg Troxel
2014-04-04 7:11 ` Michael Kerrisk (man-pages) [this message]
2014-04-04 7:11 ` Michael Kerrisk (man-pages)
2014-04-04 7:11 ` Michael Kerrisk (man-pages)
2014-04-03 20:23 ` Richard Hansen
2014-04-03 20:23 ` Richard Hansen
2014-04-04 6:53 ` Christoph Hellwig
2014-04-04 6:53 ` Christoph Hellwig
2014-04-04 7:12 ` [PATCH] mm: msync: require either MS_ASYNC or MS_SYNC [resend] Michael Kerrisk (man-pages)
2014-04-04 7:12 ` Michael Kerrisk (man-pages)
2014-04-04 7:12 ` Michael Kerrisk (man-pages)
2014-04-04 14:07 ` Peter Zijlstra
2014-04-04 14:07 ` Peter Zijlstra
-- strict thread matches above, loose matches on Subject: below --
2013-09-01 19:58 [PATCH] mm: msync: require either MS_ASYNC or MS_SYNC Richard Hansen
2013-09-01 19:58 ` Richard Hansen
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=533E5B17.8010804@gmail.com \
--to=mtk.manpages@gmail.com \
--cc=gdt@ir.bbn.com \
--cc=hch@infradead.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterz@infradead.org \
--cc=rhansen@bbn.com \
--cc=swhiteho@redhat.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.