From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750966AbdEBXed (ORCPT ); Tue, 2 May 2017 19:34:33 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:29847 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750725AbdEBXec (ORCPT ); Tue, 2 May 2017 19:34:32 -0400 Subject: Re: [PATCH RFC] hugetlbfs 'noautofill' mount option To: Dave Hansen , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <326e38dd-b4a8-e0ca-6ff7-af60e8045c74@oracle.com> <7ff6fb32-7d16-af4f-d9d5-698ab7e9e14b@intel.com> From: Prakash Sangappa Message-ID: <03127895-3c5a-5182-82de-3baa3116749e@oracle.com> Date: Tue, 2 May 2017 16:34:18 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <7ff6fb32-7d16-af4f-d9d5-698ab7e9e14b@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/2/17 2:32 PM, Dave Hansen wrote: > On 05/01/2017 11:00 AM, Prakash Sangappa wrote: >> This patch adds a new hugetlbfs mount option 'noautofill', to indicate that >> pages should not be allocated at page fault time when accessed thru mmapped >> address. > I think the main argument against doing something like this is further > specializing hugetlbfs. I was really hoping that userfaultfd would be > usable for your needs here. > > Could you elaborate on other options that you considered? Did you look > at userfaultfd? What about an madvise() option that disallows backing > allocations? Yes, we did consider userfaultfd and madvise(). The use case in mind is the database. With a database, large number of single threaded processes are involved which will map hugetlbfs file and use it for shared memory. The concern with using userfaultfd is the overhead of setup and having an additional thread per process to monitor the userfaultfd. Even if the additional thread can be avoided, by using an external monitor process and each process sending the userfaultfd to this monitor process, setup overhead exists. Similarly, a madvise() option also requires additional system call by every process mapping the file, this is considered a overhead for the database. If we do consider a new madvise() option, will it be acceptable since this will be specifically for hugetlbfs file mappings? If so, would a new flag to mmap() call itself be acceptable, which would define the proposed behavior?. That way no additional system calls need to be made. Again this mmap flag would be applicable specifically to hugetlbfs file mappings With the proposed mount option, it would enforce one consistent behavior and the application using this filesystem would not have to take additional steps as with userfaultfd or madvise().