Message ID | 20240215043405.2379295-1-anshuman.khandual@arm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-66293-ouuuleilei=gmail.com@vger.kernel.org> 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 <ouuuleilei@gmail.com> (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 <ouuuleilei@gmail.com>; 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 <linux-kernel@vger.kernel.org>; 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 <anshuman.khandual@arm.com> To: linux-mm@kvack.org Cc: Anshuman Khandual <anshuman.khandual@arm.com>, Muchun Song <muchun.song@linux.dev>, Andrew Morton <akpm@linux-foundation.org>, 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: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790938104196311301 X-GMAIL-MSGID: 1790938104196311301 |
Series |
[V2] mm/hugetlb: Ensure adequate CMA areas available for hugetlb_cma[]
|
|
Commit Message
Anshuman Khandual
Feb. 15, 2024, 4:34 a.m. UTC
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 <muchun.song@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
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(+)
Comments
On Thu, 15 Feb 2024 10:04:05 +0530 Anshuman Khandual <anshuman.khandual@arm.com> wrote: > 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. > > ... > > --- 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; This blew up my x86_64 allmodconfig build. I didn't check whether this is because x86_64 kconfig is broken or because the test is bogus. I won't be releasing a kernel which fails x86_64 allmodconfig. So before adding a new assertion can we please first make a best effort to implement the fixes which are required to prevent the new assertion from triggering?
On 2/16/24 06:52, Andrew Morton wrote: > On Thu, 15 Feb 2024 10:04:05 +0530 Anshuman Khandual <anshuman.khandual@arm.com> wrote: > >> 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. >> >> ... >> >> --- 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; > > This blew up my x86_64 allmodconfig build. I didn't check whether this > is because x86_64 kconfig is broken or because the test is bogus. > > I won't be releasing a kernel which fails x86_64 allmodconfig. Okay, understood. > > So before adding a new assertion can we please first make a best effort > to implement the fixes which are required to prevent the new assertion > from triggering? Even after applying the previous patch regarding MAX_CMA_AREAS (below), the build still fails on "x86_64 allmodconfig". https://lore.kernel.org/all/20240205051929.298559-1-anshuman.khandual@arm.com/ As defined in arch/x86/Kconfig config NODES_SHIFT int "Maximum NUMA Nodes (as a power of 2)" if !MAXSMP range 1 10 default "10" if MAXSMP default "6" if X86_64 default "3" depends on NUMA help Specify the maximum number of NUMA Nodes available on the target system. Increases memory reserved to accommodate various tables. So with MAXSMP enabled, NODES_SHIFT = 10 and MAX_NUMNODES = 1024 (1 << 10). Incrementing CONFIG_CMA_AREAS appropriately solves the current problem i.e CONFIG_CMA_AREAS = 1024 causes the build to pass. config CMA_AREAS int "Maximum count of the CMA areas" depends on CMA default 20 if NUMA default 8 help CMA allows to create CMA areas for particular purpose, mainly, used as device private area. This parameter sets the maximum number of CMA area in the system. If unsure, leave the default value "8" in UMA and "20" in NUMA. Current default for CMA_AREAS is just 20 with NUMA enabled, hence wondering should CMA_AREAS be defaulted to 1024 but that does not seem feasible for smaller systems or find some x86 specific solutions. Please let me know if there are any suggestions.
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];