From patchwork Tue Jul 11 22:09: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: 13309429 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 25322C001B0 for ; Tue, 11 Jul 2023 22:10:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5DDC86B0072; Tue, 11 Jul 2023 18:10:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 58E976B0075; Tue, 11 Jul 2023 18:10:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3BA666B0078; Tue, 11 Jul 2023 18:10:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 296A36B0072 for ; Tue, 11 Jul 2023 18:10:21 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 03B301603E6 for ; Tue, 11 Jul 2023 22:10:19 +0000 (UTC) X-FDA: 81000725400.19.96B1C71 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf19.hostedemail.com (Postfix) with ESMTP id 6DCF11A0003 for ; Tue, 11 Jul 2023 22:10:16 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=vWFkipyF; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=fV+5YUtT; spf=pass (imf19.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689113416; 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=9WgIVKzcQ6N+x58fX/WywhAam+rjdw/HOQHSMIvR1z4=; b=mrrUBqQ4JipsqWvOBTpqJh7LMGvOnfYBgrSqshSrahPgt+I/3caSy7a8B0MVoHWvxOgF98 r1LAi/bKI+KxCbQw9ssJlnafxLd8QWlSGOxuJLQG8ditQAlg65KEVaMdE1rz77OzkYYZWa 0Kt/1OL9dCWHu3+kNdAS8yZZfGDl9AQ= ARC-Authentication-Results: i=2; imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=vWFkipyF; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=fV+5YUtT; spf=pass (imf19.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1689113416; a=rsa-sha256; cv=pass; b=f+LR1g89c3a35frmAmpVQZ4NY0EHCIR3n5HZkpGzn+ppuaeZ2PC8FKZ123pbIwktowd3FP 8P7Zb/oafxv/imBB076sN6pkq633n31GBO9igpT3e7H6EfP/V/avSFhhuMCE2iczrXLFIe A7y0C+3ExvpTubxOAHbMTKh/bF7uPPA= Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BIDICf015157; Tue, 11 Jul 2023 22:09:51 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=9WgIVKzcQ6N+x58fX/WywhAam+rjdw/HOQHSMIvR1z4=; b=vWFkipyFT1WswR3Dx4XICJho9b3x2kwzQ2YMI0+CTvP4RUj6rRF8pzbAyPoRdFwp5X+L 66M+o5gYuybZYhhNy0WhSah4fVBNXUbbJWzxw6iDEAHVkb3eT8LPmGURcqX+6Rzz3afy xvIuWEiD7Y3nxrLtB6kBtv/CDiJR3T+fCsil0zkUTOudj+fgY41Ou1qqKjfLlG15aUAx OkKmiLHg6ACvlsCJCG51DTCK0DTowZTqSnjT8LZ6NSjbGtl+/pyvHdURBeB+lVd33//X NsU/zdLgmObiO/+MiaoTUNxNlSzuiFH4rZR5Pz7lOMUIpCJiZ97O0pvzzCBkOCNacPUW sA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rr5h14mrq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 22:09:51 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BLhFlr027002; Tue, 11 Jul 2023 22:09:50 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx85hxyy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 22:09:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=er5+PUboVj8KX23hZXKYSCxUl4FuAmyv1VvwCv5zNthFLooIsCX/cAxB2ewegqAif+rI0trUG/iwfoz0iGbivGpZf1ueL5bdhnFi8BAGywwQtOv9XP9pRd1FIfR9QkMHm0oBBL5ekzjCD8wUdERyCmW2YmHt4CZLHyZuRQpfRCjwCCyNLisknV7NKM8auSv8wOH0jbyUr7XSDvH85TtUZ0qnc52pMKLNnEsEKmdEGHuOaPvS5sPIHru5HlOK9WaMjpCd8FNcXnv6i9MNernmqxlkxKMQmjLiLWF0WcRLtR9JZlZ3r8UqVrJjzo34agZqbvhXYmzY/zgg+pgUaYN3iA== 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=9WgIVKzcQ6N+x58fX/WywhAam+rjdw/HOQHSMIvR1z4=; b=KFhIsPxG01dt9NbgfUpsKPf9XtQOvPHFyQpsJ+Fugljjd6dizniADbw96BcA7EYELSxb/AiQBAtgBI/xel2GK76YAfW5tKERC9EVUaYRIsmKFTxTV6e9omAmBCbQUIfictOYjSCuRi57GgVzmB9BAlzc0Wui9N1KIBHXrDRSL+PutZF1gxSw9wOiCbZXD+6S7g1Vq/4w1L+SCOqyF1PCU1LIqtW8spfU7AjAaV1oN7LDX/Pfpj5CWK2KkCg+fPD+oOu61PG3b2WmclGXmcTTD8pmvwvW0XNuzHsyeYsAPCrjHMU70sMBM4GmI4IfTsEj+QZL20PcjqqVNB9szbxMDg== 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=9WgIVKzcQ6N+x58fX/WywhAam+rjdw/HOQHSMIvR1z4=; b=fV+5YUtTaoDET5kEkW15oH2LX+9TBqU5kyESqm5pAVcU0L420zwN20ij0j0RFcTW/FM4QCSbvfGH7G8Yrtglom5uXrlGWK2PofHrdsrJsR0D6Yoof3HZM81XgfA0/AJyRYuJNwtLpNrEXw6qrnVoCZGLW8WfzXS3QVGk8jXBrmQ= Received: from BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) by PH0PR10MB4775.namprd10.prod.outlook.com (2603:10b6:510:38::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.20; Tue, 11 Jul 2023 22:09:48 +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, 11 Jul 2023 22:09: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 0/2] Fix hugetlb free path race with memory errors Date: Tue, 11 Jul 2023 15:09:40 -0700 Message-ID: <20230711220942.43706-1-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.41.0 X-ClientProxiedBy: MW4PR03CA0310.namprd03.prod.outlook.com (2603:10b6:303:dd::15) To BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR10MB4196:EE_|PH0PR10MB4775:EE_ X-MS-Office365-Filtering-Correlation-Id: f62f98c8-baff-4daf-001b-08db825b8a56 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mTiGjBNGrxNCGTVKKI8oTW7sFGpJ2C2+7if5cvUN1Oz3KxS/wJY5kcEsZs1GzDEfOKMeVHyWuMyB/WopaZu33vxyb6ILioLny0kHPFK5NfBWMGmQL2TaKMLB3i9rnKZ5dt8hPTjani/BqNDM++zQWPbWULkA0P85VPqveYM1+SJZG/gq5kZIxA66WXAh8nXwQrGzv5G9+Mmehz1Je6XEgeqRUJBWHa0LnKpprUV/nHfL1WY8pV5p6W1FjujIN7cOnZvNhXEQay4RAVtdRnre199RhoKp1fxvYz9Xboz9CCgez9Kr4uFUarOd8pqIiSKHEla6LigPEem0qrmAMrC+dB77RJq2mSDj3S+/5TInkM02IlI4G5y569mQhxunkyqITrMpp2W8ZGEELHo2TmNEULhNh0rMWd6pxmVid4rCGJbfWOUz+TeNtDQRT0ysXIbxfj/9a3XT5utqZna8irnO15s8vGGoLR/gp2VX0ZHtkHd76VGnd5ekGNK+NcS8tVecj5ej3WW60CSnLDW446pYchOEfz+LJEvWYNmZqkS/s8Y= 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)(39860400002)(366004)(346002)(136003)(451199021)(6486002)(186003)(54906003)(86362001)(6666004)(2616005)(478600001)(6506007)(1076003)(26005)(44832011)(7416002)(316002)(36756003)(107886003)(8936002)(8676002)(41300700001)(5660300002)(83380400001)(966005)(6512007)(66476007)(66556008)(66946007)(2906002)(4326008)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BSutvyqLlHVag+LhE90eBxDqZqxTk++Qu9of8uq5ljdFleiPVKZAOPh0dI0p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HLCT3ICTF5AmU7zEb54c4Fj62v4IbAr1F1wTU0lsP1mfZxYksWvF0NRa5ngSLFRJPB6M3v/9n/vaHQBXBYnH1lNfEjcuU4HpEdb0NeHH4meDPDxYoC9qU0EW0J4JSM1hUbnLQnmXHb3fg6mkzpF9MqSyyXiNtHzwJkY3mHgamezMP6dyofSFfs3mI8V9S6kdwQ2MtekDl6NWkmt65iQ0SekE/PnADRnL5+DAYnOpV1HmrZeXPXIAljkwoRhDalqQPHMtpBhpESAFJFkZVthN65a0sftGghkMwxamfUZEUnRkcrwg2+j39tKK/4AqhN1E4sHq2F6nJEGeD+NspX0uFFGzq+R+eRKv7T4uQ0hwJ6xlW1RDQgkxlYtGG5VyMGnxapdZlMeXb9nFlEgsQ4mdJavmAJK9jH1BxlrEjoMYH2yKAav9ypU0WntMm1QQd4vB6NTRm+z4EChm2Wk1vwSJSKXUZxr6dqr7CdNBxr4C4dZ0Rgjej X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f62f98c8-baff-4daf-001b-08db825b8a56 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4196.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 22:09:47.8809 (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: xIQJPvJ/vvnsHegJk5LUWKGbKFBdq3lN+s5lV0XnACjOeBfjUipLzMu/okawDH4iya1QcuumPKQFl8FsFZ3tVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB4775 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-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 spamscore=0 phishscore=0 mlxlogscore=666 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110202 X-Proofpoint-ORIG-GUID: S4eklLHOpZhgZTPti2dzdBTAtnc_E8ql X-Proofpoint-GUID: S4eklLHOpZhgZTPti2dzdBTAtnc_E8ql X-Rspamd-Queue-Id: 6DCF11A0003 X-Rspam-User: X-Stat-Signature: bb9rf37k98ct4i6s1muci5cgfc7udmcd X-Rspamd-Server: rspam01 X-HE-Tag: 1689113416-489582 X-HE-Meta: U2FsdGVkX1+OH8L0twbSxp4X7lRCCd9DJqnj2Ta7PYPwyPjhdpnuquRJZ0ynJXAUMKhiVyvpHaI3byT8Gjid1q+H0Q9R5wLpZS2YUx7RyPk9F7sNHdvMWBWMdCK6fE6uqdhNDZZMqgrnz/fmTU8Wj34HbySnjSdDfsrfCDi+V7xz11T4wdw7j2BujsgCi1N7+DuTyt0PxMoRgfvet2h3Z6a5LaIkvUKqbz2feWbBDGOLQYlcZ+EsG+0WOQ3moU6utQWFmk7blk4VkM3LFZkUOvGiQB5D8sOPjaBnMWm2DhMHkJt3a8GerlEqTpnmSqpqAmrI7uOsdHRNsOIRM6MiNL58L0j2XkZR2uv5VI0qQLreXMxd44zz9WWb0FG5j91mBRqYiJBFsNIMR0pwllerdcBPvsFeaYSzvxEG+StP0w6C87aKQ0u8Ogn37I/hKJSiZ6B+ZPPV9MxJjUDdhtTQ08dQntzp6Z3+BZyM2KxBGjKKTSzWbPcOOIavC22yBj/XXhUlrFbo2c2lM8xyKO9cER2ayAJtotACQKtNDVd1RH19rcLFqoNXRsFdAzQfF4gxeMEH5y9d/ajWncFAo6iFrp8aiUEeNwEsxpTKbhR9KiSVhdHfkCVtCh8x0qBoFuuvsWZitENjb25yc0gQvbPisbcIx42q/0qofomNiUiI+RgFwaRbu0O9FWXjB90vF1btK2zx8g4FoAnFdVbGBrxbIkq3ZPucum7k3sPOBzSlU/TuNmYZfRuNIFzJqGoY6U7MPHALAY7m7mbjM5OjYd91iol3IguHtDnFkFvGSXgkkObi/XfchCHbIwfDdl7f8ZDuGTVNM79M7zlnrupES/o3WgMlGJCJa4/ULx9jsIWPqFNkH+oCL3RkrEcgelvrD7z3mPLbU3Z1MdEf/79rtzkn5m4dKf/XdXfC6HliQxnYULRvtSYdXww0PD946PeGWiV0BWFWcoGk3K9OUlF+FyH tVzu9Nxx P3zh3u9dHfJPyTY5xonJcb4U063lS7BEoBeH3BBfsvD5IxQpsZi/YtqU88NyM/+gU29go+rFx17MtWHYf47QWiMHwzT1hw0iHT1hGUFzXiQykFtobZ0dIqvJFfBgNfu9bkCtql6pMs2viaErb6VJgFmIu5CUJr+o6pawUiWPgkv8pzWz4fc2S0vBwc10nFa6Z7J/VlhnDcF0w88HpOU4xtwwccbXc9HuL3NXBiW/U3Ise6FCpUZ2f1PlrcVaDjFEMmcmnKtI8r2tPxqAXpJCfoi0AnW1e/FcH9a5JRGfltZ4DJkhrgBtMhtpxq/qqE5M+KhZsmZkq/jL4BfVBQOsMWrKFbbtmV2KVZzo2/9MpcI4H98/IyXW7SVpXrHvFuHsIT1QbM0xXetUdAv1Cjw+9Vb6aePBM22exVmvs 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 could lead to slowdowns if one is freeing a large number of hugetlb pages. The second path optimizes the update_and_free_pages_bulk routine to only take the lock once in bulk operations. The second patch is technically not a bug fix, but includes a Fixes tag and Cc stable to avoid a performance regression. It can be combined with the first, but was done separately make reviewing easier. 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 | 110 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 85 insertions(+), 25 deletions(-)