From patchwork Tue Jul 18 00:49:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Kravetz X-Patchwork-Id: 13316652 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 CC56CC001DE for ; Tue, 18 Jul 2023 00:50:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 68E1A6B0074; Mon, 17 Jul 2023 20:50:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 63F486B0075; Mon, 17 Jul 2023 20:50:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 491258D0001; Mon, 17 Jul 2023 20:50:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 3B0106B0074 for ; Mon, 17 Jul 2023 20:50:23 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0D563140657 for ; Tue, 18 Jul 2023 00:50:23 +0000 (UTC) X-FDA: 81022901526.25.C0218A4 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf14.hostedemail.com (Postfix) with ESMTP id C052710001D for ; Tue, 18 Jul 2023 00:50:19 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=BY680ZCA; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=reMSQwYz; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf14.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689641419; 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: references:dkim-signature; bh=DRnyZR/Wk+eUAUvLkL8qpZKsrsHh81szOQqei1HDGUM=; b=4unShskYJQsaeBzX9weyjBXornC2a14n3+5vImWs16X6RHHBbkO0RordBslG779Mu0HC2p bRDmoH74RPe+Aroip/K+lkZNsemlgXcigD9RsdhmwDKU9PMN6NlgBTaZ4bU78NHWs1LSX8 GhzsdmVNbhyFFJ7P8Oaw3qW0Z57Ifrw= ARC-Authentication-Results: i=2; imf14.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=BY680ZCA; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=reMSQwYz; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf14.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1689641419; a=rsa-sha256; cv=pass; b=JCkOvVvgVAjkK1bAWlEu1N1k9yI7lcHH7MgMRKuje2pj7wp0LaFQ7FY83xOI1MCM9QAoJt j07EKa9Qdr2iRWCujIwCqOg3H0/bHmGnN8KQnLiLdoktl8W6clwRhHnj1X6gIrOE0meh2Z rR49WZGt5aeoQAkNIA00jo2a3oUeqqI= Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36HKOM3C026874; Tue, 18 Jul 2023 00:49:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=DRnyZR/Wk+eUAUvLkL8qpZKsrsHh81szOQqei1HDGUM=; b=BY680ZCAxUUvZfdoDe+haG7beFU7gfgQUOkeBALSVRKY6OghEUl9V7pvLx24f2yS9pGt Uk4nlhsVUlBekaVPNQacIrSrkHg9/3nCznAKBxr+3BeEH3wNMscgPv5cBW/l5iAy/QS/ /18hP3xkc3Wxlvx8wl3PHC+qIzS33ZfLfkuSoeHxOALiPmBtl6ZAhCRqr80nsKxRhoDa BcXz2CY8QuJWom7HJWWiJRHdq1mVth3h0tlU15l4EZt4pbmTcC7Uyu5WhxVN3oyJ52wb HJsWLtqSDlLpMu/nqz0yT44RTS6RcLQHjOXvE4UTXByMxoa9uLD60PuRCZNzMK6Wrjbf jg== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3run783w7k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jul 2023 00:49:51 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36HNle8P000794; Tue, 18 Jul 2023 00:49:51 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ruhw4dbfd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jul 2023 00:49:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A0VjlleffXVnmXTD/dM8bu4ba9UCsH1SRr3yRfF5IG6ZPYKUvaBT6Ky4Is4mElEE6LA+qjRNMf/HVn+rBVjUc5EcRURNwF1G9apXEl23c0FAiIIrbZjQlHoYs9KVcojmxc5FA+WkSUgbvxRYdJcvUgEbszL4WCnN8k6mJ43qOqei7itVSYet7zUeljr53JxrVmoLNelNnhAtrKKwM10/4knZuaUfQ+UEEM584XidZ8dGc5GKYrcyVqgkm5A1bBRjTZ59xqJUMjNTzaRNVMUTEkQf+QNbrgmMV9jt84fxC0lihrO6SUHj12Tvc5pLHZzbw4wKzlZqYtsUXUul+eCApA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=DRnyZR/Wk+eUAUvLkL8qpZKsrsHh81szOQqei1HDGUM=; b=jP+P45rEHT33A3hzL9lVB6K6pxPiDEvmKV++kZT6UxYiiGCo9UcerYtgcrUWqNlSMLlh/eMYU3LEwpoTeJG4XSPP8h50pQlN1ypl+nMEtAxbH9x0+Slo0khhRJwcD49MeZdlIN2dwtI78ozQEVCFYVva+wVuOVEile2TPyiLt0QjmBdpLK/ny8f+mCd+ZJ6kSzWo8jrhrkBsYK4A5LVR8L0OVzSmnIItqqq8R5kCaAHnnHsWr45sAZSltKL93RMYkGy3BMqDXmLCwLXmZHayFo2cbMz/19TAQW0Ma18qT6sVlKmNAlw9V3SA2p8Bj7JH+Xbs73JuhNoFKt8z2rDgnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DRnyZR/Wk+eUAUvLkL8qpZKsrsHh81szOQqei1HDGUM=; b=reMSQwYzk1S+ThgEQ51GUIFxckGG6BXfU4HcUQkkEZECaBvgrkOwx8XfJ+aQ++H8rhBB71uEQsQ1M8PhQSthIfovMo6ZsP+VUEe1bQu8hPL9sjZWHw7IyTpBLSGdimk/un/rRVjRrfPClmFvbhoGDYtnttUG+LiZTP4XUGSixw0= Received: from BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) by IA1PR10MB6193.namprd10.prod.outlook.com (2603:10b6:208:3a7::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Tue, 18 Jul 2023 00:49:47 +0000 Received: from BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::4a17:13b0:2876:97f2]) by BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::4a17:13b0:2876:97f2%7]) with mapi id 15.20.6588.017; Tue, 18 Jul 2023 00:49:47 +0000 From: Mike Kravetz To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Jiaqi Yan , Naoya Horiguchi , Muchun Song , Miaohe Lin , Axel Rasmussen , James Houghton , Michal Hocko , Andrew Morton , Mike Kravetz Subject: [PATCH v2 0/2] Fix hugetlb free path race with memory errors Date: Mon, 17 Jul 2023 17:49:40 -0700 Message-ID: <20230718004942.113174-1-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.41.0 X-ClientProxiedBy: MW4PR04CA0158.namprd04.prod.outlook.com (2603:10b6:303:85::13) To BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR10MB4196:EE_|IA1PR10MB6193:EE_ X-MS-Office365-Filtering-Correlation-Id: d1c233eb-87bb-4cfe-4beb-08db8728e2b1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I/GxIFE7G+UYR+1X09RXlh0/G0ai3rjNSrL8mCCAPJY6mhDHUgQuhFkbiw7GiHPK+lgcO2iWayd7jug9x1e+uZDyG7gbTM5VEsmf0L5lIaKgWd6+bkBMErC+KnHO/CQwPtV/p5yBEzAczr75L44P6wr9NMrr6BoKM/yib3tcXSxayK7h2Wezx7ZT9GBQz0R3KhrLA5V0AtPZeLLnGCcl4EqxjkuNtvk6frwpOZRexAP+M+6tPF72ABEEhne/FO8L01dUbhRDu6olxje7O2o0B2ejuuwHWiZYKjr+pPTUrs5V9qm1VBLd4m5t8FIcVYsU6ahz78GWNDyiXQUAuWaUxsbh9Gd0RbjK6ET8ZG2PShAgxr+JDtx9OAvLjlrtwKWDEf3dV1u2/+SQAvD6yXMn8VTnDNYe7GV5GLnON3GTTqrVi6ULXz540Ciw6PqtrpGZAW9SxPDwPexvMTkOD/9hhGQ8rtxRTaxrRcsRiJYJ3R1ZKh/lAdqYsYRs2UDihtlKt0VsdRnjYyGEuCf1XOQlNKwLMvo7JVxEwFhIZvpZy+Y= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4196.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(396003)(136003)(366004)(39860400002)(346002)(451199021)(54906003)(6486002)(38100700002)(6666004)(41300700001)(8676002)(8936002)(5660300002)(66946007)(66556008)(66476007)(316002)(478600001)(4326008)(186003)(83380400001)(6512007)(966005)(2616005)(26005)(6506007)(1076003)(107886003)(86362001)(36756003)(44832011)(2906002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bXjyviCVygO6f7J+hb3dCN8YDEB1e0JhooRFXwkF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YfGA3kZ1QheW5H4o4dn6bthXczjs2FXO4Zmpdpd620qULBgYlRuRidkBBlRzuvqQKV8Fdr36221dWxmsZ5D2FgB1XdoyXArRI4akwieJFJh8a7u/99/ffKkK/xfnwM1C/JxGUNiSoQ4ZBl03ZokK46ZlO5VHTLSszqx1BCd9J4XbtYx3nAQH5Z+f8k+VZG1hX0mBg/OLe63K/S0v0Ox6m5MFGyHlP/U2frzNJHxYuHSwUgnFRW7BlaVvBqF1PchraBwebobTGc5ulrFC0EVc1GHKI32uxJEhEPnOLIqyJh5tspIONSXJHXC4SGhebMRhrqhC66c/uhPlpWJg2UlZ5m5d1ppOt5CQE0gZrTBPSyav5siLSABvxF+UuM62A0vmPPf2JAuPnYCb+T40JjxRLenb+5ZstNE3QnWVOGHQnHU5ouUFNTlNWzde9FDU1p96n+duSjG+T70t4llbGHhzGac1ihPvkvMRwTZvDcRdpne+pN565TIuo37RdPOfZuZ5IlTny X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1c233eb-87bb-4cfe-4beb-08db8728e2b1 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4196.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2023 00:49:47.7188 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: c/w6y8wEUJBwRVVee9fsQ5XwDt1c2KA7dy8WcFwXfLqx4y8DNvVoeYNOWunQgDtp5c1JG1ooJurKfM3ZkAHdmA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB6193 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-17_15,2023-07-13_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=479 suspectscore=0 phishscore=0 bulkscore=0 mlxscore=0 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307180006 X-Proofpoint-ORIG-GUID: y1i0gw7E14igE3QXPP2f5WRYCx7ONucY X-Proofpoint-GUID: y1i0gw7E14igE3QXPP2f5WRYCx7ONucY X-Rspam-User: X-Stat-Signature: pcxgb6fwr6xdr7cs11stbgzbwffmow9d X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: C052710001D X-HE-Tag: 1689641419-899724 X-HE-Meta: U2FsdGVkX18PbH3cycHZz550tEw6XdXu8H5rQc7aAU/mEft047PzREQLAUVvXaBEi8mXsfHn8wKdOWcAAh4hfOYdV81vAm+J6X9eCvcmReFDuQIw02+FczpI1Po5Vr51cy9es0jB/5hFYr3r+IMZh/fk+jyk8e1Bja9HKUPCMJvpMcfIEJurCxDwsZ9WCUnoa8itjVYkUSVU2kLVMdIjxSawY+c7I7NjcG3R9GJzeHoW+qkfEFGBKPtYUGlhiqZaMA8jIz+Zi5wKiwEh8x+n1SLqHzSW9sTmNihWGzyLmvH06V0zWZtwxiyJqBTog5E6OO7j5zmtN82zidZ+46L3iZJKjYJqGKeQ4STwvkBCUhQsdNIbSp2x+jlXSdv40jcnzXJDxMEnK9+8py94KPPBuSG4NJfEOvZZyDbZkmQvG525p1jQGgufSp5rnGGFTJdoQTyMtpojEMXU8koTdTgpD24LixitYroeQobYoch7KMjuWjM7pGGdilkvkDLP84pTxNNw9qWrOPtmYAb0zzBwTP5Ma+eTG9e4piU+7Yevyh7FCn9WlZyiuyQxnl3qhp4Yeo5Q/uT/WhIbwTeJJh5ot3PivjY7LZ3j2YEdXF0Hexhp5fCkckfS9Wrs2QS+j9LxeDDbIjK6I9591m5udAv8PnG3xX4QRWS0AVWHQXCDQa6xOHRoTind79x2vr8utKW5bQ+674/57QhDe2qJp9yWT4Jk/92XvQhqbvL3IqZK1Kl3vr295Cd8+0yvZwLyQVCKmaHsjVwrMNNJlE7t1TSTQqjay19HOAf7KDrM8oORlY8EmuOqemkOycnUeHaIxEH1hdvyIfTysl0ngfYf6ebv4pm+35I7CcOHZn8y0zzcqOoD/tDcRkWddDJnY6nrKcDqqPYDAu1eKyX+e/xZdkfdClLuOCs7/6M9BjynfUi20p1rUzpm5KNvktLqn4oQ2CwXhkFOi+bllUCpVwrEqes IhSRTv+o l2vxwY6B/h8ECejd8thbGiAa1HkWPBji5MhdZLnI2ZLoEyUuWLT3XrhMjKTqsdRCu4YQlhnFdCzbSYAp4nv3MBVxXDp3YegKNL+L8grSGSH1qpkfmEDtWfre/kYketp82hiHV1wewWG7fxD4HqubhMxJvs2NiDQ686RLe/PNJJBDBCdoKSpft6GWsP8Zd/X7LmAXk3VxrSIyxfl5oD6NDDgHTs37fJDGT80cTAjgCNEnLqUTow9KFbXQFGOpnuEKLfDSN09amE9yUbqEEy5pA4fXEV9ivYBFPBHdKIt/5Jqx8dkPnCcxx420FmrW8xT/sXlXlhFnWw1CaFpjAK03UzU6YbrQSK7bdhVBqbYvTrL88/s8KcfuAcn/1oSKYEtMgQeBoBAyJpLWIa0Xnsf0Xsg1tqLDq66ryS4NC 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: In the discussion of Jiaqi Yan's series "Improve hugetlbfs read on HWPOISON hugepages" the race window was discovered. https://lore.kernel.org/linux-mm/20230616233447.GB7371@monkey/ Freeing a hugetlb page back to low level memory allocators is performed in two steps. 1) Under hugetlb lock, remove page from hugetlb lists and clear destructor 2) Outside lock, allocate vmemmap if necessary and call low level free Between these two steps, the hugetlb page will appear as a normal compound page. However, vmemmap for tail pages could be missing. If a memory error occurs at this time, we could try to update page flags non-existant page structs. A much more detailed description is in the first patch. The first patch addresses the race window. However, it adds a hugetlb_lock lock/unlock cycle to every vmemmap optimized hugetlb page free operation. This is sub-optimal but is hardly noticeable on a mostly idle system (the normal case). The second path optimizes the update_and_free_pages_bulk routine to only take the lock once in bulk operations. -> v2 - Used the more definitive method of checking folio_test_hugetlb to determine if destructor must be cleared. - Added comment to clearly describe why and when we clear the destructor in __update_and_free_hugetlb_folio. - Clear destructor in hugetlb demote path. - Do not send second patch to stable releases. Mike Kravetz (2): hugetlb: Do not clear hugetlb dtor until allocating vmemmap hugetlb: optimize update_and_free_pages_bulk to avoid lock cycles mm/hugetlb.c | 128 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 100 insertions(+), 28 deletions(-)