Re: [RFC PATCH] fs: introduce ST_HUGE flag and set it to tmpfs and hugetlbfs

2018-04-22 Thread Kirill A. Shutemov
On Thu, Apr 19, 2018 at 01:28:10AM -0700, Christoph Hellwig wrote: > On Wed, Apr 18, 2018 at 11:18:25AM -0700, Yang Shi wrote: > > Yes, thanks for the suggestion. I did think about it before I went with the > > new flag. Not like hugetlb, THP will *not* guarantee huge page is used all > > the time,

Re: [RFC PATCH] fs: introduce ST_HUGE flag and set it to tmpfs and hugetlbfs

2018-04-22 Thread Kirill A. Shutemov
On Wed, Apr 18, 2018 at 01:26:35PM -0700, Mike Kravetz wrote: > 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 > aligne

Re: [RFC PATCH] fs: introduce ST_HUGE flag and set it to tmpfs and hugetlbfs

2018-04-19 Thread Yang Shi
On 4/19/18 1:28 AM, Christoph Hellwig wrote: On Wed, Apr 18, 2018 at 11:18:25AM -0700, Yang Shi wrote: Yes, thanks for the suggestion. I did think about it before I went with the new flag. Not like hugetlb, THP will *not* guarantee huge page is used all the time, it may fallback to regular 4K

Re: [RFC PATCH] fs: introduce ST_HUGE flag and set it to tmpfs and hugetlbfs

2018-04-19 Thread Christoph Hellwig
On Wed, Apr 18, 2018 at 11:18:25AM -0700, Yang Shi wrote: > Yes, thanks for the suggestion. I did think about it before I went with the > new flag. Not like hugetlb, THP will *not* guarantee huge page is used all > the time, it may fallback to regular 4K page or may get split. I'm not sure > how th

Re: [RFC PATCH] fs: introduce ST_HUGE flag and set it to tmpfs and hugetlbfs

2018-04-18 Thread Yang Shi
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 fla

Re: [RFC PATCH] fs: introduce ST_HUGE flag and set it to tmpfs and hugetlbfs

2018-04-18 Thread Mike Kravetz
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. mappi

Re: [RFC PATCH] fs: introduce ST_HUGE flag and set it to tmpfs and hugetlbfs

2018-04-18 Thread Yang Shi
On 4/18/18 3:27 AM, Christoph Hellwig wrote: On Wed, Apr 18, 2018 at 05:08:13AM +0800, Yang Shi wrote: Since tmpfs THP was supported in 4.8, hugetlbfs is not the only filesystem with huge page support anymore. tmpfs can use huge page via THP when mounting by "huge=" mount option. When applica

Re: [RFC PATCH] fs: introduce ST_HUGE flag and set it to tmpfs and hugetlbfs

2018-04-18 Thread Christoph Hellwig
On Wed, Apr 18, 2018 at 05:08:13AM +0800, Yang Shi wrote: > Since tmpfs THP was supported in 4.8, hugetlbfs is not the only > filesystem with huge page support anymore. tmpfs can use huge page via > THP when mounting by "huge=" mount option. > > When applications use huge page on hugetlbfs, it jus

Re: [RFC PATCH] fs: introduce ST_HUGE flag and set it to tmpfs and hugetlbfs

2018-04-17 Thread Yang Shi
On 4/17/18 4:22 PM, Matthew Wilcox wrote: On Wed, Apr 18, 2018 at 05:08:13AM +0800, Yang Shi wrote: When applications use huge page on hugetlbfs, it just need check the filesystem magic number, but it is not enough for tmpfs. So, introduce ST_HUGE flag to statfs if super block has SB_HUGE set

Re: [RFC PATCH] fs: introduce ST_HUGE flag and set it to tmpfs and hugetlbfs

2018-04-17 Thread Matthew Wilcox
On Wed, Apr 18, 2018 at 05:08:13AM +0800, Yang Shi wrote: > When applications use huge page on hugetlbfs, it just need check the > filesystem magic number, but it is not enough for tmpfs. So, introduce > ST_HUGE flag to statfs if super block has SB_HUGE set which indicates > huge page is supported

Re: [RFC PATCH] fs: introduce ST_HUGE flag and set it to tmpfs and hugetlbfs

2018-04-17 Thread Yang Shi
On 4/17/18 2:31 PM, Andrew Morton wrote: On Wed, 18 Apr 2018 05:08:13 +0800 Yang Shi wrote: Since tmpfs THP was supported in 4.8, hugetlbfs is not the only filesystem with huge page support anymore. tmpfs can use huge page via THP when mounting by "huge=" mount option. When applications use

Re: [RFC PATCH] fs: introduce ST_HUGE flag and set it to tmpfs and hugetlbfs

2018-04-17 Thread Andrew Morton
On Wed, 18 Apr 2018 05:08:13 +0800 Yang Shi wrote: > Since tmpfs THP was supported in 4.8, hugetlbfs is not the only > filesystem with huge page support anymore. tmpfs can use huge page via > THP when mounting by "huge=" mount option. > > When applications use huge page on hugetlbfs, it just nee

[RFC PATCH] fs: introduce ST_HUGE flag and set it to tmpfs and hugetlbfs

2018-04-17 Thread Yang Shi
Since tmpfs THP was supported in 4.8, hugetlbfs is not the only filesystem with huge page support anymore. tmpfs can use huge page via THP when mounting by "huge=" mount option. When applications use huge page on hugetlbfs, it just need check the filesystem magic number, but it is not enough for t