From patchwork Fri Feb 22 18:20:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10826813 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 33F6913B5 for ; Fri, 22 Feb 2019 18:20:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D9C132680 for ; Fri, 22 Feb 2019 18:20:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C63332A89; Fri, 22 Feb 2019 18:20:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0341232680 for ; Fri, 22 Feb 2019 18:20:26 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9BED9211CD62E; Fri, 22 Feb 2019 10:20:16 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=156.151.31.86; helo=userp2130.oracle.com; envelope-from=darrick.wong@oracle.com; receiver=linux-nvdimm@lists.01.org Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 55744211CD610 for ; Fri, 22 Feb 2019 10:20:14 -0800 (PST) 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 x1MI4DQL027885; Fri, 22 Feb 2019 18:20:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=S5rIGstDMj3MeCfrkJOspVebxB47wGLVkaoUYTDd74E=; b=LTIwtKd+0uwGVZpT3OOp73mQW3VoDls0DBab4TpyK3VyUQcScTkN6hqTZrASeELkZmGM FTEEITDIUucBKNG2lgaeb1k8hNNbQ2Z4LY8Aza8IXiGFGTvoPcx+0VLsww19d9PLh3+Z K+8XW0AY6xXzeTnRXIyoHoYI3cMXMGNnUdLVtkwq5oerSoco3/uMu3PPit7R1u0GjpZb bi4Ui9J2j5vf/v4KGU1UiiA5dOOyCIUIEINFukTkR/U42wuQrZpochTHzL0E1vnfD//z iOGdfgApUiVctagYfazzUVZ4fe1LLVA0929CkBAYKap3mo7JnJz21F4Du6d7wrDW9T9M 6g== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2qp9xugsr8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 22 Feb 2019 18:20:10 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x1MIK9cg009453 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 22 Feb 2019 18:20:09 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x1MIK8UN012423; Fri, 22 Feb 2019 18:20:08 GMT Received: from localhost (/10.159.254.125) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 22 Feb 2019 10:20:08 -0800 Date: Fri, 22 Feb 2019 10:20:08 -0800 From: "Darrick J. Wong" To: dan.j.williams@intel.com Subject: [RFC PATCH] pmem: advertise page alignment for pmem devices supporting fsdax Message-ID: <20190222182008.GT6503@magnolia> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9175 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902220124 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: xfs , zwisler@kernel.org, linux-fsdevel , linux-nvdimm@lists.01.org Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP Hi all! Uh, we have an internal customer who's been trying out MAP_SYNC on pmem, and they've observed that one has to do a fair amount of legwork (in the form of mkfs.xfs parameters) to get the kernel to set up 2M PMD mappings. They (of course) want to mmap hundreds of GB of pmem, so the PMD mappings are much more efficient. I started poking around w.r.t. what mkfs.xfs was doing and realized that if the fsdax pmem device advertised iomin/ioopt of 2MB, then mkfs will set up all the parameters automatically. Below is my ham-handed attempt to teach the kernel to do this. Comments, flames, "WTF is this guy smoking?" are all welcome. :) --D --- Configure pmem devices to advertise the default page alignment when said block device supports fsdax. Certain filesystems use these iomin/ioopt hints to try to create aligned file extents, which makes it much easier for mmaps to take advantage of huge page table entries. Signed-off-by: Darrick J. Wong --- drivers/nvdimm/pmem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index bc2f700feef8..3eeb9dd117d5 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -441,8 +441,11 @@ static int pmem_attach_disk(struct device *dev, blk_queue_logical_block_size(q, pmem_sector_size(ndns)); blk_queue_max_hw_sectors(q, UINT_MAX); blk_queue_flag_set(QUEUE_FLAG_NONROT, q); - if (pmem->pfn_flags & PFN_MAP) + if (pmem->pfn_flags & PFN_MAP) { blk_queue_flag_set(QUEUE_FLAG_DAX, q); + blk_queue_io_min(q, PFN_DEFAULT_ALIGNMENT); + blk_queue_io_opt(q, PFN_DEFAULT_ALIGNMENT); + } q->queuedata = pmem; disk = alloc_disk_node(0, nid);