Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751421AbdGZStB (ORCPT ); Wed, 26 Jul 2017 14:49:01 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:45750 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751053AbdGZSs7 (ORCPT ); Wed, 26 Jul 2017 14:48:59 -0400 Date: Wed, 26 Jul 2017 11:48:56 -0700 From: Matthew Wilcox To: Mike Kravetz Cc: Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, ak@linux.intel.com, mtk.manpages@gmail.com, Davidlohr Bueso , khandual@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com, aarcange@redhat.com Subject: Re: [RFC PATCH 3/3] mm: shm: Use new hugetlb size encoding definitions Message-ID: <20170726184856.GB15980@bombadil.infradead.org> References: <20170328175408.GD7838@bombadil.infradead.org> <1500330481-28476-1-git-send-email-mike.kravetz@oracle.com> <1500330481-28476-4-git-send-email-mike.kravetz@oracle.com> <20170726095338.GF2981@dhcp22.suse.cz> <20170726100718.GG2981@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.0 (2017-02-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1910 Lines: 34 On Wed, Jul 26, 2017 at 10:39:30AM -0700, Mike Kravetz wrote: > In the overview of this RFC, I mentioned still needing to address the > comment from Aneesh about splitting SHM_HUGE_* definitions into arch > specific header files. This is how it is done for mmap. If an arch > supports multiple huge page sizes, the 'asm/mman.h' contains definitions > for those sizes. There will be a bit of churn (such as header file > renaming) to do this for shm as well. So, I keep going back and forth > asking myself 'is it worth it'? Some things to consider. > > - We should be consistent between mmap and shm. Also remember, that I > will propose adding the same type of encoding to memfd_create. So, > three system calls will use the encoding. They should be consistent. I think mmap is wrong here. User programs are generally not architecture specific, so they'll have to test with ifdefs or something awful. For all we know, POWER 14 and whatever x86 CPU comes out in 2030 will support (nearly) arbitrary page sizes like Itanium does, and a user program compiled today should be able to take advantage of it. > - Adding the arch specific definitions seems the 'most correct', as a > user can not use a definition not supported by the arch. However, > even if an arch supports a huge page size it does not mean that the > running kernel supports that size. Therefore, the folllowing is in > the man page. > "The range of huge page sizes that are supported by the system > can be discovered by listing the subdirectories in > /sys/kernel/mm/hugepages." > - Another alternative is to make all known huge page sizes available > to all users. This is 'easier' as the definitions can likely reside > in a common header file. The user will need to determine what > huge page sizes are supported by the running kernel as mentioned in > the man page. That's my preference.