From patchwork Fri Aug 9 14:59:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13758864 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87DBEC52D7C for ; Fri, 9 Aug 2024 14:59:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F1F666B0089; Fri, 9 Aug 2024 10:59:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EA9E96B008A; Fri, 9 Aug 2024 10:59:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CFA7D6B008C; Fri, 9 Aug 2024 10:59:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id AE82A6B0089 for ; Fri, 9 Aug 2024 10:59:28 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 5577F810A3 for ; Fri, 9 Aug 2024 14:59:28 +0000 (UTC) X-FDA: 82433015616.14.B76E1B5 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2071.outbound.protection.outlook.com [40.107.93.71]) by imf06.hostedemail.com (Postfix) with ESMTP id 6E91C18002D for ; Fri, 9 Aug 2024 14:59:24 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=ifdlw5nZ; spf=pass (imf06.hostedemail.com: domain of ziy@nvidia.com designates 40.107.93.71 as permitted sender) smtp.mailfrom=ziy@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723215532; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=edoJuHT7gWila84psYDlaeDgJJza53cSwF1dPd/agJ8=; b=ghjtVOyr65rlTJEpRXapYTO8EP2b1rgdFDbLojwm+sQKblWx3WQR8bCwo0LqjgE2nSV5ZE NE8Ut3APobH5nbhvNM9tB/WqFuS5IlXn9ZzeSS2KNNyCmA6K12sYKAnk3y3e9b/2ahym1w fFfc5wQLdlfD50AL7hJAl0Qugytb6Yk= ARC-Authentication-Results: i=2; imf06.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=ifdlw5nZ; spf=pass (imf06.hostedemail.com: domain of ziy@nvidia.com designates 40.107.93.71 as permitted sender) smtp.mailfrom=ziy@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1723215532; a=rsa-sha256; cv=pass; b=GQ4cj++MSS6aJbPXj7KOtLf7MLnmvGpokz84MItVngs9i2maCgi+Y2C+1GbuszPtSPR3k7 SehVtevBPSNwf+Hyi/gsJS9yVa6LK9mLaIVXnV05J+xkLu5uXRQzXcABSB67F/Qft0Kn8I 3hizjnl8I4CdTsH/qC18YHqHlZ5BuYc= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kNqaHLv5gNzECjF1Dp4j++PobWqNnLKnNSRXSHIZkUArNW80x7/oBMX4/c59b6UBuXW9wUNgynLKd7Xuc5sHsF7YW1YHorj9s25RjYIsJDGPb6Faph1JU9isLaVBDtVj/Bd5ihAgWGvsGuPVKQH/IePzVe8mdZFE5Eglekykzuo19K++nSShhCvyFJ4O06h8rrtrAffhHoDf9W6bQ6rvh+ojh2g9XwUOiuSkCkqfrvOMf+vF6mw7gHk4Q04eneB+gRxm2Ois41xaC7C+mpp5AYifV6O9omZW4OA6p3iOtG+TR488AIDb6GGYz4MMGFWcQ8LaKOmHpZY44gRPUoIjdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=edoJuHT7gWila84psYDlaeDgJJza53cSwF1dPd/agJ8=; b=ACzyjykpcGCbcANyyQMmfBo6rAt7Z/xz1VVeC59DPGJ0nasTJQP4t90ihJKD9VbQ8OnWq2UciNMWpq3F5tP9d+RM3bn158j5H6A9bAwyKWjYKwowrGR46SubQhUNRKj6V28tB7sxrTmrhLQh3eJizbqMo2mEDUukoBbKE+HPggchdxOH24WftXKvCyak6ckcaUB0BvNyeekpo23hUG/rnadhBuvK1u8drMQ6sYuhResTbFqRjprqpUx6NY/Y8Mp2TEi9S+yeCD4gqWXst+pnRrnMfj/LaeX3oZaL/ojvnarJEXZk36XxC1Iqul+ZWNnU7tPOhRdRQavu16jveaC2FQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=edoJuHT7gWila84psYDlaeDgJJza53cSwF1dPd/agJ8=; b=ifdlw5nZj/Vp5u8Qoo43/xhTWmg8eRtrt+IvcffviFotbTFHBhpyzdyqnc9E1TqpL+iQCl888itNL7juNb8oFLArUGqP7QHXir0jVmV9ppgDG0lMLSfr7y/tCtxpODJzX/gDqTxmgD12rWhxBYF7StrUzn8Y2LlDuVHpYyJ9Xts9feUcHDETt+yDx1cLDaVL3j3O8TJDyrX4uF1EVG/HJrikJKaQmZx2weLwOgB40zlXq45SSK+W0bzVdc6iiW3vaKFYpqUH70odIXUwEqgz7VQyKAtVfSsmdUWLzpAuUkGdot3fFB92SSCjY/aS2x//7RPHhfN9wakT381eCxjkdA== Received: from CYXPR12MB9320.namprd12.prod.outlook.com (2603:10b6:930:e6::9) by SA1PR12MB6823.namprd12.prod.outlook.com (2603:10b6:806:25e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.14; Fri, 9 Aug 2024 14:59:19 +0000 Received: from CYXPR12MB9320.namprd12.prod.outlook.com ([fe80::9347:9720:e1df:bb5f]) by CYXPR12MB9320.namprd12.prod.outlook.com ([fe80::9347:9720:e1df:bb5f%3]) with mapi id 15.20.7849.014; Fri, 9 Aug 2024 14:59:19 +0000 From: Zi Yan To: linux-mm@kvack.org Cc: Andrew Morton , David Hildenbrand , "Huang, Ying" , Baolin Wang , Kefeng Wang , Yang Shi , Mel Gorman , linux-kernel@vger.kernel.org, Zi Yan , stable@vger.kernel.org Subject: [PATCH v3 1/3] mm/numa: no task_numa_fault() call if PTE is changed Date: Fri, 9 Aug 2024 10:59:04 -0400 Message-ID: <20240809145906.1513458-2-ziy@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240809145906.1513458-1-ziy@nvidia.com> References: <20240809145906.1513458-1-ziy@nvidia.com> X-ClientProxiedBy: BLAPR03CA0084.namprd03.prod.outlook.com (2603:10b6:208:329::29) To CYXPR12MB9320.namprd12.prod.outlook.com (2603:10b6:930:e6::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CYXPR12MB9320:EE_|SA1PR12MB6823:EE_ X-MS-Office365-Filtering-Correlation-Id: c2ddc1f3-7a4a-449c-31a5-08dcb883d8d7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|7416014; X-Microsoft-Antispam-Message-Info: BcV98Ixm6bFTO0Y8qjsi3CJsQoguHCTzfeDNaKgbTVwaK3X6NSgedOUOgZvhHfbsGxY7z1ktAizjQbL1LaBGW6vYxUjvLvHtvEGeI1j1t+dS4NApCvaTuIW/pBM92nQ/QcynwQ3z5p2iR6d5Z7SIDAa0EqH3rav7yHvbzuIn8GQceTf+1jZaIOn1Ti+dAgK9x3u3U2QPIHbq1BsbsjmhgYseO8Yiu5d42AvX4gks8UhtALpKmiacYgeTVkOInR8ssb7FZUFcg0HYDHO/cSWMqUcGbKXuQQr+Y5rfHI27yfqyrpt/9A8iizGUCUl6F6UEQG5dKGM6ucA/yuwyFNk6Cmbyk0r7qUFFgzncdA8cRj5AeomZKmjz7w7v8BbunuyUTRxIzj1q9N+FFr98PuOSYtByzs/RCRK8rxORX1TxoDT4dpJs8VFpqyyFS/gXb6r7pJOEC4DSSJhw0gjsQfwkiWo6eGsFSqZcZMOcykyQNkwJMhf1hjgjqPb/CJqsE2NRkSbYdBY3sITOBsCMVeYA075yhRMjmYtPlZctsuRYH00cgznAyyW87T/gWV8sBNjuf136ar+UMZ/NO3PRIN9yBeoWIy50Ry+hkZvlfMEOpDBsvv+6dPmqlpQz8kCneX8Qv9BIFc4mKJPCW1mfWNkxU52Fdk621aWFT28rsj5yx0wjsmOv4FBqvt4VkQ8amND7smBRdsVzb0ZeT6vEj25VSmZ2yHt/juq/+Y0nyx/ZgwHmP4+wv5SfHSjDHc4w0Q/HrBxysI9ImSnYzBm/bY6NivAsUh3cs0cpvNiarFeEj75S60fvZX+aOr6E0ISyzRk2+kkKIseL7a7WuKur31G2EfcZaODGkJ6kSGI1c/ma0rxoMD6Q/e30CPVJmtGxX+LoT2tEFLKIOLqPLHcU6m6UQIY+5xJbxMcz7D6lS+yomGCmZkUSAYjPnDz1hE7rMTavRg0+CCcbjdm2QHmqSfuTAT/W1gu+fcHXDUq6aYCpgcmXdUcNtL3l4VfTSkjyZUmF7TiIRzOnycl6Zue12gisIx+7C23BzMMKfWyee5bf/hF+aYQbduyIzuA49A2ItYfG2L+ek9W8JCj+Z58UmbfWOjo0ljmLSdeixVTmkIC2wKnDEtpM50dyTtdUN1VSYAuemSvfLnqMDVlGAyntvbFDPtXmirNxJqQWpn74DTjIpgJnAWHC0oJsYjA9z0P14D+IYsggBUbnx8HPUbjfkogc7OvEY9XYugg4tt+TyTT8saEcUWJTdDKD9+v2IFR3rBXM7CHP2Zq8XzLwUFTsdUp2P2L8rcPMWdQnzpcKp8LzjJDvd+SNWgFeWi7SQbjvco3FkJAzP0I1suELMKreEXu8dw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CYXPR12MB9320.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(7416014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: k9Wio8SjiAzNpz3xTlFaNsXwl0I3SXEqtJVuL4ymN2CbmrzpGmjxvf7RbDrOOLyMPafd38dL9U9n6Kzurc02Y6r2TjqvV6CbNK7ehNLIDBeBMyyaQpSFZlqUUfrTG7xaDilVXvHCxmyuorbnED3K+tk+JRRliLs4JWpN9oANHvwgSCeTWO/GSVZXuSykacaSQskMvh3OPELJz8UGyqgz+m4ia7D1vO38DJ4tRSF+F9lGL/8fbzik3mdcoQlxgGUUyqEQEl0G9IB6PHMGH1WROqjXpk8h2IPQoPTPU36g6I0wDrlM8AujO4lgYGekSjOGIWa0Cd28LyytgPdujpWK9lNKzf0imUCsPyDeabcCNw1o7BPYvFV9waAA6J2LL46+0wVMd36Z8mh0QMc5xaIUqfhiye/Sv07VLtCy4fugxLeJQKrkGZc+6mFf1thVv2o54mL/5NQqPo8lfKdfZShscD6asBYjefKJKb0vI2RgJ22//MuD0NhcldsnsRZPCGUJ7jA8gg6Q8u1BskSsGlUyH6N5bhC54/v4VOj6EC+dmgQAsgTtwTtbfWzX3r3Y7vXLc+YzsGK6dqS9lhmh9jRZN2DIVfi6943in/A89wpuJEccAvwYWcsfvXTpbhSEbTXLYBD1DVILgLyOiHXbQP4VX9uhA/Pj7KnW+HOMBft01pBwJlXLoEBWNai4U3ZevuVZiEe3olUSvrb8Lk8m2cg+1Z8VTt5j7fserfX4JiLep9xHqedtKJNPKT9le4mtohGqO6LMba3OkpfrhpAnY4WZZ6HQu55D+S4dn7COTb0wNstTn0+yKE74WmRn5R081u/A1om0MQQe9teH5vLL2fyGcbHyeCg54SjIYt4KftJGaivS+4gphus103WIPD3Ueh9QuCcf2s6d701e5lF+7S+iIs2yYks9SDzDhVY724vevFnqzQ79O+JWoEtQXGOnsHz6nBNo5/E4RCMVJeUvFelD/zMqBaiLdyeBsQKGBcCCUQBF1s1IIe/P9KIzJ0NZfs+fvlhUfUEeHU+JXA53em3GSVrJA+c57o1dnkGeO6CPxJWUihrcsnEzdSp5l7PMa6d114TxwjN4Vuuujjv/ERzUF37eK8A3BupvpPDT8Jqkhc0VqjiJ8UzPErpKzsjcpfddcD/elBDA4UlG8hj5slOO2kdeEbGZFcHxoYTTgaydRLX6hueFsFLY2wBd+AWAcMlFEf4G/LTNbbjolP/F+1y4nCo5th+p47KZNxbrfw50uYKnUz+AQjbrMnzXWmfQtHZ8ugKYmK3XkfqpcNtx0DF4ulXW5S6BPcUSHFCOBHBwltjtInRyRym2XXhLPpatxSEr8svxVaBSgstF/mFJ9/Tk70vER4hzIWBsKBNyIemTNEyHdwOep8KeFm1SxUpVin2AuC8lR7CuBLCmSeoD2KSqXexZwKK3B99sWZ1LMuuhpByU/XxQu0leu+GfzkdkFqGeDVGXtIn6nm3HR4Y4+KndtqxwIqw/WyG3x+HI/Gv6VwHUPAEh0hpFhvMdfCBFW3CBTKjVj5wmI8tI5Qp4mmZuZjEjizAeikIk0DhHiwIAkBJNy1FdKjIvzgBXlUOKD41W X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: c2ddc1f3-7a4a-449c-31a5-08dcb883d8d7 X-MS-Exchange-CrossTenant-AuthSource: CYXPR12MB9320.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2024 14:59:19.9173 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cNfpbJyV7zMWue2Usz7z2XcTFv/g8gJpnoNNEdg5+ojbST0y2+BcUR8jTgYERrP6 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6823 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 6E91C18002D X-Stat-Signature: nezrdfdpn5dkrcgmaypbkpsepodsm3ry X-HE-Tag: 1723215564-338520 X-HE-Meta: U2FsdGVkX1/Y6Ji/vkhLkFzjiPktGm7vFTAeYCtfVxe0maAJD9qui2DV21tKSEn8znb+Ph4xNmCYQbArREcjUDtPsDkU/q1QWSC9xBRfBA41N07LBjYPheHklDIsVGMjx7acZ2dU9CbmrCupQlk373Dal3kayaxsCh645HjwR/pK9T/coFjQq1LYvmuAXehZe924yL0jMJwST0YTNU5b4vmlefbQBwDJ9dSAY/L3QttmUNp4e98eSyP0AFnVghdfVRyAX1oT5ot0FbqWA4MiLRjTERn+cBL3M2QTQ8lmsoEt/xKatI4/8wV7dg3TCA7iXkXXZ/jlMvEiP9TS3YdOB80rtQtgBeb3B21XIXg4oBTduNLiq3UBusgfEM5QtpopCYbDvGOe3MKOEo2XeQcGgEpTz1uO/tBgKYG9tmTy2if5wTzBdrLyl7FFNvoeR5imfg7ZwNnoIfeN6AfWW2TDsLHT97m/Pr4pb7nDNxxti6+iEQU3fg/CTXHymhsmbsbQ0oj9xvGbp0NKEO+EqL2zf/6MEX92bSyCM8V6HPOCCHp7jJ0J9xRGWmwjlizfnNNisZii+TjOIavwi8/AfuSNCHGksRh/RQlHUmsZvS03WgL8UsfVzFMUbXmxqyjxUR2YWKHJFol+bhMe3yZBCYDAabTbqcRrz+RSYRqkFetLpTt9XLvOSJ8f6LPG9IB9Mfoz4q36jBZTlmq9ailvZw5b5ybRtlhsqG+kUe7JW5WaUnHpZfPU3HPcsEKu5qBnX3hLyjypA8/8wcqmhe0vh6LL7vNUKo++nxCa1+ba9e0Tqf2We+SX185RR2pbyJg0ptR/tQbR17AZS2/i1kRLILazzacuemS4QVeQ9pctYJHzmoIDabPyJRBkrnNDEYBhHvKSXJW43bOjT2R5NxFYZSz8nxT19S0sLWDg9Jk7di32p8Vyf1L3h+p3jRD28OOGwGiKaSB3QZSc6YPMEn4F2a5 0uuvIWZ8 N1djZwzY5CZLmUzCndL28FAarZ7XBuktseDdW1D9TbqzKAd2xzOIkpor7ssmvkm180cCcVoXWVDXbqLIhHK3jxknrnVthhA5gU4/UyVBZgpd/1/WlBtI1PzAcSZbtNKWYzmttUmyJBwMsUB6HiUZqYKIfOYN8ba1bgzGfryPPgExvcNMe1LhYxFo1LpHw5Xhw2IBmtBLwT9wi6+NONkNpQ/kgCLQX7PpUwLWlZ0JOErYmK8GEVG1EYE8cHSPsrFELF02lBRED0fOp6zSNGILJABnehB9ckS89I+NM/sTRBYUkln94KWNA+SoHns1qAmtOIL/w77c7pyIMCPHQvB0KYpzrw4pFBo269HkYbk8V21t171IZ5pHnQnjpcpG6q0LSbh/ZEq719MVAdm4C6YCpWvLPgw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: When handling a numa page fault, task_numa_fault() should be called by a process that restores the page table of the faulted folio to avoid duplicated stats counting. Commit b99a342d4f11 ("NUMA balancing: reduce TLB flush via delaying mapping on hint page fault") restructured do_numa_page() and did not avoid task_numa_fault() call in the second page table check after a numa migration failure. Fix it by making all !pte_same() return immediately. This issue can cause task_numa_fault() being called more than necessary and lead to unexpected numa balancing results (It is hard to tell whether the issue will cause positive or negative performance impact due to duplicated numa fault counting). Reported-by: "Huang, Ying" Closes: https://lore.kernel.org/linux-mm/87zfqfw0yw.fsf@yhuang6-desk2.ccr.corp.intel.com/ Fixes: b99a342d4f11 ("NUMA balancing: reduce TLB flush via delaying mapping on hint page fault") Cc: Signed-off-by: Zi Yan Acked-by: David Hildenbrand --- mm/memory.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 67496dc5064f..bf791da57cab 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5461,7 +5461,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf) if (unlikely(!pte_same(old_pte, vmf->orig_pte))) { pte_unmap_unlock(vmf->pte, vmf->ptl); - goto out; + return 0; } pte = pte_modify(old_pte, vma->vm_page_prot); @@ -5523,23 +5523,19 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf) if (!migrate_misplaced_folio(folio, vma, target_nid)) { nid = target_nid; flags |= TNF_MIGRATED; - } else { - flags |= TNF_MIGRATE_FAIL; - vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd, - vmf->address, &vmf->ptl); - if (unlikely(!vmf->pte)) - goto out; - if (unlikely(!pte_same(ptep_get(vmf->pte), vmf->orig_pte))) { - pte_unmap_unlock(vmf->pte, vmf->ptl); - goto out; - } - goto out_map; + task_numa_fault(last_cpupid, nid, nr_pages, flags); + return 0; } -out: - if (nid != NUMA_NO_NODE) - task_numa_fault(last_cpupid, nid, nr_pages, flags); - return 0; + flags |= TNF_MIGRATE_FAIL; + vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd, + vmf->address, &vmf->ptl); + if (unlikely(!vmf->pte)) + return 0; + if (unlikely(!pte_same(ptep_get(vmf->pte), vmf->orig_pte))) { + pte_unmap_unlock(vmf->pte, vmf->ptl); + return 0; + } out_map: /* * Make it present again, depending on how arch implements @@ -5552,7 +5548,10 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf) numa_rebuild_single_mapping(vmf, vma, vmf->address, vmf->pte, writable); pte_unmap_unlock(vmf->pte, vmf->ptl); - goto out; + + if (nid != NUMA_NO_NODE) + task_numa_fault(last_cpupid, nid, nr_pages, flags); + return 0; } static inline vm_fault_t create_huge_pmd(struct vm_fault *vmf)