lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 09 Oct 2017 03:51:06 +0800
From:   "Yang Shi" <yang.s@...baba-inc.com>
To:     "Kirill A. Shutemov" <kirill@...temov.name>
Cc:     kirill.shutemov@...ux.intel.com, hughd@...gle.com,
        mhocko@...nel.org, akpm@...ux-foundation.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH] mm: shm: round up tmpfs size to huge page size when
 huge=always



On 10/8/17 5:56 AM, Kirill A. Shutemov wrote:
> 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.

How about printing a warning to say the filesystem is resized?

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

It sounds fine too. When mounting tmpfs with "huge=always", if the size 
is not THP size aligned, it just can refuse to mount, then show warning 
about alignment restriction.

Thanks,
Yang

> 

Powered by blists - more mailing lists