From patchwork Fri Aug 9 14:59:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13758865 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 967C0C52D7C for ; Fri, 9 Aug 2024 14:59:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1641E6B0088; Fri, 9 Aug 2024 10:59:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0EDC76B008C; Fri, 9 Aug 2024 10:59:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E0D106B0092; Fri, 9 Aug 2024 10:59:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id BBE126B0088 for ; Fri, 9 Aug 2024 10:59:32 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 4B1091C2212 for ; Fri, 9 Aug 2024 14:59:32 +0000 (UTC) X-FDA: 82433015784.07.A292F21 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2046.outbound.protection.outlook.com [40.107.92.46]) by imf10.hostedemail.com (Postfix) with ESMTP id 834ACC002F for ; Fri, 9 Aug 2024 14:59:29 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=tJmVXXx3; spf=pass (imf10.hostedemail.com: domain of ziy@nvidia.com designates 40.107.92.46 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=1723215536; a=rsa-sha256; cv=pass; b=gbDIYoW+/PyN3Xcy+2IJNmU4s/ENPDP9CnnmNkJdpe/yjL5cWU88TpRuTHjt3bTiEHip1Q qpGJnEaW/Xx6JoOMLL8/J8D064ExiO9v3hmz1Zj95OfNj06mygjMx02UrCsjIpI4OK8ivt cgr0k+y9D9vbt/QgBqdHPbNLp5y5Kog= ARC-Authentication-Results: i=2; imf10.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=tJmVXXx3; spf=pass (imf10.hostedemail.com: domain of ziy@nvidia.com designates 40.107.92.46 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=1723215536; 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=1XYiZT7rhmKPSP0vkQcCuc/N49agUoRG3Dy29+8nYjw=; b=e4nTboMRO9+C4nYUv++SJbL67etDg0ytLrGsjYXClZWy8hFKQzIE8Q5CVwjxdZ2BOaNtMN G+tdvORAGcWKQDva+FWWUznTzbjHmlVUCjn40cSzqJcHDEj79ASi6H42fdoD1zCY213LHR wy/kvkhSYm/P7zKc7aWJZj0WdbAxTH0= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lJrUNknsdqer/ahxrBmkom08NyFnAxDLZoVTYRdkEfRdqj0xELHFfImwzbnnMrT29sdcIH1VbLU4mrZhjAceyAS0dLi13LtjFd9Emz6sjIMMbh5GiN22IVYVy1/5+QigY91gtHmcy3NLXcjcBTb+TIhD1k5gv+9DvWWhW2yS7JIflw99Vmcwj8rutB2SqE9YzIX72mKXMUoGLjNuIVINyK/BYv3yLtDP6iwt3pUz0dsj/mN8w9Np//U70BTsfr+8B9jgraDxrykCW6jCqv5nTRQpzpIbp0kGGnH/g6x4LLK4xiGPPDXvGBAYTQklUsLt5MVu132i6ef01n3SUHIOtw== 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=1XYiZT7rhmKPSP0vkQcCuc/N49agUoRG3Dy29+8nYjw=; b=pV0vlrlKIrYbcGP5gWNKDZyJX3AqSiJO4ZaeHNBGfCUwLGhg1WuPyD/fmpl41l6D7EmXSXxEnXfCnNKR2AL3CO6Wth13rhk1VFFViVJYR3MuaqNgx0UUjebABXJyRnGFQD59UJ1ovVPnZmaWDBuPIZnUw2PqMIoW3RozlWWyj/lRP3Ceyqoi7e/6rKs3e2Bb8qwXdLmAjFkVdcGSDD9PZKY1nGhZF1slPd8I+z0X9fb2kfShd4JR8DLpq1CshTWQmwq2Yo66dmnpvqRNwR9gpiQTNdLzpMGrX4LSvFoYu+wS1n3p4ahcOQAtACxcki2wabBE59Cu9J7tsXdwW1gr/w== 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=1XYiZT7rhmKPSP0vkQcCuc/N49agUoRG3Dy29+8nYjw=; b=tJmVXXx3MSWTndsVbGYnccDdTDn6ExcqgngxFID5vz3Gn5Eft+rfhnOLIXdLpPR8xuYMrxOljBH6VRwUb9EFjt6ggZGpaJ30RkDy4Sbc2Q0PRmVRXPgHnh1acopDIMgayVZhPKldzb3KJnYP8x6jT42p3+5c88AOHbOb8IMALjH0mes257vYUrKeML0eRxaErnZE2RePoaswwq1W68o8InSAluQcXMDseROp0CR/ZD7C1nJeBpSiNP4jnyw93IgCJgIu69IblsT0PllLitse6cNAL7O1C93mSUpdl+AZJ711pisdlDAT5HPqRHaf5ppP5gXQUKbdF6hYvRkz5FEXpA== 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:21 +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:21 +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 2/3] mm/numa: no task_numa_fault() call if PMD is changed Date: Fri, 9 Aug 2024 10:59:05 -0400 Message-ID: <20240809145906.1513458-3-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: BLAPR03CA0077.namprd03.prod.outlook.com (2603:10b6:208:329::22) 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: 033aea5b-0b48-4cf7-4272-08dcb883d9df 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: kF8MiWo6w8j10A2B2YK8g5fFiggSqMhA9C6wS2D9hbbbgCW5lcX3tyURZDdGc2Cho4TBGP5wbKO+inaCdtQ37VuR0irJakQG9mQchJIUPv6Z/XNwJ3xQYqZWRFxYZc8Zp9S7kSqxhXKvrGe60LNh4FKF5DK5rndj8oM6efLQweGp0y2vZF9d70RrSP+Xzb+tGoPsPs9D2QywvZO8/HXBgbLZ9hfW6XA7zhMDdgL16hnsBklCO5kdpMqHyGPiUZn5yQ5l/lwwf1fU73AQxSv0KpG2ejPHbJtvWdBuMFBJ411NDatOzyqHl7BuOvfeAmpp091VK5RblvmWZqSm3SLs2DhVTJDT9cwxkUw4f1+RPYZVNkEXqvNgfWrEDWnioedgO/1m+VuVjyVfvNOOZ33N3Gev1flo8YVM14v6RZQ8E4ElqtSG5eDmZCr3qwT7PBBfJbdb0RrHKK9ksPF8tP2cPuVJDWffYCiodYrPFwqdfaSNC730nKJEWmeGKaRDQ4Of9q3R86Lx8EOLNKU3l5X5YH5yt+UcBgXjqtCf3k5xmI2YjR1OS2V0W5glf97IG0sD78joYtMTE4gOR3cRYbVGy4LzUDOxLRom8MtIWKdTeZCMqC0BlmXjwIQPNMXKmvdGwFTt8bRosu/FKCr7PzH7F7qA7Vg1FllAJJeliAUImbtNzTqjO9fDY4jIssI/Y0LbMfz5uRvXflFk+6bvsw+3XVFLTjI7F48oqgRt+CdK8phDwf5R2hc2/vUGaGcDS8cV+BM+iqhrmWDPcrx3ePh9V6n+BqIalUTZquoxEaOQclDaWfzu1OWdj7JVfeAAGo3dt8mGcNqtKlUkXfVDknJeSfjWnIxyPw2YBoqsAFiGsunfKdH3LO5mwszMU2wvkIIhCV7JCrrCbER0TDplCCowA7Dvr0cd/ldGxNW/yMVYd10q0VGGvi6b4PIF7E0i4mB8w6Geq9tt+WOLg8l2rpslyAKDoWwAZm6Gwc80TqkfTR0tYKtF4KF8xfxNaZm/KHNstDgZsatXkoIB3jg4LR5zNecm91y3hGvL16BRwTBRX9Xvf5M89V7uqyhPLWNNKm0/zOCLfV5WRATL1Oqn6O9O2AyoVHE06D504ACrKzE5E51w1V1SdM0uAF8ZzOroYqPEDrGo1m1s8QIcDZJ0sRere4KomNinM/ANYgtC9f+tzRe+Ta0rTleIjsxldHi1ShYh5cM9D+Hose8Yi/2s8p5Pb8w/OfZj2g+8dFEENXdck7eBHT4uuzMBCwl0K4lgf+d5G62/Z/rkx0cdM+PcUsFRowGqn+1unI68J74zphZsRfhgjBPp8N4qieM0gQU+cIzB4o3ulK4Q/H5sV6jpXzsKZujdPJX/00+UkW4k6FIr20M= 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: URpX3NK/YKDy0tNgoA4oxpJP1Y1xr0YYBSMaGZvS0o9NJTlywQwylPF/03tpQ4RwNfX+LTsQK5T7Z3ml12100/LmO558upw1fvYtFMTa75yuwJpigx5uQNNHU1qsAoqUG65PnOBQDRd2EKdeUjF35Wxe9kzmHZIN+PixJkNG0LW7sCxOwtBSP5/MFgkUs+2bYOW2CSNKsANWEFxeFWDXzVrHJ5M54yFyw4TSgTljeQqX8hiVf9AkyY7Ta6u1MFlAZrNkdVaE2bxQVshdhfa5C6xgy1UqGw814+2LPRNRfMSoo/4hUF51QUPEwrpgezyxSYELOftp78+YZ8sNHWryZU7V/+7MxvC3TsWIMMbVEbC2TI2nqnyGPQmcYB7LS3LbuxP8H1fGVI8w88CNE2EjFa61AwjGTkahObKi+JZdJshfAipdBUMmnd8j6I6BFprcf4XJJwAlSMFWIZ2lXg0uHQ7msbKlY0lYR4GMV9QjPfmXCTatQYWoMDpRC4FGbVOEjpXwSb0ST7gV5GOU3mufYcxs7seNt9mIAVqPqJ4Vu6Z7ZCJgoQzpym5bMhoblBRAcPZm3xVjnsHhJ5KEiUeEwJMH2SyiKHXTj0pjm92sZBIZB3oWNrrEtkgohNQvCd0kKLd7xiNkaq6wbj6EXPX+i40ghAT1SAZAbNW9SJ3cF25OcJnkWp1M2TwGDhcHugj3Ynh/ouy6jPjbYq4hh8jJGwhG8zIGt53IzOdOlgQnjhc8v3JGb9EvdY72vgtIoqVbG6x/liimxmFhK8tMhw6BRVqQiBADYwamTI6uH1M6DlEJQGs/dKbmUeILB5jBGDHnjwd0nAImuWaE5qR8R1Otv5IM0H19b2JMZhtj/KUWlNIKolQgZdEhGh51TDZw2aMY8Bou/BFPxluuK98/jOfhqSTT6d/VVnk2hGBdoyOwn2Zdh8wwddVJ2iGtevc6DKGWWqZYDO7p5Ud/q+zPDNn5+Bn66cFK7rbZOro7xhjCIz3lGrTNtdVjaNNmJRtGZlIVbRN/Wy8qrhuLJ123G/VvnyY/6tuYsv0Sovd152EAchapGg8NKIOPzww7yPningfp+bWRKlxoZvgb4n/ldcC0XkPaxZusBfNmiFnWbXlluXFa9/GTzVd2WlGHqgOJlbhhqFtFNXql60xue49KCyPhVnU1vd4QLEGmIwsayIAcVl5VP+bStO93Sebt3qCOYAuUDKGLI5rxkyhoo3DyuAsi7pBnsWLXRp41kHQNUc+pY6soUaUCmzpWfR5qaj8kN5/ZHxM7EvhBQ+F5DhSaKiZz4zNCRpvJoVpxECUtkEeTcXXQCvIcL7q2W6xBr/yz6rkEFZsJJowrrUHryIQJpBo7RBV3W2q478O5hTAgelmZRkQJ3Kjn6AmBiHAQpajjinmd6E/1TobdCiLeqIgI0olQTPiZkZA/km5lmwDTaBPmfwnq5cEbI/YVKhJdAtStzDkjYSGrJfdV0QAY/RnUKee46y/IcRA9O1tmYR/jIB6ufX7ikCZ3P/cZcUvJHRODWTGwA+9Np8qgtobD9NXllSD7J1v4i50K6y6zgCThUjh+SUziUJCMv2YqINL0M9poWHu7 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 033aea5b-0b48-4cf7-4272-08dcb883d9df 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:21.6054 (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: gu1i5YaaeqcuWRxGgDyxwsN9BGpuvjQIskos8790AZrQe4J/Zb+Uh/Fr2pp8sZeA X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6823 X-Stat-Signature: d6pqazgkmnbjasfimyiah8n98x5gxiop X-Rspamd-Queue-Id: 834ACC002F X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1723215569-296739 X-HE-Meta: U2FsdGVkX1+0UPpMIxVhqNm2D+BgiNB51lvcEDGa7xyI/sVvvy/cBkKiGNKd0Nb1taoG66UwOOPsklNmf60mPwWA61kYsvm1HXmmB6dirAGV5OtBjRRynIlJHhQhggcMNhNO2i6Gyac0OupKH76rGtk+XBj9mxDS4rR3M3szU0IdMe6eVIMIpzMRXloxy1SBuT3L8UU+cwfQRWbJtc921THRK16awydGLyswSzoZZLIzjgIt9bjWmBdSaoRf6MnmlAcaCaa+j1HpXMmY7kBKf5rnTR4rtFn1nnayMi+5MBudIza2jAxLdqWFA5KxdK+hxj//dO3EGRglccltYCYjsNqPUmotrt/FuapaVBBL5ujojliJASAXeEIeYBXLuDeWTPbt28w4/opTUxDBr+oLzue2M5zSZzFjfeJavLKqJyZGYuCjEdz/JPvlALxWy/zymZuU6Yw+992foIsauLO7DEFK1J0OA5zXWsD+KjSq2Y+rAboZvJYSkk1iiSAKAniovLAmMA/XqEo2/pixhpRFParMlMj2oFTUcCbIaMDNEcVU+atP8sbXQW80nDn/J77xicAdMj4SVhS9N9K3A94fuvXqZkj28mLh8Yx1WKrBG5C8V2ijneFMauKOTYyLL2+zOgNR7Ju3Y+2+NxntgTJ4CYubpHC5BMrBp9NZH7MK39LcGKix3bh4Gc+llSfVd76KzJOORLWBaAhw7rlJ4LHoskJa9TSTqkqp+tHGkDk4SvL61oWIuF0un/f6K62N/ezB4X+eg71r7esypCjBLmoK/69OipTSUY3PHSoU2Fuu1CmauMfsykkZrHChxI6zpH60chbgS9MQSFCQbfMz2fZx6poKTesn74uDdGsxwkpVIqiDv9ESDJ3mbvdcnNbyHDl2c7eWnaWFvHrOVo+LMrxrtiv7+NOtsRla/+9WNqIgWTpdafPaTyKqZV/YfD7bn3DkNxJtrxf5Yi32oy5sbLB zf/FnDVM d5ShA/NLiUg/aZQIc3efPiFBUDPsA2ytw76d9guzI+D0iiOlvGHfsIUOh9DCAuLKLopBOGBMXbzMdofgTW50yjTkUaNx8vr8ysGaDoQ+RhGCF1tStfGM3DUz4CDRA/JvkEShBWDB7aupsW11jcHCDrEKFHD/mP9ZrOO11EqT28p0ZqOINFz8SsRv9WPNPSKHY127t8GZO9UxX4j/dL5MRA7YQ5M3JuyFoKBSu/COPXT1ujkymTe0b0GWBxPOv9t1KKEpRiiv4sJTv+uYxeLBpPTRLH34FpgXz/3nHJobyNJhqcrJ/72CWiRujhqawY7ONcrwRmrd+cbAYM+ZyNcdz0Cg1G+K21iN2QhvAR2e8njfrTn8mBoiqeTG1QcAPpxwj8qEtKfZgAkMzV9h3wOzstISqOQ== 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 c5b5a3dd2c1f ("mm: thp: refactor NUMA fault handling") restructured do_huge_pmd_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 !pmd_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: c5b5a3dd2c1f ("mm: thp: refactor NUMA fault handling") Cc: Signed-off-by: Zi Yan Acked-by: David Hildenbrand --- mm/huge_memory.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 0024266dea0a..666fa675e5b6 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1681,7 +1681,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf) vmf->ptl = pmd_lock(vma->vm_mm, vmf->pmd); if (unlikely(!pmd_same(oldpmd, *vmf->pmd))) { spin_unlock(vmf->ptl); - goto out; + return 0; } pmd = pmd_modify(oldpmd, vma->vm_page_prot); @@ -1724,22 +1724,16 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf) if (!migrate_misplaced_folio(folio, vma, target_nid)) { flags |= TNF_MIGRATED; nid = target_nid; - } else { - flags |= TNF_MIGRATE_FAIL; - vmf->ptl = pmd_lock(vma->vm_mm, vmf->pmd); - if (unlikely(!pmd_same(oldpmd, *vmf->pmd))) { - spin_unlock(vmf->ptl); - goto out; - } - goto out_map; - } - -out: - if (nid != NUMA_NO_NODE) task_numa_fault(last_cpupid, nid, HPAGE_PMD_NR, flags); + return 0; + } - return 0; - + flags |= TNF_MIGRATE_FAIL; + vmf->ptl = pmd_lock(vma->vm_mm, vmf->pmd); + if (unlikely(!pmd_same(oldpmd, *vmf->pmd))) { + spin_unlock(vmf->ptl); + return 0; + } out_map: /* Restore the PMD */ pmd = pmd_modify(oldpmd, vma->vm_page_prot); @@ -1749,7 +1743,10 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf) set_pmd_at(vma->vm_mm, haddr, vmf->pmd, pmd); update_mmu_cache_pmd(vma, vmf->address, vmf->pmd); spin_unlock(vmf->ptl); - goto out; + + if (nid != NUMA_NO_NODE) + task_numa_fault(last_cpupid, nid, HPAGE_PMD_NR, flags); + return 0; } /*