Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3757505imu; Mon, 14 Jan 2019 08:31:18 -0800 (PST) X-Google-Smtp-Source: ALg8bN5CWl4+Egc0rqDQgWvn3USIioS+WuuuveauvQXVmaE7661GUXHJI8Tx1Enb7/rFTSwEIAPo X-Received: by 2002:a63:d157:: with SMTP id c23mr23345159pgj.170.1547483478567; Mon, 14 Jan 2019 08:31:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547483478; cv=none; d=google.com; s=arc-20160816; b=wYGyHB0fbiVx6/DcwYG/PhmLqvzcxbEmeER8zgl3Xmh1Mc4FTcomQeXraV9EHwmQj9 MxzqDBprgMfJB9Fk5kjKDnyOt6COS7zTYoPXugunGxzAz2wIFRqoUO5Nhboh6cntSjU3 GEC1ErBoaQ0+gP0V5KDT1xg7HHEENLsTE87wufufQglJawDiOQzeSTX6Hj7SwaCK1EDR sWll32sSgdtXXYbP0NWFTDLeK4XFf+aAHyFmAcGv6VlHj2MbqkPY0EGaEm3jPvp/G5om cZn65tH9AgccWz2SJSiWEr2qvJ6njuCeQT3KlK2HBdw6HpT4us/LPoeuhHgDE0uXStkr oVqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=WSa5scxaMo5ij54ao1V4vaacC/wq7j2KKAiOSKWSETE=; b=O9Hn9LAwqTtm5vAPAotHMFyZ02c4YxBdqWve0n7yKwyvjGybvZNEM5oyV0zbL/e0Sw uNjW5U1xQrCt4C0b1gkZ2DeVszIb9YrSLZ5AlyU0TQZxEmYt6LCnsudDZwRcUrMe0+l2 Pt+FDLcxkq4FURz+R0RmXkGbG4Po+825WervtHMBDMCu9AbXsPAqosvh2wCmPM82ZELX Y94OpvE0mgB0KyUP83REJzlSSNBL5nfC98R78o+LXi+sF0h2HTDUdzzQx1yMCc5HJsZK srG6jR8HLir6bXfElZ6UQzYZFB/0xaPxOtRK5rH4Y5bdU8BJXA7M6002ERo79HrQc1Ji sSjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netapp.onmicrosoft.com header.s=selector1-netapp-com header.b=Wzwm2lzC; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g187si666141pfc.43.2019.01.14.08.30.51; Mon, 14 Jan 2019 08:31:18 -0800 (PST) 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=@netapp.onmicrosoft.com header.s=selector1-netapp-com header.b=Wzwm2lzC; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726789AbfANQ3c (ORCPT + 99 others); Mon, 14 Jan 2019 11:29:32 -0500 Received: from mail-eopbgr760057.outbound.protection.outlook.com ([40.107.76.57]:10368 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726708AbfANQ3b (ORCPT ); Mon, 14 Jan 2019 11:29:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netapp.onmicrosoft.com; s=selector1-netapp-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WSa5scxaMo5ij54ao1V4vaacC/wq7j2KKAiOSKWSETE=; b=Wzwm2lzCh08pXsl/VJ5SljHnU5I7vvXC82GZgrN9LWZa/vZs62W4nHguAn68BVFkyGDy5Gr8fLixp1AhG6DgMmNTdvbbb8qqksYSHB9eK2x79FMeHctOqY/I9FFCcJCZUNVg4AZsgk15hamAiqUytTSL+EzslRh0QimkLtaUHks= Received: from MWHPR06MB2896.namprd06.prod.outlook.com (10.175.138.137) by MWHPR06MB2830.namprd06.prod.outlook.com (10.175.138.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.18; Mon, 14 Jan 2019 16:29:29 +0000 Received: from MWHPR06MB2896.namprd06.prod.outlook.com ([fe80::d992:bb7d:56ec:8946]) by MWHPR06MB2896.namprd06.prod.outlook.com ([fe80::d992:bb7d:56ec:8946%8]) with mapi id 15.20.1516.019; Mon, 14 Jan 2019 16:29:29 +0000 From: "Harrosh, Boaz" To: "Kirill A. Shutemov" , Mike Kravetz CC: "Kirill A. Shutemov" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Hugh Dickins , Michal Hocko , Dan Williams , Matthew Wilcox , Toshi Kani , Andrew Morton Subject: Re: [RFC PATCH] mm: align anon mmap for THP Thread-Topic: [RFC PATCH] mm: align anon mmap for THP Thread-Index: AQHUqeoAUFTCAIIvn0CcxSCAmIzKA6WqnMwAgAAaIICABBVXAIAADyei Date: Mon, 14 Jan 2019 16:29:29 +0000 Message-ID: References: <20190111201003.19755-1-mike.kravetz@oracle.com> <20190111215506.jmp2s5end2vlzhvb@black.fi.intel.com> ,<20190114135001.w2wpql53zitellus@kshutemo-mobl1> In-Reply-To: <20190114135001.w2wpql53zitellus@kshutemo-mobl1> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Boaz.Harrosh@netapp.com; x-originating-ip: [207.232.55.62] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MWHPR06MB2830;6:S9qiKsi0xGcMZ+CL7PY/puIBIdBoIMu3O/07IpKXQyv3zifdS23dvl/1nV+ImseAV92Uvy6gSMX0buckH54zARP1hob7QL5QcQ9Z8VUIEpTZV3DFQajSMP6y662N4JsvisUk4CxgRzGHvZE9zJ9JXcy9X8/6zQObo5JF/DFafj1ZWpaE9M+Sacx30LHPCG78AhsIpWWMPq0zZz0SaRY4v4gnWSai4M5lMWjzFWfuJTD9huW/+DSWZI5tPEnzp4taybkh6eV/9yuicfoVjf7Ll4W1pba3b3D9AUPaiJW/reHfoxzGrpBgef3VyHVWk8PmBTjD+9ZBY2D97SlUXDU42xTOE9EB6IanU2wTLmLcQjmzczbVQ+UslNgylwmQz9Npbp4oJlWiResc5AFyjJBci3+d09x2oMylWpgzO8NJpYzzUcNTw9yRvvnQkzd1DrCUeI94c0L5TXsovsJCakHtww==;5:cGaaoEA+cUw1Pln5mHAS/p65RmY3v2Qsc+ZWnIAUoe7d6ysUs7RhGquLCM1BoKGatFavW7TItXHtPGycKGbDcoYYp1LKYwZ8xsRzKX3Z9qZ7cHoPwSVwHSDmfq+UvMMlQ4+XKYXg3Ae3qZuwI7qt5BXCoPVL4su5/tmA1wmaB2bR8os2tpsKVyBSEPZgbMPtQfOoY8UDJKdRQJDNEELefQ==;7:il6TNT18WSbBbJPc88OJbFuNiPEflHT58nxJ7Z4faGVNxmBZP+j3PW0TA82gAwcNctAj6tALXTwLs0GtFoMd73fnY/3tmns1HGokk96S/c+0AVSDjD0GlIAUNtxsQT7Ym8QlBFifgE6Bw2oLhhMopg== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 6b1409d2-4315-446e-e937-08d67a3d74ea x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7193020);SRVR:MWHPR06MB2830; x-ms-traffictypediagnostic: MWHPR06MB2830: x-microsoft-antispam-prvs: x-forefront-prvs: 0917DFAC67 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(39860400002)(396003)(376002)(366004)(346002)(199004)(189003)(76176011)(7696005)(102836004)(6506007)(186003)(26005)(66066001)(8676002)(81156014)(81166006)(7736002)(8936002)(305945005)(106356001)(229853002)(14444005)(256004)(68736007)(316002)(86362001)(93886005)(105586002)(54906003)(110136005)(486006)(99286004)(476003)(6246003)(4326008)(5660300001)(478600001)(14454004)(9686003)(72206003)(11346002)(53936002)(446003)(25786009)(2906002)(7416002)(55016002)(33656002)(3846002)(6116002)(6436002)(71190400001)(97736004)(71200400001)(74316002);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR06MB2830;H:MWHPR06MB2896.namprd06.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: netapp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: xdOwvh/tqtpZb96MF+jJddlSDGxxEUM0HKUg7yVTmr+JFzJA4ksQN/BHeIl+q6h1HbhDHo3czEZP2WUxDqxpU0hCyefqzvQODJ1SEQtREPkc5134Z9TqC8cO4ZSma8SSXQ5q0bNQOWinvRKtX4UgVPfh2jjzXCJK35oVL3xEgARJ7LuLOE7h03ytnBwfNI4dD1ZkBiWikdK6CYqtkyDxNTGfpsmNR0fjW6fOeHt/9gOTO6WLUCrV0aJUbf80Zl2QuVVuwYRKcm5xEXBQ1HQdao7DAEkBy0g0LNnEwt5mRaV1piLlYiW7i/OywK5tVdUGU31FJ23NC8TdcDhYqylVmE/ZGJd7y517Ahd4RBvzzp+lnCWsfobkISyA3idhxaHfeRFi0ySOQOzH8Q5OezMC6n1VBWh3YgoR6+78mYfCenI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: netapp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b1409d2-4315-446e-e937-08d67a3d74ea X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jan 2019 16:29:29.0306 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4b0911a0-929b-4715-944b-c03745165b3a X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR06MB2830 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Kirill A. Shutemov wrote: > On Fri, Jan 11, 2019 at 03:28:37PM -0800, Mike Kravetz wrote: >> Ok, I just wanted to ask the question. I've seen application code doing >> the 'mmap sufficiently large area' then unmap to get desired alignment >> trick. Was wondering if there was something we could do to help. > > Application may want to get aligned allocation for different reasons. > It should be okay for userspace to ask for size + (alignment - PAGE_SIZE) > and then round up the address to get the alignment. We basically do the > same on kernel side. > This is what we do and will need to keep doing for old Kernels. But it is a pity that those holes can not be reused for small maps, and mos= t important that we cannot have "mapping holes" around the mapping that catch memory overruns > For THP, I believe, kernel already does The Right Thing=99 for most users= . > User still may want to get speific range as THP (to avoid false sharing o= r > something). I'm an OK Kernel programmer. But I was not able to create a HugePage mappi= ng against /dev/shm/ in a reliable way. I think it only worked on Fedora 28/29 but not on any other distro/version. (MMAP_HUGE) We run with our own compiled Kernel on various distros, THP is configured in but mmap against /dev/shm/ never gives me Huge pages. Does it only work with unanimous mmap ? (I think it is mount dependent which is not in the application control) Just a rant. One day I will figure this out. Meanwhile I do this ugly user mode aligns the pointers, and try to sleep at night ... > But still I believe userspace has all required tools to get it > right. > I still wish that if I ask for an mmap size aligned on 2M that I would auto= matically get a 2M pointer. I don't see how the system can benefit from having both e= nds of the VMA cross Huge page boundary. > -- > Kirill A. Shutemov Thanks Boaz