From patchwork Fri Feb 9 06:50:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 13550915 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 46365C48297 for ; Fri, 9 Feb 2024 06:50:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BB2386B0074; Fri, 9 Feb 2024 01:50:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B62B56B0075; Fri, 9 Feb 2024 01:50:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A50E96B0078; Fri, 9 Feb 2024 01:50:48 -0500 (EST) 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 96EC36B0074 for ; Fri, 9 Feb 2024 01:50:48 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 21F7B805A6 for ; Fri, 9 Feb 2024 06:50:48 +0000 (UTC) X-FDA: 81771342576.06.790AA27 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf02.hostedemail.com (Postfix) with ESMTP id A7FF380013 for ; Fri, 9 Feb 2024 06:50:45 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf02.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707461446; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references; bh=GCziuqDE8u8LX46zco6rNwc1eggkJNtE0zqJW/UXBHo=; b=i0K3O3eZLinvVuH9HS2gOQo59YAFFps74xERpN4yGm1c6121ZduwAWCu8GMZblP18sWYLT ot80g398dg6TG1TZA6ugNQWKqFOOPJAcnsSAy+57CoyDbNHYxC+/fJej/6Hkmws9NRDPr+ bENZcmHh9hrckzzJEI9TnCFxblqeMuM= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf02.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707461446; a=rsa-sha256; cv=none; b=jQXcGnSAYrmKP0oMaOQ1LZ97I8xS6VW2ghsHcraIqd1MT3Ws05SdWfBpA5yyW17nBM6v2J /DHYOiU4zg4pZsAROMcU1zYifx/mnLRVRD0kB0HBMWXJTSMC7CczjZRQtcg8FiC5Wa0YR3 i5hM6pyNZp81pwvgd1y7rcILQElOHgI= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B027CDA7; Thu, 8 Feb 2024 22:51:26 -0800 (PST) Received: from a077893.blr.arm.com (a077893.blr.arm.com [10.162.40.23]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5D4F93F762; Thu, 8 Feb 2024 22:50:42 -0800 (PST) From: Anshuman Khandual To: linux-mm@kvack.org Cc: Anshuman Khandual , Muchun Song , Andrew Morton , linux-kernel@vger.kernel.org Subject: [PATCH] mm/hugetlb: Ensure adequate CMA areas available for hugetlb_cma[] Date: Fri, 9 Feb 2024 12:20:36 +0530 Message-Id: <20240209065036.1412670-1-anshuman.khandual@arm.com> X-Mailer: git-send-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an1LgcI+26Snuc7dDR1/6NuY+3eXpwCucbCczXt6UMiC6lNhFDyISi 8kEjWYjj xgoCtWmS+70Gs7UbDGVeyx9Ld6RKSOyGJo0CiyMtp6rgYmRSyX1OhzkWYfihhUgL0/v8Fem3Y+4hdZBe+9kd4I5TOSy447c5hFqwAkUzH02m82b/wIKi8X2orrVMtZAC/J04AvNnaIxWrWS6Uhm15kxarP0R5UsB07/r79P8UaNNnkrrRgTIgKnixviccDLRPA9OaeerX53S3ojPJgwaUxK7jZYXFj3mdatRQRV3B12tCLpSR49p83YkueDwBMUdfIZcbEX9KXs4BrSBgiayl3kqaMA5K7QYAU2/ByCdCpsM7BlNnRWs3wKOk9/JH5i9zChi8Tz327WcUHkPSkDR73U0RCpUuKkZPw79gzThacrijq4Vw2d8Cd31c5GXjVgo3+/Oa 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: HugeTLB CMA area array is being created for possible MAX_NUMNODES without ensuring corresponding MAX_CMA_AREAS support in CMA. Let's just warn for such scenarios indicating need for CONFIG_CMA_AREAS adjustment. Cc: Muchun Song Cc: Andrew Morton Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- This applies on v6.8-rc3 mm/hugetlb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index a188b7c60f4f..fda8ced69832 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -7750,6 +7750,13 @@ void __init hugetlb_cma_reserve(int order) } reserved = 0; + + /* + * There needs to be enough MAX_CMA_AREAS to accommodate + * MAX_NUMNODES heap areas being created here. Otherwise + * adjust CONFIG_CMA_AREAS as required. + */ + VM_WARN_ON(MAX_CMA_AREAS < MAX_NUMNODES); for_each_online_node(nid) { int res; char name[CMA_MAX_NAME];