LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Yang Shi <yang.shi@linux.alibaba.com>
To: Mike Kravetz <mike.kravetz@oracle.com>,
	viro@zeniv.linux.org.uk, nyc@holomorphy.com,
	kirill.shutemov@linux.intel.com, hughd@google.com,
	akpm@linux-foundation.org
Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] fs: introduce ST_HUGE flag and set it to tmpfs and hugetlbfs
Date: Wed, 18 Apr 2018 13:53:28 -0700	[thread overview]
Message-ID: <293caaaf-39c0-7634-fbd2-70a540ea58db@linux.alibaba.com> (raw)
In-Reply-To: <2804a1d0-9d68-ac43-3041-9490147b52b5@oracle.com>



On 4/18/18 1:26 PM, Mike Kravetz wrote:
> On 04/17/2018 02:08 PM, Yang Shi wrote:
>> And, set the flag for hugetlbfs as well to keep the consistency, and the
>> applications don't have to know what filesystem is used to use huge
>> page, just need to check ST_HUGE flag.
> For hugetlbfs, setting such a flag would be for consistency only.  mapping
> hugetlbfs files REQUIRES huge page alignment and size.

Yes, applications don't have to read this flag if the underlying 
filesystem is hugetlbfs. The fs magic number is good enough.

>
> If an application would want to take advantage of this flag for tmpfs, it
> needs to map at a fixed address (MAP_FIXED) for huge page alignment.  So,
> it will need to do one of the 'mmap tricks' to get a mapping at a suitably
> aligned address.

It doesn't have to be MAP_FIXED, but definitely has to be huge page 
aligned. This flag is aimed for this case. With this flag, the 
applications can know the underlying tmpfs with huge page supported, 
then the applications can mmap memory with huge page alignment 
intentionally.

>
> IIRC, there is code to 'suitably align' DAX mappings to appropriate huge page
> boundaries.  Perhaps, something like this could be added for tmpfs mounted
> with huge=?  Of course, this would not take into account 'length' but may
> help some.

Might be. However THP already exported huge page size to sysfs, the 
applications can read it to get the alignment.

Thanks,
Yang

>

  reply	other threads:[~2018-04-18 20:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-17 21:08 Yang Shi
2018-04-17 21:31 ` Andrew Morton
2018-04-17 21:51   ` Yang Shi
2018-04-17 23:22 ` Matthew Wilcox
2018-04-17 23:37   ` Yang Shi
2018-04-18 10:27 ` Christoph Hellwig
2018-04-18 18:18   ` Yang Shi
2018-04-19  8:28     ` Christoph Hellwig
2018-04-19  9:05       ` Kirill A. Shutemov
2018-04-20  0:18       ` Yang Shi
2018-04-18 20:26 ` Mike Kravetz
2018-04-18 20:53   ` Yang Shi [this message]
2018-04-19  9:01   ` Kirill A. Shutemov

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=293caaaf-39c0-7634-fbd2-70a540ea58db@linux.alibaba.com \
    --to=yang.shi@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=nyc@holomorphy.com \
    --cc=viro@zeniv.linux.org.uk \
    --subject='Re: [RFC PATCH] fs: introduce ST_HUGE flag and set it to tmpfs and hugetlbfs' \
    /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

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).