From: Dave Hansen <dave.hansen@intel.com>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
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,
Christoph Hellwig <hch@infradead.org>,
Dave Chinner <david@fromorbit.com>,
Michael Kerrisk <mtk.manpages@gmail.com>,
Linux API <linux-api@vger.kernel.org>,
Naoya Horiguchi <nao.horiguchi@gmail.com>
Subject: Re: [PATCH v3 1/3] mm: introduce fincore()
Date: Tue, 08 Jul 2014 15:32:30 -0700 [thread overview]
Message-ID: <53BC717E.6020705@intel.com> (raw)
In-Reply-To: <20140708204132.GA16195@nhori.redhat.com>
On 07/08/2014 01:41 PM, Naoya Horiguchi wrote:
>> > It would only set the first two bytes of a
>> > 256k BMAP buffer since only two pages were encountered in the radix tree.
> Hmm, this example shows me a problem, thanks.
>
> If the user knows the fd is for 1GB hugetlbfs file, it just prepares
> the 2 bytes buffer, so no problem.
> But if the user doesn't know whether the fd is from hugetlbfs file,
> the user must prepare the large buffer, though only first few bytes
> are used. And the more problematic is that the user could interpret
> the data in buffer differently:
> 1. only the first two 4kB-pages are loaded in the 2GB range,
> 2. two 1GB-pages are loaded.
> So for such callers, fincore() must notify the relevant page size
> in some way on return.
> Returning it via fincore_extra is my first thought but I'm not sure
> if it's elegant enough.
That does limit the interface to being used on a single page size per
call, which doesn't sound too bad since we don't mix page sizes in a
single file. But, you mentioned using this interface along with
/proc/$pid/mem. How would this deal with a process which had two sizes
of pages mapped?
Another option would be to have userspace pass in its desired
granularity. Such an interface could be used to find holes in a file
fairly easily. But, introduces a whole new set of issues, like what
BMAP means if only a part of the granule is in-core, and do you need a
new option to differentiate BMAP_AND vs. BMAP_OR operations.
I honestly think we need to take a step back and enumerate what you're
trying to do here before going any further.
--
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-07-08 22:32 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-07 18:00 [PATCH v3 0/3] mm: introduce fincore() v3 Naoya Horiguchi
2014-07-07 18:00 ` [PATCH v3 1/3] mm: introduce fincore() Naoya Horiguchi
2014-07-07 19:01 ` Dave Hansen
2014-07-07 20:21 ` Naoya Horiguchi
2014-07-07 20:43 ` Dave Hansen
2014-07-07 21:48 ` Naoya Horiguchi
2014-07-07 22:44 ` Dave Hansen
2014-07-08 15:35 ` Naoya Horiguchi
2014-07-08 19:03 ` Naoya Horiguchi
2014-07-08 19:42 ` Dave Hansen
2014-07-08 20:41 ` Naoya Horiguchi
2014-07-08 22:32 ` Dave Hansen [this message]
2014-07-11 16:53 ` Naoya Horiguchi
2014-07-07 18:00 ` [PATCH v3 2/3] selftests/fincore: add test code for fincore() Naoya Horiguchi
2014-07-07 18:00 ` [PATCH v3 3/3] man2/fincore.2: document general description about fincore(2) Naoya Horiguchi
[not found] ` <1404756006-23794-4-git-send-email-n-horiguchi-PaJj6Psr51x8UrSeD/g0lQ@public.gmane.org>
2014-07-07 19:08 ` Dave Hansen
2014-07-07 20:59 ` Naoya Horiguchi
2014-07-07 22:34 ` Dave Hansen
2014-07-08 15:43 ` Naoya Horiguchi
2014-07-08 12:16 ` [PATCH v3 0/3] mm: introduce fincore() v3 Christoph Hellwig
2014-07-08 13:27 ` Naoya Horiguchi
2014-07-09 8:51 ` Christoph Hellwig
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=53BC717E.6020705@intel.com \
--to=dave.hansen@intel.com \
--cc=acme@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=andres@2ndquadrant.com \
--cc=bp@alien8.de \
--cc=davem@davemloft.net \
--cc=david@fromorbit.com \
--cc=fengguang.wu@intel.com \
--cc=hannes@cmpxchg.org \
--cc=hch@infradead.org \
--cc=kirill@shutemov.name \
--cc=koct9i@gmail.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mtk.manpages@gmail.com \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=nao.horiguchi@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).