From patchwork Fri Nov 18 19:52:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Kravetz X-Patchwork-Id: 13048739 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 A87FDC433FE for ; Fri, 18 Nov 2022 19:53:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8C678E0001; Fri, 18 Nov 2022 14:53:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D63436B0072; Fri, 18 Nov 2022 14:53:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B8F1F8E0001; Fri, 18 Nov 2022 14:53:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A6FAA6B0071 for ; Fri, 18 Nov 2022 14:53:26 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 048DF1212AC for ; Fri, 18 Nov 2022 19:53:24 +0000 (UTC) X-FDA: 80147612370.16.E7DFE70 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf13.hostedemail.com (Postfix) with ESMTP id 83E8C20008 for ; Fri, 18 Nov 2022 19:53:23 +0000 (UTC) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AIIu8He020978; Fri, 18 Nov 2022 19:52:59 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-2022-7-12; bh=zOay+mDVbczpwL85zEj6q67Y3cnqh3yOWMR8dLlMCN4=; b=CtFkYOsPOPlK4LIP7aedu88IRlVdFK/6BU2P8M0b6TuFIHSERDQjzCvJpQ+qISIT1FCS RcMqmTOQZw1lBb7ResxEIXsRw/C3VhX/aHE/UlXV8WISu/91KNN6MLRE4CANzJvNMReR Atyr802Eszeeg3KZ01X5YjWjbvCeXpcSnQsxDwpLfnU3o/7epvc/7Lt0jvAvy+iE1jot w0UXpy6pWj31vDS4nUK3XHiVMkqQkJ6m3KFmm0DV4ggU304SLlzKW0OZxgZkq51wLL00 idnjNMGUTStOLxFSxpse2amNlg1+wnlHguQWQXMFMTS7ulLH4gp9eXVDfBEISlOvANBF cg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kx7kjhq8h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 18 Nov 2022 19:52:59 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2AIIACVF030343; Fri, 18 Nov 2022 19:52:58 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2168.outbound.protection.outlook.com [104.47.59.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kuk21uq4k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 18 Nov 2022 19:52:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W8pLWyHlIpV/RWRR64aOO33+ooR4oclIvbevbaC7/1TFqxd9z66TIrPyTDpVBD9/Tba52Y6/C88mk2SHY3gP5DJL2M53v00CHrTXGSo+xlUwIChtj77qgn8UMfNoIM25OB8VKr05w9WSSwPImU+zKysDy2xMTXHhghh5y1uvbgpF+IO8sZUkoT/c99KgAC/iXnS+ggc2sWeh7Irx1PYa6JRkJ6D2h7a03WlkGqDsBRoFxA6cPIX5lArn+4yFgeVdOpZDQ6DXhDp56Bk8AH5tX5N+Y+W+4ABkIKw9AaRPMqSNrA6fv4SqbDxzE8TmWMJGvnRw+CmZlbLKYcABGorUtA== 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=zOay+mDVbczpwL85zEj6q67Y3cnqh3yOWMR8dLlMCN4=; b=T4KgyzBatkWXwHCHMFAIsNtKc7XI/W9ZDAqcXD+P0S3knRbwd0nC/pib0LF8yMcuP7fS2kmBa5RoFyiDbvyh2s8ezdJ5gKiS80r8yHpVq51B2f1uUAnMNgU96wBGtQluWot+fvmgrr0SiK9zgUav5O5HGsUJEPkOIwkSXuj8GrHEg/1fuGAgl9XIJsJZCGVSAwcIfkPhXUa8P/qwq6/l90r7xODT1ZVtvYziijQ6EGYITYv1Tk9grgFpILoZxPtFPW1rgHQcv6byJGhnVKFP1uw7veikVjEcvJ0OMVf7uYJsEJburHeGDhxTJ/83YsSWJ5CgopDCgnytpZJOLZ3dvg== 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=zOay+mDVbczpwL85zEj6q67Y3cnqh3yOWMR8dLlMCN4=; b=ua/v2EBVbo0gAlUqGa31fHK3msMlnQ3LirPE818gT7cCncG4msrgiCQAIT3rwNforkOfCayVrbrBDTyB5+zm+Rdk51YVoMVrVYEfhaEZKHSAhfOG5/GGz+Nbse8pdF1AdsTOSikyHShnkoISoqpuABXCCM6QGOKDY4aFVflxJCw= Received: from BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) by CO1PR10MB4434.namprd10.prod.outlook.com (2603:10b6:303:9a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.9; Fri, 18 Nov 2022 19:52:56 +0000 Received: from BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::8d67:8c42:d124:3721]) by BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::8d67:8c42:d124:3721%4]) with mapi id 15.20.5813.020; Fri, 18 Nov 2022 19:52:56 +0000 From: Mike Kravetz To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton Cc: Muchun Song , Joao Martins , Matthew Wilcox , Michal Hocko , Peter Xu , Miaohe Lin , Oscar Salvador , Naoya Horiguchi , Vlastimil Babka , Sidhartha Kumar , Mike Kravetz , "Aneesh Kumar K . V" Subject: [PATCH] hugetlb: Fix __prep_compound_gigantic_page page flag setting Date: Fri, 18 Nov 2022 11:52:49 -0800 Message-Id: <20221118195249.178319-1-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.38.1 X-ClientProxiedBy: MW4PR04CA0160.namprd04.prod.outlook.com (2603:10b6:303:85::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_|CO1PR10MB4434:EE_ X-MS-Office365-Filtering-Correlation-Id: fc9d111f-4c0b-46b9-3868-08dac99e7caa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JewTvVjKKeaXdzsEvVf0Bno0VZ4mrEnYfQuDakrEr9aLOxd+sSc3p9Xly4Z3NjTiAczNh9SMl8+c7TkacW2NMYE4SMm9DBjIkVB/NrmutYlcvv85hfuXQRQheso1jKeShPgpHFB2DBK+baRzJy9J7fyKXzjFzUz++f+NYPfvytU9eKpQZsQd4yglH/9mSjR8vMBGPMGcKrSt5O9IFlzQ5Fc5dQA/zZGTlP9z+Fb71hIsXgG+gdMSVISJ6bNz9WCSk9EB0EbFrDorGX8lIs9iL7D1Utbbx/mOJcHIdxI2DXqfvFXpX55cLMLWB4FERW8+4nEbVfeBtmMwwuS7+FO/yu2xIk4jjiw0bBMsB49My1IaMAzyy6mYw0P7rjyeM1jWKJWN4WMbceLKlsThtXziX+4JY9pxrevVf1buepQNHApWnNmqhIRt+uFTS11U32yzjFa6ParvaOGycdgeEXg8L3R8CR3reLC7mItJKyNbh4cp74h4R27XG6my/VMx56yvB4ZZ4cC5MJu1p1EIYAjQXfL9ennoupuhSMR88M3GdGVQtAQPra+Opb7254eJXGkeWyV2yZWecR5l9V2g2t36yxrU4F7B6AI2wohsHOiVOanQ5Z2FWH8Tsuz08271zFfrKSH7st8DsviG9O0TEjdjJA== 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:(13230022)(39860400002)(346002)(376002)(396003)(366004)(136003)(451199015)(36756003)(86362001)(38100700002)(44832011)(5660300002)(8936002)(7416002)(2906002)(186003)(2616005)(83380400001)(1076003)(41300700001)(6916009)(54906003)(66946007)(478600001)(66556008)(316002)(6512007)(4326008)(66476007)(6666004)(8676002)(6506007)(26005)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange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6aQ/ld2+pYc4+cB11T1yV41t5aLn6NPzQSduyP6xD2qvWVvLkwru3Jp//s78X4fxpo+NAOBbrRhipFnK3UIth24aqQjPlJUw2NINHIOcUMhxfTktVjAFMXfMeg5YOSp1lIaPZsBY7xh6PMq4uiKP3KJoEso+f7mlXwSYc+4c2671A3eRd2BO3FaJONb7SzntgdClUvLkcPPRWRuyYyupbcxkM8DjqgQRe7EHnF6LrWA4q/LJ2Ze1cE/YaGnbqnxEWmZDyE1wcveA+Sq/K5dKaKYAKQoNpr0AskPzshMVNNCgHxOMeqQKL5r85DdbAIrf5xIaIy+QneTZedCgCR2r8rRJuCxkBtIi3RZANwgl5k5QMlSUvPE0nbLOpyMof7agyJfq0LsHHhf5aZnv7OkTlEnhmd5NFskY51CnMsu+xfE0Lz6e1utSgpRE7XtwFAu4lewdoUlyldA3nPNvWntZv2eb5788OYvpQme96qXcAqGi++4Fodm1JXWtn6nTZxQQU3pJozFy3AI31GhH1TH0OpavYgYEa0x70KU990VVG4NMYMKzQIxhIrCd/E+ZOeX15FXItj0zO6W9/8QWvh3kp1Rk+xukDOTAl+YNAPnTkYptH8r0fheD81ntDYNe/KILZU+fkRwGuPC17PHxMe/ScBo43Mj8gd7t4W5mQytz8iX0Bg4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc9d111f-4c0b-46b9-3868-08dac99e7caa X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4196.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2022 19:52:56.1298 (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: gIQl78e+xMLWQ8YDTA0rEmpCEjeEVm27cQb6ky9OZTlC45OvEQLuAQUtfnVB8HrrtfmrJZI70InpmXQuHsAkLQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4434 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-18_06,2022-11-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 spamscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211180118 X-Proofpoint-GUID: RGNoDk4MaqG9hRay7QuU2Rla3_M_H_7T X-Proofpoint-ORIG-GUID: RGNoDk4MaqG9hRay7QuU2Rla3_M_H_7T ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1668801203; a=rsa-sha256; cv=pass; b=COYGxVjZMaJ2MqWdrlqSFevmQWeAU0mBJcgp12Tasai49w2HTPdZo7jiKOA4/Z8MreVVza BZdOMQM6pUFGxJI4U3uw29kHywBY8tNpTSQqaL7Zlctj0WQm/nPWCZTwmIDs8OxYBK2iwy YXRbOU3NVkdWSJb6oMfDjMF05UZ0ryI= ARC-Authentication-Results: i=2; imf13.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=CtFkYOsP; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="ua/v2EBV"; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf13.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668801203; 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=zOay+mDVbczpwL85zEj6q67Y3cnqh3yOWMR8dLlMCN4=; b=F8M4XwxKMwt0KjhvMOX5khuESx0EgafVVkGpYpEqO+IaHMEYTQQqtSiW5raAPqbl9bRIey txm/G/wvXGbCNCECARZz5LBgg9lb+96eiptkmaHuFPiXvspHCol/8DFIWBjrhPCUmLByhK +9T6kz7H9vk+in6GuEEgz8XVNHtEVu0= X-Stat-Signature: f3otsar4t5ayyg8yjx6ep9gxfaomzugf X-Rspamd-Queue-Id: 83E8C20008 X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=CtFkYOsP; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="ua/v2EBV"; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf13.hostedemail.com: domain of mike.kravetz@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Rspamd-Server: rspam09 X-HE-Tag: 1668801203-706592 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: Commit 2b21624fc232 ("hugetlb: freeze allocated pages before creating hugetlb pages") changed the order page flags were cleared and set in the head page. It moved the __ClearPageReserved after __SetPageHead. However, there is a check to make sure __ClearPageReserved is never done on a head page. If CONFIG_DEBUG_VM_PGFLAGS is enabled, the following BUG will be hit when creating a hugetlb gigantic page: page dumped because: VM_BUG_ON_PAGE(1 && PageCompound(page)) ------------[ cut here ]------------ kernel BUG at include/linux/page-flags.h:500! Call Trace will differ depending on whether hugetlb page is created at boot time or run time. Make sure to __ClearPageReserved BEFORE __SetPageHead. Reported-by: Aneesh Kumar K.V Fixes: 2b21624fc232 ("hugetlb: freeze allocated pages before creating hugetlb pages") Signed-off-by: Mike Kravetz Reviewed-by: Miaohe Lin Tested-by: Tarun Sahu Acked-by: Muchun Song --- mm/hugetlb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index e48f8ef45b17..f1385c3b6c96 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1800,6 +1800,7 @@ static bool __prep_compound_gigantic_page(struct page *page, unsigned int order, /* we rely on prep_new_huge_page to set the destructor */ set_compound_order(page, order); + __ClearPageReserved(page); __SetPageHead(page); for (i = 0; i < nr_pages; i++) { p = nth_page(page, i); @@ -1816,7 +1817,8 @@ static bool __prep_compound_gigantic_page(struct page *page, unsigned int order, * on the head page when they need know if put_page() is needed * after get_user_pages(). */ - __ClearPageReserved(p); + if (i != 0) /* head page cleared above */ + __ClearPageReserved(p); /* * Subtle and very unlikely *