From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751556AbdGQWaD (ORCPT ); Mon, 17 Jul 2017 18:30:03 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:25605 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751377AbdGQW3t (ORCPT ); Mon, 17 Jul 2017 18:29:49 -0400 From: Mike Kravetz To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Matthew Wilcox , akpm@linux-foundation.org, mhocko@suse.com, ak@linux.intel.com, mtk.manpages@gmail.com, Davidlohr Bueso , khandual@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com, aarcange@redhat.com, Mike Kravetz Subject: Re: [PATCH] mm,hugetlb: compute page_size_log properly Date: Mon, 17 Jul 2017 15:27:58 -0700 Message-Id: <1500330481-28476-1-git-send-email-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <20170328175408.GD7838@bombadil.infradead.org> References: <20170328175408.GD7838@bombadil.infradead.org> 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 I hate to resurrect this thread, but I would like to add hugetlb support to memfd_create. This is for JVM garbage collection as discussed in this thread [1]. Adding hugetlb support to memfd_create, means that memfd_create will take a flag something like MFD_HUGETLB. And, if a user wants hugetlb pages they may want a huge page size different than the system default. So, it make sense to use the same type of encoding used by mmap and shmget. However, I would hate to copy/paste the same values used by mmap and shmget and just give them different names. So, how about something like the following: 1) Put all the log2 encoded huge page size definitions in a common header file. 2) Arch specific code can use these values, or overwrite as needed. 3) All system calls using this encoding (mmap, shmget and memfd_create in the future) will use these common values. I have also put the shm user space definitions in the uapi file as previously suggested by Matthew Wilcox. I did not (yet) move the shm definitions to arch specific files as suggested by Aneesh Kumar. [1] https://lkml.org/lkml/2017/7/6/564 Mike Kravetz (3): mm:hugetlb: Define system call hugetlb size encodings in single file mm: arch: Use new hugetlb size encoding definitions mm: shm: Use new hugetlb size encoding definitions arch/alpha/include/uapi/asm/mman.h | 14 ++++++-------- arch/mips/include/uapi/asm/mman.h | 14 ++++++-------- arch/parisc/include/uapi/asm/mman.h | 14 ++++++-------- arch/powerpc/include/uapi/asm/mman.h | 23 ++++++++++------------- arch/x86/include/uapi/asm/mman.h | 10 ++++++++-- arch/xtensa/include/uapi/asm/mman.h | 14 ++++++-------- include/linux/shm.h | 17 ----------------- include/uapi/asm-generic/hugetlb_encode.h | 30 ++++++++++++++++++++++++++++++ include/uapi/asm-generic/mman-common.h | 6 ++++-- include/uapi/linux/shm.h | 23 +++++++++++++++++++++-- 10 files changed, 97 insertions(+), 68 deletions(-) create mode 100644 include/uapi/asm-generic/hugetlb_encode.h -- 2.7.5