Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2218731rdb; Sun, 11 Feb 2024 18:07:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXyQxmQn4KPKFzuHKwaUFkVQv3MnreUQ9K7Neyr+lG9c+TeMuwEA5f4f27t9zWdkb5G5/6Bw17gfEs7O30u2SuoVEItUoAY2eRcnQ6aXA== X-Google-Smtp-Source: AGHT+IFU2qeu5PMtOUpCdJ7V1ZBk/aB8RAQmsRQ+1/mWDTH7ODx9Aq3nd1nKuoPCS5ZOh7w0TBWr X-Received: by 2002:a17:906:ce2b:b0:a3c:436d:5813 with SMTP id sd11-20020a170906ce2b00b00a3c436d5813mr2999203ejb.25.1707703634307; Sun, 11 Feb 2024 18:07:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707703634; cv=pass; d=google.com; s=arc-20160816; b=ru5MwpVLDDepnexdrznEjHy6VinZplCQFFQHq5DizktcsoXzLWcDFFuonE1JrovKIp c5RxjVaVv9WrU/WQU26qfIrFghPhwxRuxfokkol+cBPjpxQLGEQ/gfUJGya/DmcGPIEv /tClLKUPFL3x943MN1HwphrUPGyHTl+lmuyJ85Y+/yI6d84BTgUNSoIjGUXToBcMcdPx crvn9I34EdoY1vwywstDBzYI2OSO3aqosrGxF9Lk67J6qZxyS0n9hubHCr9LOGfLGcCP 4lwfKUIl4SmruC+A0ZyuEcuzvNqTDCXUmNB8u+8bnzoA3iBINwxV2fyDaocFgV9SDzQf KSrQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=q9VC+jysHWb4ROuUk6l0Vf5RblxE4afMpSdbrGxgoz0=; fh=VQR+8GPoquAnMuoPi2UrugvF94PB+y2x1XAY3AQ/fX4=; b=Wl6mLBxXmttIal2KRHzchRz9aKIozwg8bolKaj5hYoQBCsu07qWfmD2QgAkuaLS0Pc bow13x0OIMPSbrKdb/IpyYh2QiLhpLEqV0ReVsszXHZWzJT/jHcLvglI6LUkNA6I1Xpa Uos8qQr4CiG2Hu1y7FEKZ4fT89l/XNev/+w3G5knBjuKI/IVv7P5wOnENyoBWTm0WIdW G5RbPgb9C1s7tZlN9jEjgS+JecX4QyKu6zRLbb7EBchRP91/MPToZJ315Xp7DiRJ1Eph kc5cSObluBhOy82MaNpgIMzeElaBMQdhaXRKzjPtd6prIR5VAjOD3CJdR4EKiHVK8HcV WIQg==; 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-61064-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61064-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com X-Forwarded-Encrypted: i=2; AJvYcCXrZnUGdS2NhLdJyY7+4PgLEPxEpFlbXMEVr317knMbnJuryNvwNXYj8lXwzMLraTU/hqepheUHGBB4U3Cxvtim19RVoHiiBn/iskhOsw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id hg22-20020a170906f35600b00a37b2447d5esi3282716ejb.807.2024.02.11.18.07.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 18:07:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61064-linux.lists.archive=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-61064-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61064-linux.lists.archive=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 127761F22257 for ; Mon, 12 Feb 2024 02:07:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B9EC44C86; Mon, 12 Feb 2024 02:07:05 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 411A0468D for ; Mon, 12 Feb 2024 02:07:01 +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=1707703625; cv=none; b=Awvs+m3yXhvgEiShi1vPrp8ys5+SlbWt+z++gLlu+U6T5ul6D3sEA1MSwBhH/mcPt3b3WL/MmqDb5jt4eYwDMbYa38Xuqe8J3fmdDbxWXuxuew+aO+yW2q+aW/2YxWldp1m5wpUpDIo+oVrs+TUUixonDvfnttQdKrOkmVChgz4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707703625; c=relaxed/simple; bh=74BKNfXB75ckP4L/HFKnSrg26cu46GQbna7/Kj1r80U=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=lxVzxnmXpMrIRhvI3SCLIOmFtxr5I/aa2TZpe2eNwshCTCMXTWtWFko5A+6XKOtaJuERQ0w3t3FoUl2K3k61yfl6QqYWH65/Lv9RH7t43kwm+DJJ6trMTnXLFSBbvop/8OBpSElDvymxEhHhpTMJURKVTXytthlt6eS8W81/kBk= 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 6CB6DDA7; Sun, 11 Feb 2024 18:07:42 -0800 (PST) Received: from [10.162.40.23] (unknown [10.162.40.23]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B76123F762; Sun, 11 Feb 2024 18:06:59 -0800 (PST) Message-ID: <559e213a-bd39-4799-8899-c8689e09a01b@arm.com> Date: Mon, 12 Feb 2024 07:36:56 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Anshuman Khandual Subject: Re: [PATCH] mm/hugetlb: Ensure adequate CMA areas available for hugetlb_cma[] To: Andrew Morton Cc: linux-mm@kvack.org, Muchun Song , linux-kernel@vger.kernel.org References: <20240209065036.1412670-1-anshuman.khandual@arm.com> <20240209141637.129e417747ef130255db620d@linux-foundation.org> Content-Language: en-US In-Reply-To: <20240209141637.129e417747ef130255db620d@linux-foundation.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2/10/24 03:46, Andrew Morton wrote: > On Fri, 9 Feb 2024 12:20:36 +0530 Anshuman Khandual wrote: > >> 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. >> >> ... >> >> --- 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); > > Could this simply be fixed up in Kconfig logic? CMA_AREAS should default as (1 << NODES_SHIFT) ? But the system admin might want to create more heap areas for other purposes as well. The idea here is to ensure MAX_CMA_AREAS is at least MAX_NUMNODES if HugeTLB support is enabled. Do we have some other methods ? > > And I think this could be detected at compile-time? BUILD_BUG_ON()? Right, was thinking about this at first. Makes sense, will change here, seems to be the right location for a build check as well. > >> for_each_online_node(nid) { >> int res; >> char name[CMA_MAX_NAME]; >> -- >> 2.25.1 >