From patchwork Thu Feb 15 04:34:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 201243 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp166338dyb; Wed, 14 Feb 2024 20:34:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW0yDoNa4FUoL7Tbpc8l/DNVp5V+a2urVCtYtpdgwUaqcx65UGbQeIkJZqd65ivQGf5B/kfSVdEwe9Yhzdz87usTsvbbw== X-Google-Smtp-Source: AGHT+IFzzcDODdwuOMHyQBxVfkLcJtmdyZ0rzHV7bcHsbWAsONZlNUwf4c5WJwDhEp3pyB81of2k X-Received: by 2002:a17:906:5a8a:b0:a3d:6198:54ae with SMTP id l10-20020a1709065a8a00b00a3d619854aemr317634ejq.48.1707971672253; Wed, 14 Feb 2024 20:34:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707971672; cv=pass; d=google.com; s=arc-20160816; b=gUsv1Cgm2vvdq5vuowaqbJonG/cM72SWulVAlP9zhOeQ1108fK8QTnt8dkextPvTBS qg+2XkKSqsfNduz8aU/4ifO6CgH2Y8lKVq7+ekYVfc80f3TWW+yvPEPH8D5U9Llgg1S1 pqtVbauge914ITGp4nIzWnCUCYiLnYxYBbwADb+fZ0xpVVtSM2skEoDtXfWpixVnG/sO 48TpExDCmzHdmRcmsXzwubmW4OFDyT7geM4XPnnkXq/0ex6Foneym481h4elBQye8P+G 4iI6LOsacfVyuKhtskRJSEWAVdcWZUlYlLUdTI9VCgoFMx6ItDHKvx9asG5D0oACZZzO lTbg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=Wlb7EIrQcu+/ajrtKELDL96BSemy2YjP3iB0ItcdYP4=; fh=lTflcwQt6vmMnphNnk4jGBp/CGAJCOKARyrh6O9pt3Q=; b=YCZ87k/54+x1vjYndHE9pSqjppqB2xEOJrhKr1HA52SslGhOmoYt5CoB01XDHilH27 wBtXPJ5m8XaDPd38Fx48jLENRi+dCjEiQ+HNBhcNNdtBqms6MXW4liJzL1XOiys4OCmQ hZv6Cv6VZ7DnWBQ3ePb7z96Zlvm+tBytsvWDtI/nfeO0A8lODkcBbneTzxu2yMJ+8zJK +6IGgVWuVHzR+mf9TmVSKbdNExsMUJ4oR5C7rZEqvpXMBAPvOVRzIdYlw/VEqUH7pc5N jK8MqJTyJyl/j8ZoBNG4cdQcgbtQ59diqNILt3vnlxbdpD5JY1WF6Lal2BIqpm+++Ln5 XECQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-66293-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66293-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id qk28-20020a170906d9dc00b00a3d5815ca8asi255686ejb.258.2024.02.14.20.34.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 20:34:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66293-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-66293-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66293-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D66F41F29760 for ; Thu, 15 Feb 2024 04:34:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5AFE28F61; Thu, 15 Feb 2024 04:34:18 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 321F1625 for ; Thu, 15 Feb 2024 04:34:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707971656; cv=none; b=n4Gyj2uCoroxxhfCP7rffFkTMWMzz2bAd+WrygjSMUlHI/8wQOefYlMEiFI9+SxtAThsktf6MeRDbb66j6NmGk3Ohkdp0v+TJZFyF/sQ5XHGXDXEoe6ghxRRWRdDwkfE/kgZY1PNQ9qtE/wI8hgHpvz99FJjDScfRVUbaD3IHV8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707971656; c=relaxed/simple; bh=XX6T+2qLJ1at+tCtwel54WNzbhu3rUFHduoOdIcabBo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=JDV5A1aqBY/gqJRnkYBS23OdKRBgAKBzIRI8ncIiGu/AChJzHsgtFkDXJknPMNOrEyy9cf5JNg9ZDk9r3g70J5DTq3+5g6KPTQ69vwrfrj0br4yK0ZgIP0khdzGEnwXA9AbVEbbYmYGLCYK2eTxvK3ORc45cR5EQro8iaiTDVgw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 06E2A1FB; Wed, 14 Feb 2024 20:34:53 -0800 (PST) Received: from a077893.arm.com (unknown [10.163.45.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 201CE3F7B4; Wed, 14 Feb 2024 20:34:09 -0800 (PST) From: Anshuman Khandual To: linux-mm@kvack.org Cc: Anshuman Khandual , Muchun Song , Andrew Morton , linux-kernel@vger.kernel.org Subject: [PATCH V2] mm/hugetlb: Ensure adequate CMA areas available for hugetlb_cma[] Date: Thu, 15 Feb 2024 10:04:05 +0530 Message-Id: <20240215043405.2379295-1-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790938104196311301 X-GMAIL-MSGID: 1790938104196311301 HugeTLB CMA area array is being created for possible MAX_NUMNODES without ensuring corresponding MAX_CMA_AREAS support in CMA. This fails the build 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 patch applies on v6.8-rc4 Changes in V2: - Replaced VM_WARN_ON() with BUILD_BUG_ON() per Andrew Changes in V1: https://lore.kernel.org/all/20240209065036.1412670-1-anshuman.khandual@arm.com/ mm/hugetlb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index ed1581b670d4..30dc02e19616 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -7743,6 +7743,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. + */ + BUILD_BUG_ON(MAX_CMA_AREAS < MAX_NUMNODES); for_each_online_node(nid) { int res; char name[CMA_MAX_NAME];