Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753221AbdDJW2W (ORCPT ); Mon, 10 Apr 2017 18:28:22 -0400 Received: from mail-sn1nam01on0099.outbound.protection.outlook.com ([104.47.32.99]:16354 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751983AbdDJW2U (ORCPT ); Mon, 10 Apr 2017 18:28:20 -0400 Authentication-Results: linux-foundation.org; dkim=none (message not signed) header.d=none;linux-foundation.org; dmarc=none action=none header.from=cs.rutgers.edu; From: "Zi Yan" To: "Andrew Morton" Cc: "Mel Gorman" , "Kirill A. Shutemov" , "Andrea Arcangeli" , "Rik van Riel" , "Michal Hocko" , "Vlastimil Babka" , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm, numa: Fix bad pmd by atomically check for pmd_trans_huge when marking page tables prot_numa Date: Mon, 10 Apr 2017 17:28:09 -0500 Message-ID: <789A2322-A5B6-4AC8-8668-D7057A56A140@cs.rutgers.edu> In-Reply-To: <20170410150903.f931ceb5475d2d3d8945bb71@linux-foundation.org> References: <20170410094825.2yfo5zehn7pchg6a@techsingularity.net> <84B5E286-4E2A-4DE0-8351-806D2102C399@cs.rutgers.edu> <20170410172056.shyx6qzcjglbt5nd@techsingularity.net> <8A6309F4-DB76-48FA-BE7F-BF9536A4C4E5@cs.rutgers.edu> <20170410180714.7yfnxl7qin72jcob@techsingularity.net> <20170410150903.f931ceb5475d2d3d8945bb71@linux-foundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=_MailMate_425E350D-C95A-45D1-8D94-39BB13903475_="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Mailer: MailMate (2.0BETAr6082) X-Originating-IP: [12.1.252.66] X-ClientProxiedBy: BN6PR1001CA0024.namprd10.prod.outlook.com (10.174.84.37) To MWHPR14MB1664.namprd14.prod.outlook.com (10.171.146.146) X-MS-Office365-Filtering-Correlation-Id: 35d9ddb9-278f-4e5e-0d24-08d48060e29a X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:MWHPR14MB1664; X-Microsoft-Exchange-Diagnostics: 1;MWHPR14MB1664;3:quRVDmMqPhlPn+NK/Q3dpC6cTzE6gCpxfixpF8++FS0H4TJvOSDEa3DqfG2sUYidK+KA8rIJgHrNMA/qgAdymo1WEEvZTtht7OxL9G8iqwHhCFmiH0+zfZrfc3A+eDCPjUZypu1SbuOCodRi49k7yH/K2aWSmZX3Tl8TuSIfXknPbB8e9iVTWvoLK/FEYk7PcVaZZ7wIvkLq0jTI2+ZUD88EuSohVVOyCkXwZq39LoLc3MNXYagrSMLKT5m1Q/JsheKFaP5fniGJyNxj1DeS3cawls1PfCsxeYt8rGYWKb7n4Z+xBckYPsN5raUmqgRNui8uqNGM0v6CIr9dGP9h+A==;25:AqrmnFC7OZ6TgtMQLD6ugwM7LG6/mRakF5sq7S5g7Bp34csPqBELOYGCM0gc2cVo/FZpQ5d8Pg1oH9i+BL1wIQhXYq24iInxFYEn/9pxTB68zy2vByDUXDQsXDikgRWwAR6NpcwVmiqo6ti/ckM+Pct6gerO3WBOw9ZDY9BIr3D2gSSo6l04YH2hAD2fCEdIgYY3RvjNHdx8aslYa8nuSU8yX/OGhIIwj/cxoItSF8xwQo2Ds5x0QX2oVFhQKvx4LtxznrbHq28ngjLsRgw+qhxzUkQCqnue1r9xenPlNv14UM8o3wvn2g5Y2rN+GG0LCuJA2c4/rhQbCUafh6vaTjXOvMQPdfmgp1KFGkaXjathPct+XRzHxaMSCAYSut7UaXvjA2zlRRZ9m9l8JNNlbV3HHAeF/8enIKNRZOPzWyUtxHf2Pta7Hy/AtiSLiIQEw1gpeJPr3D89WfE34Xw3Ug== X-Microsoft-Exchange-Diagnostics: 1;MWHPR14MB1664;31:q4ydTy/tlZ4hjJfmfJSD0sKj8IxvBcb5ch0r8L8YHkceXjOD4KputeC66fUuQg52/gNUp+NFPfIsirde5Cy7InivgsHXR3DCSKB0+nUXMSKLXSyQrVdia5w6wqd2WSNgtiM72mthZIXphETPU+XrDzxErzmaWRJyRATPC2jDtu41iCUbUbs4dlgFAOnlGBanmCO+5Nljx6hPkY+u09QkVIRapVKdWnVtjAzncxplrIs=;20:MOek5VIUf/spLhoNkavzj5jgZCOWzc/lySK8nJuB8SOb1VdJ7UTjwdAwHT2Qnw8gm1rNudby6haB1kMsfW7kG8oDyukDTPaQD4orHHDzx6Al5MjTGA/nFtmmeLo06ALSR4txpe/mUtpnGPK/JGSocTMzyh7fOL0ynupUNhr5F+WpP4emRqHwTmyaBIGCYq1mGzmY/aKH+2aST2ZEwB5BASLVxDxpps23OC8sIG4K5ICQ9iKK1v1FgmfhMUdzTWPraSYHyevOd7X0YcHRs4fBaiLtRcvWn+EZg38Ccw+/g8t4JwPXSr/hC6o9yimR+zZHZOt7ZSliNwGicRGVCICJWLwvVgvLIbJO31ut9b5kLQ3u2VHsFsfimxQ0NHPh7+AcH4EjI0dZBBtVHWRRCywbXfYEwboMhSooqpttXrAqnzMXGY2LFJVpzrgDz3ZDEEGkJbny2CP1w2lDOkntmW0BzJ53HAE6g1xCC2dZHGC3/+OFFa2rzPtrvySVZmazBuiZ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(6041248)(201703131423075)(201702281529075)(201702281528075)(201703061421075)(20161123555025)(20161123562025)(20161123560025)(20161123564025)(6072148);SRVR:MWHPR14MB1664;BCL:0;PCL:0;RULEID:;SRVR:MWHPR14MB1664; X-Microsoft-Exchange-Diagnostics: 1;MWHPR14MB1664;4:zDiQt3h42n/5Uv58CfCXKqONsHhIBaFzXPR8em6rRUxP+18bxDBGRC8RXj4P2RFEY+KS8smeYqkuLBDNophHiLItCFox2Dot4irSrm0feLUKn+iITcIi6mEawzJLsyOGROoYfz6IGmfdYER86O44X0Q1JbsKMLHuYyEyE60ubpzWoHThcBPa01IwYEQXqRtIGK5UWP4X1d0r0FMrDhCp2IbPbVLk/boTEaTGCjCXecVYTnOEb7q2iTj8ptGASZF4EnS5awsTBBASgFTN8vs4FIzglMUxhz6p9eGG3ZlaAq+E1zW7mE+UpbDiH5JrmDD+QJC0s4aFM6nbtbTPX0NHtHo4s48BtLTZ0LzgrZIAWKe2aUFpPa8+ezIArzfn31FRJOqJzSWX1HdN0LAL/QBi/Co1ZTmtqrm235AITuKRalel7oro4J6NgrmtmtiYQXoP6ezKKbQ/+P/RwLjYFivTWIP/MeAeeOGFT2yHVLlWz3onOHDLRr3qVhAJYBLJXx/5mcwOaXSUmfIVaiIkPH+u03fYu3QjoQD7h4W8FAMKw+OGJwZrHZrbFs+MXdI1fnWkz0m+LsI8Tk3dCXPO4oqUmYeYpz+A0v6UF1jC1GjRkG/1Q6WXwry3QT0Aq76az24Ws1rLQ+yad4SiF255jsqGH4rRET7c54tRssx1DMcMzTLFupKmiedxamR0PaqgFPsZaBPfyhHmqIqrEwWCFDjPZJ3q/y642HqlZeK+mbKoUqOzBkhl5mP5NR9IXtAmrsclLqM5D4B1afkd4LlLHHRKq1N5tIkcmyIVDfGzJX0zYCY= X-Forefront-PRVS: 027367F73D X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(39450400003)(39860400002)(39840400002)(39400400002)(39410400002)(39850400002)(24454002)(53546009)(42882006)(229853002)(6916009)(6306002)(6666003)(2950100002)(25786009)(305945005)(53936002)(4326008)(38730400002)(110136004)(93886004)(77096006)(6486002)(54906002)(5660300001)(7736002)(90366009)(568964002)(42186005)(81166006)(75432002)(66066001)(8676002)(5890100001)(86362001)(6116002)(88552002)(33656002)(189998001)(3846002)(76176999)(2906002)(84326002)(50986999)(50226002)(14583001)(72826003);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR14MB1664;H:[10.20.179.89];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;MWHPR14MB1664;23:el3KkTUFq7m7VYnzAFFewPFe8kIBqNSRieDpJ/3i6?= =?us-ascii?Q?jbOcsSD7R7Xuw4nCxaXL5TQLwxfRvk91hzZ6uaiS8xmPwq/o4YlVWVZVPEJI?= =?us-ascii?Q?5ZiyEOAu64g0dl0PL2vm1Yh5qqvE7iEjaPosfQa8k44WU/+tsi3uRL0zfGzB?= =?us-ascii?Q?iSU9UTLke0rkkXeluT9+E40hRmGL2RSQjN3Lyt2E2l0lmBrIfeJj8urhnq1Q?= =?us-ascii?Q?1gwBeLcmJGfbNH2Fk3fSM1Tx+TN8YwQ7+QVZO6rflYVC1xsUzZN5kiAawfra?= =?us-ascii?Q?t5hhNZlRDsBk5+mLnZALBFk1pnYXk/LwtPVpz52Go6TVaE97Tc19qs/vry1Y?= =?us-ascii?Q?QPnr/WZvEwjbZu+LfsFC3MlZW3OOvlxerC+7TEi8TYNAN+S99j27UTaNaEhw?= =?us-ascii?Q?vU3pCgc7u3Vyd/7UVIvqgCeNk8ENfzecpPYYB4eWD6DLDEiABEOltTHXASa2?= =?us-ascii?Q?x43gUY6kyQdnfvQkGGBG8ACv8lN4a4JonOUz7BMfiRJuGD/PlFDXMsC4/G89?= =?us-ascii?Q?S338FxO/rHANiLPh4cW+m865Vfvyr6aVvLboqCmJAcMl/O9bpMfWJ3GAuk6Z?= =?us-ascii?Q?PfGQ4BZUj+UxrwMdUvCKedjTTx7aRMweAiRDp4njcgzg04YMneweqdalaJ0h?= =?us-ascii?Q?N4OclLWkrkECbkxvLtE11ebIVkU8AxPZ7mpqcjcyt+BUIqCeqxcuLZwoPTZW?= =?us-ascii?Q?Sq/Yv57+ESr57FHu9J9g/yoXU0os2N77QVXL8lCjxB3fuPAewiVV0pdIe78u?= =?us-ascii?Q?gugiSgNkdde8zxDANU7zTGR5Ob3MBqHesZoF+mhtx1/suuUfyoI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pkFG8pfnZQw==;5:oMPW1ok7Osg3i3Q8zRMh4yf7CSjjW3SLbGedy8FtSrtMhNSLXutHJqVJFEy/fgpw4OJdZyXFBEhMnPBGpqsCPSPmuzn/Iy79mUP+/PoQlsTaiE2kDUxNF0BxRoKNQhiViSO2SUpSMJOUO7Tih54Vsw==;24:rE55cBwiVJk6dC3XJmmePP/KV37/n2nBfGJPW9ngJkPwulA9qJsG+DXQeqiXrRQ2tLY9YPFCsxf6kDS4CMJI1prmLXFGr9OAnAdvpiqu2pM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR14MB1664;7:exRvhKYE1j9c1WDgh+Xf6jm3Cwwo2mTsn8JVLXrCaje1qxdPHrxJZcSreaxKHNiqUVn0I0XFdcuQGphbEXMJ9k+Z9NMs2EU2inczzQEYqP4DmT4MBgCK5hykDLPUedmpE6/dJY/gpgNFqfz3dEoSm8yXeelsAI1air+h0VH+8Kjjqmho58ZBunt4MLz+JVFMv1FTPe/fn/zfUE8VmUlo8FrsvP4Ao9j/WDES4cvi1xniN1EAJFgMBVACU0OinRSNrDlrstdUyC5PPiQEgOsBhAuv1qUbOM+ARei2BkcxOPLhPQZqxEDV4tpfQaULsxcCG/s69NW4IzwrKEMSon17iQ== X-OriginatorOrg: cs.rutgers.edu X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2017 22:28:15.9303 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR14MB1664 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3789 Lines: 96 This is an OpenPGP/MIME signed message (RFC 3156 and 4880). --=_MailMate_425E350D-C95A-45D1-8D94-39BB13903475_= Content-Type: text/plain On 10 Apr 2017, at 17:09, Andrew Morton wrote: > On Mon, 10 Apr 2017 19:07:14 +0100 Mel Gorman wrote: > >> On Mon, Apr 10, 2017 at 12:49:40PM -0500, Zi Yan wrote: >>> On 10 Apr 2017, at 12:20, Mel Gorman wrote: >>> >>>> On Mon, Apr 10, 2017 at 11:45:08AM -0500, Zi Yan wrote: >>>>>> While this could be fixed with heavy locking, it's only necessary to >>>>>> make a copy of the PMD on the stack during change_pmd_range and avoid >>>>>> races. A new helper is created for this as the check if quite subtle and the >>>>>> existing similar helpful is not suitable. This passed 154 hours of testing >>>>>> (usually triggers between 20 minutes and 24 hours) without detecting bad >>>>>> PMDs or corruption. A basic test of an autonuma-intensive workload showed >>>>>> no significant change in behaviour. >>>>>> >>>>>> Signed-off-by: Mel Gorman >>>>>> Cc: stable@vger.kernel.org >>>>> >>>>> Does this patch fix the same problem fixed by Kirill's patch here? >>>>> https://lkml.org/lkml/2017/3/2/347 >>>>> >>>> >>>> I don't think so. The race I'm concerned with is due to locks not being >>>> held and is in a different path. >>> >>> I do not agree. Kirill's patch is fixing the same race problem but in >>> zap_pmd_range(). >>> >>> The original autoNUMA code first clears PMD then sets it to protnone entry. >>> pmd_trans_huge() does not return TRUE because it saw cleared PMD, but >>> pmd_none_or_clear_bad() later saw the protnone entry and reported it as bad. >>> Is this the problem you are trying solve? >>> >>> Kirill's patch will pmdp_invalidate() the PMD entry, which keeps _PAGE_PSE bit, >>> so pmd_trans_huge() will return TRUE. In this case, it also fixes >>> your race problem in change_pmd_range(). >>> >>> Let me know if I miss anything. >>> >> >> Ok, now I see. I think you're correct and I withdraw the patch. > > I have Kirrill's > > thp-reduce-indentation-level-in-change_huge_pmd.patch > thp-fix-madv_dontneed-vs-numa-balancing-race.patch > mm-drop-unused-pmdp_huge_get_and_clear_notify.patch > thp-fix-madv_dontneed-vs-madv_free-race.patch > thp-fix-madv_dontneed-vs-madv_free-race-fix.patch > thp-fix-madv_dontneed-vs-clear-soft-dirty-race.patch > > scheduled for 4.12-rc1. It sounds like > thp-fix-madv_dontneed-vs-madv_free-race.patch and > thp-fix-madv_dontneed-vs-madv_free-race.patch need to be boosted to > 4.11 and stable? thp-fix-madv_dontneed-vs-numa-balancing-race.patch is the fix for numa balancing problem reported in this thread. mm-drop-unused-pmdp_huge_get_and_clear_notify.patch, thp-fix-madv_dontneed-vs-madv_free-race.patch, thp-fix-madv_dontneed-vs-madv_free-race-fix.patch, and thp-fix-madv_dontneed-vs-clear-soft-dirty-race.patch are the fixes for other potential race problems similar to this one. I think it is better to have all these patches applied. -- Best Regards Yan Zi --=_MailMate_425E350D-C95A-45D1-8D94-39BB13903475_= Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJY7Ab5AAoJEEGLLxGcTqbMqiEH/0vAM87R+aqhF65uHpuGG/VT umngJJY6id0b+mLPWVENFhcUbgYQndpP80oGYCU2bZFptcQq9LdL3jk50G8Vu3MC ciAtKyaxkLA2Fy6cWKDQQ1YY3Mq5knQyFaZ1smjaifeIik5Nr1DR62cOwnugvFly bDWPeGo7jGJbH7s444Zae5SspKc+6PGhyA0ZRuo2iF5PVB9FGJkP3PZkJSQiDckY 79DQ5NZ5zb85Xz2cpjdPmZrthzYPmRlypW1pwhQHbOqgZlj0vhQuEjR0D0/dLmLd LG1TSPfJtPY9R/TAwzTlO8ae1IVe/BA0xdlL+1l5vfJNy9Pz7JXWGCCHDZLOJj4= =LFbh -----END PGP SIGNATURE----- --=_MailMate_425E350D-C95A-45D1-8D94-39BB13903475_=--