Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755620AbcC2BN1 (ORCPT ); Mon, 28 Mar 2016 21:13:27 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:19504 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932067AbcC2BNY (ORCPT ); Mon, 28 Mar 2016 21:13:24 -0400 From: Mike Kravetz To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, x86@kernel.org Cc: Hugh Dickins , Naoya Horiguchi , Hillf Danton , "Kirill A. Shutemov" , David Rientjes , Dave Hansen , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Catalin Marinas , Will Deacon , Steve Capper , Andrew Morton , Mike Kravetz Subject: [RFC PATCH 0/2] hugetlb: If PMD sharing is possible, align to PUD_SIZE Date: Mon, 28 Mar 2016 18:12:48 -0700 Message-Id: <1459213970-17957-1-git-send-email-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.4.3 X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1347 Lines: 31 PMD sharing for hugetlb mappings has been present for quite some time. However, specific conditions must be met for mappings to be shared. One of those conditions is that the mapping must include all pages that can be mapped by a PUD. To help facilitate this, the mapping should be PUD_SIZE aligned. The only way for a user to get PUD_SIZE alignment is to pass an address to mmap() or shmat(). If the user does not pass an address the mapping will be huge page size aligned. To better utilize huge PMD sharing, attempt to PUD_SIZE align mappings if the following conditions are met: - Address passed to mmap or shmat is NULL - The mapping is flaged as shared - The mapping is at least PUD_SIZE in length If a PUD_SIZE aligned mapping can not be created, then fall back to a huge page size mapping. Currently, only arm64 and x86 support PMD sharing. x86 has HAVE_ARCH_HUGETLB_UNMAPPED_AREA (where code changes are made). arm64 uses the architecture independent code. Mike Kravetz (2): mm/hugetlbfs: Attempt PUD_SIZE mapping alignment if PMD sharing enabled x86/hugetlb: Attempt PUD_SIZE mapping alignment if PMD sharing enabled arch/x86/mm/hugetlbpage.c | 64 ++++++++++++++++++++++++++++++++++++++++++++--- fs/hugetlbfs/inode.c | 29 +++++++++++++++++++-- 2 files changed, 88 insertions(+), 5 deletions(-) -- 2.4.3