[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <53BC717E.6020705@intel.com>
Date: Tue, 08 Jul 2014 15:32:30 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Naoya Horiguchi <n-horiguchi@...jp.nec.com>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Konstantin Khlebnikov <koct9i@...il.com>,
Wu Fengguang <fengguang.wu@...el.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Borislav Petkov <bp@...en8.de>,
"Kirill A. Shutemov" <kirill@...temov.name>,
Johannes Weiner <hannes@...xchg.org>,
Rusty Russell <rusty@...tcorp.com.au>,
David Miller <davem@...emloft.net>,
Andres Freund <andres@...quadrant.com>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Christoph Hellwig <hch@...radead.org>,
Dave Chinner <david@...morbit.com>,
Michael Kerrisk <mtk.manpages@...il.com>,
Linux API <linux-api@...r.kernel.org>,
Naoya Horiguchi <nao.horiguchi@...il.com>
Subject: Re: [PATCH v3 1/3] mm: introduce fincore()
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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists