Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1001927yba; Thu, 9 May 2019 09:09:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFYzGAGs5ZSgSFVj57uiJlRVjqcW/9ZKMMgaWFo5wcCYdkGy1+7ypbjzAXazH/Jj54yVl5 X-Received: by 2002:a17:902:7c8f:: with SMTP id y15mr6243251pll.339.1557418196733; Thu, 09 May 2019 09:09:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557418196; cv=none; d=google.com; s=arc-20160816; b=E+c3GaffdwehfcY8r+qixFAzzPHjjcjO6IBSOVgBH7C8PNPXxP7Sm/um2bSIB/WU1Q RxGxw2O/HR/XHVda/sUw7P8puGkt5dav2Ly+Y7sory48ibUBvrSmuEHredclFOW3dfx+ tgDND90MIEdElSyNgv8eIFRIE4aoy0i3QUCgvKuxz1ZxLYreP/SyvPCIuKexHcTjHGdj 8eTXEfatE91/u6U8bdVK/bxFQVkcRbUEaHBh/WRXUrWPf4OqVhNxHJ5WdZ8dHfJRWgNh mmtbMH6aqVu+d19x9laNgUCW/6jsQll8B9oVNmLAMBWDdD4RJawvYX9xVF+LQAHwmqvY nJqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=I6PRi0pOdbF1qRia4hyU8vB77984ia94C6lSX8nieBc=; b=FYne3pNHtjnBVHN15cMrq/yOnXJKEhuHDifR42vNLPtQjUcnnjy2WuniDg/jhuf0S6 ACo3IQma6/du3a5Yfj161Ju91U+HO/MWrRWh8esdaGuijqR541LufK3U04bBnDnstkx6 FWekvvZCeDBkaiaHtCOYCPbr1v4S5c/y5ViTm9I2FIW/VuQioi+Fesuyfb9kYXtKDduZ 6QNeYsOVLfaIWNNk58KFHMHnHT767iiCXoQwGxLINHUD5LPIHIR7lnU5rg2G8BCbkj19 /9BRdH3lIyoMujXvxqSHk2cOwpMtEk08etvZnUvlKGWCznOl72XPTSlJFpIrFopiGOCp OHfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=MSFLQ2u1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j128si3845251pfc.65.2019.05.09.09.09.39; Thu, 09 May 2019 09:09:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=MSFLQ2u1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726690AbfEIQHh (ORCPT + 99 others); Thu, 9 May 2019 12:07:37 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:39410 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726187AbfEIQHh (ORCPT ); Thu, 9 May 2019 12:07:37 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x49G41Lh084886; Thu, 9 May 2019 16:07:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2018-07-02; bh=I6PRi0pOdbF1qRia4hyU8vB77984ia94C6lSX8nieBc=; b=MSFLQ2u1Jstz6EwPfaAn6k+Fs505zTzWCXVV7J67bbgMpgX2CNHS7Y9PJ6hA4vwDtfKz olX1oXmJ06oiPZ4TgLfJUyNliMfVg7nlvocWNAdq8fSKyBaDnbJGr2W1ZhCK4qxzsiMW S6OY3IS14npuzACKI9AG20RsokMuWhdbrwAXSn21K1Ef9hWNn8f8xKlvafsdPkwczcjE K22rBr3zok1fkiyBspvK38+RRRFZlDRsQL3qYY85BvPTMIc+xHCTv+/TNas6RWoknKrM CgGx7w+cqvvPMk0t+/TL2olpidfcB7QI3ldMe+9ZNL/VR8UycS1CPlG1Xr/M+pEzgZzc iw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2s94bgbytj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 May 2019 16:07:19 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x49G75tS107307; Thu, 9 May 2019 16:07:19 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 2scpy5rqht-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 May 2019 16:07:19 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x49G7D1Q017003; Thu, 9 May 2019 16:07:13 GMT Received: from oracle.com (/75.80.107.76) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 09 May 2019 09:07:12 -0700 From: Larry Bassel To: mike.kravetz@oracle.com, willy@infradead.org, dan.j.williams@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org Cc: Larry Bassel Subject: [PATCH, RFC 0/2] Share PMDs for FS/DAX on x86 Date: Thu, 9 May 2019 09:05:31 -0700 Message-Id: <1557417933-15701-1-git-send-email-larry.bassel@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9252 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=601 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905090092 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9252 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=625 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905090092 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset implements sharing of page table entries pointing to 2MiB pages (PMDs) for FS/DAX on x86. Only shared mmapings of files (i.e. neither private mmapings nor anonymous pages) are eligible for PMD sharing. Due to the characteristics of DAX, this code is simpler and less intrusive than the general case would be. In our use case (high end Oracle database using DAX/XFS/PMEM/2MiB pages) there would be significant memory savings. A future system might have 6 TiB of PMEM on it and there might be 10000 processes each mapping all of this 6 TiB. Here the savings would be approximately (6 TiB / 2 MiB) * 8 bytes (page table size) * 10000 = 240 GiB (and these page tables themselves would be in non-PMEM (ordinary RAM)). There would also be a reduction in page faults because in some cases the page fault has already been satisfied and the page table entry has been filled in (and so the processes after the first would not take a fault). The code for detecting whether PMDs can be shared and the implementation of sharing and unsharing is based on, but somewhat different than that in mm/hugetlb.c, though some of the code from this file could be reused and thus was made non-static. Larry Bassel (2): Add config option to enable FS/DAX PMD sharing. Implement sharing/unsharing of PMDs for FS/DAX. arch/x86/Kconfig | 3 ++ include/linux/hugetlb.h | 4 ++ mm/huge_memory.c | 32 ++++++++++++++ mm/hugetlb.c | 21 ++++++++-- mm/memory.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 163 insertions(+), 5 deletions(-) -- 1.8.3.1