lkml.org 
[lkml]   [2017]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH] mm: shm: round up tmpfs size to huge page size when huge=always
On Sat, Oct 07, 2017 at 04:22:10AM +0800, Yang Shi wrote:
> When passing "huge=always" option for mounting tmpfs, THP is supposed to
> be allocated all the time when it can fit, but when the available space is
> smaller than the size of THP (2MB on x86), shmem fault handler still tries
> to allocate huge page every time, then fallback to regular 4K page
> allocation, i.e.:
>
> # mount -t tmpfs -o huge,size=3000k tmpfs /tmp
> # dd if=/dev/zero of=/tmp/test bs=1k count=2048
> # dd if=/dev/zero of=/tmp/test1 bs=1k count=2048
>
> The last dd command will handle 952 times page fault handler, then exit
> with -ENOSPC.
>
> Rounding up tmpfs size to THP size in order to use THP with "always"
> more efficiently. And, it will not wast too much memory (just allocate
> 511 extra pages in worst case).

Hm. I don't think it's good idea to silently increase size of fs.

Maybe better just refuse to mount with huge=always for too small fs?

--
Kirill A. Shutemov

\
 
 \ /
  Last update: 2017-10-08 14:58    [W:0.077 / U:1.776 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site