From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Konstantin Khlebnikov <koct9i@gmail.com>,
Wu Fengguang <fengguang.wu@intel.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Borislav Petkov <bp@alien8.de>,
"Kirill A. Shutemov" <kirill@shutemov.name>,
Johannes Weiner <hannes@cmpxchg.org>,
Rusty Russell <rusty@rustcorp.com.au>,
David Miller <davem@davemloft.net>,
Andres Freund <andres@2ndquadrant.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-man@vger.kernel.org
Subject: Re: [PATCH 2/3] mm: introduce fincore()
Date: Mon, 2 Jun 2014 10:19:17 -0400 [thread overview]
Message-ID: <538c8829.e863b40a.0787.ffff96f4SMTPIN_ADDED_BROKEN@mx.google.com> (raw)
In-Reply-To: <20140602064226.GA31675@infradead.org>
On Sun, Jun 01, 2014 at 11:42:26PM -0700, Christoph Hellwig wrote:
> Please also provide a man page for the system call.
Yes, I'll do it.
> I'm also very unhappy about the crazy different interpretation of the
> return value depending on flags, which probably becomes more obvious if
> you try to document it.
The meaning of the return value doesn't change due to flags, it's always
"the number of valid entries passed to userspace," not dependent on the
mode (unlike the size of data for example.)
The reason why I did this is skip hole mode, where fincore() could end scanning
before filling up the userspace buffer. So then the caller wants to know where
is the end point of valid data. I thought that the simplest way is to return
it as the return value. It's also possible to to let userspace know it by doing
like below:
- a userspace application zeroes the whole range of the buffer before calling
fincore(FINCORE_SKIP_HOLE)
- after the fincore() returns, it finds the first hole entry then the index
of the hole entry gives the number of valid entries.
Yes, we can do it without the return value, but it takes some costs so I
didn't like it.
> That being said I think fincore is useful, but why not stick to the
> same simple interface as mincore?
mincore() gives only 8-bit field for each page, so we can easily guess that
in the future we will face the need of more information to be passed and we
don't have enough room for it.
Another reason is that currently we have some interfaces to expose page status
information to userspace like /proc/kpageflags, /proc/kpagecount, and
/proc/pid/pagemap. People (including me) tried to add a new interface when they
need a new infomation, but this is not good direction in a long run (too many
/proc/kpage* interfaces). I think fincore() provides a unified way to do it.
One benefit of it is that we can get the data you want in a single call, no need
to call (for example) /proc/pid/pagemap and then /proc/kpageflags separately,
which results in less overhead.
Thanks,
Naoya Horiguchi
--
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>
next prev parent reply other threads:[~2014-06-02 14:20 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-21 2:26 [PATCH 0/4] pagecache scanning with /proc/kpagecache Naoya Horiguchi
2014-05-21 2:26 ` [PATCH 1/4] radix-tree: add end_index to support ranged iteration Naoya Horiguchi
2014-05-21 8:21 ` Konstantin Khlebnikov
2014-05-21 19:26 ` Naoya Horiguchi
2014-05-21 2:26 ` [PATCH 2/4] fs/proc/page.c: introduce /proc/kpagecache interface Naoya Horiguchi
2014-05-21 2:26 ` [PATCH 3/4] tools/vm/page-types.c: rework on file cache scanning mode Naoya Horiguchi
2014-05-21 2:26 ` [PATCH 4/4] Documentation: update Documentation/vm/pagemap.txt Naoya Horiguchi
2014-05-21 22:42 ` [PATCH 0/4] pagecache scanning with /proc/kpagecache Andrew Morton
2014-05-22 2:19 ` Naoya Horiguchi
[not found] ` <537d5ee4.4914e00a.5672.ffff85d5SMTPIN_ADDED_BROKEN@mx.google.com>
2014-05-22 2:33 ` Andrew Morton
2014-05-22 9:50 ` Konstantin Khlebnikov
2014-05-22 10:36 ` Kirill A. Shutemov
2014-05-22 17:47 ` Naoya Horiguchi
2014-05-22 21:02 ` Naoya Horiguchi
2014-06-02 5:24 ` [RFC][PATCH 0/3] mm: introduce fincore() Naoya Horiguchi
2014-06-02 5:24 ` [PATCH 1/3] replace PAGECACHE_TAG_* definition with enumeration Naoya Horiguchi
2014-06-02 16:12 ` Dave Hansen
2014-06-02 16:37 ` Naoya Horiguchi
[not found] ` <1401727052-f7v7kykv@n-horiguchi@ah.jp.nec.com>
2014-06-02 16:45 ` Dave Hansen
2014-06-02 17:14 ` Naoya Horiguchi
2014-06-02 18:19 ` Dave Hansen
2014-06-02 18:48 ` Naoya Horiguchi
2014-06-02 21:16 ` Andrew Morton
2014-06-02 21:51 ` Naoya Horiguchi
2014-06-02 5:24 ` [PATCH 2/3] mm: introduce fincore() Naoya Horiguchi
2014-06-02 6:42 ` Christoph Hellwig
2014-06-02 14:19 ` Naoya Horiguchi [this message]
2014-06-02 7:06 ` Michael Kerrisk
2014-06-02 14:21 ` Naoya Horiguchi
2014-06-02 12:23 ` Kirill A. Shutemov
2014-06-02 14:52 ` Naoya Horiguchi
2014-06-02 16:11 ` Dave Hansen
2014-06-02 16:22 ` Naoya Horiguchi
2014-06-02 5:24 ` [PATCH 3/3] selftest: add test code for fincore() Naoya Horiguchi
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=538c8829.e863b40a.0787.ffff96f4SMTPIN_ADDED_BROKEN@mx.google.com \
--to=n-horiguchi@ah.jp.nec.com \
--cc=acme@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=andres@2ndquadrant.com \
--cc=bp@alien8.de \
--cc=davem@davemloft.net \
--cc=fengguang.wu@intel.com \
--cc=hannes@cmpxchg.org \
--cc=hch@infradead.org \
--cc=kirill@shutemov.name \
--cc=koct9i@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-man@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rusty@rustcorp.com.au \
/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