Message ID | 20250129224157.2046079-17-fvdl@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 DE886C0218D for <linux-mm@archiver.kernel.org>; Wed, 29 Jan 2025 22:43:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CBE002800A4; Wed, 29 Jan 2025 17:42:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C6C1628008C; Wed, 29 Jan 2025 17:42:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0E0E2800A4; Wed, 29 Jan 2025 17:42:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 91DC228008C for <linux-mm@kvack.org>; Wed, 29 Jan 2025 17:42:45 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 3EE1A140491 for <linux-mm@kvack.org>; Wed, 29 Jan 2025 22:42:45 +0000 (UTC) X-FDA: 83061965490.03.356645B Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) by imf18.hostedemail.com (Postfix) with ESMTP id 65A641C0005 for <linux-mm@kvack.org>; Wed, 29 Jan 2025 22:42:43 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=YJzKaG0q; spf=pass (imf18.hostedemail.com: domain of 34q6aZwQKCO0UkSaVddVaT.RdbaXcjm-bbZkPRZ.dgV@flex--fvdl.bounces.google.com designates 209.85.216.74 as permitted sender) smtp.mailfrom=34q6aZwQKCO0UkSaVddVaT.RdbaXcjm-bbZkPRZ.dgV@flex--fvdl.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1738190563; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+CyhHbVHq5bo9c6pVj60jCqfagJdD0XsxqtGn3cmahY=; b=BE7SWQGBd/9hh1Wn9gIsSl5KMijp8qCxazVrHltnDbPv35tlB/jmyHP/blGXqeMko4+jQE qB25Iyy6cQKW4kQ7kujuO3tuF6SGXGbj6auKuObPDE0YdlcS02+l/xpeIoS5nYlmYq51PM LzJ3AbXDDBez+ECfXDumh6mNanT3pwk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738190563; a=rsa-sha256; cv=none; b=xxcKGfPDRal6zzvtHtlwdb/8tiu0nYPIIkH+Ewam05WFArN1AFGyPAhGQXntfFLpy9Z4FK CfQ87pCtvUJa1yn3o7m/llM4f1dgxFyyk3JFutWH0CBrknb2j0zeGBjrnO4RseUKBWtjv1 /wONDD55eSa7pRWfKIixpW/Zimo1ReE= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=YJzKaG0q; spf=pass (imf18.hostedemail.com: domain of 34q6aZwQKCO0UkSaVddVaT.RdbaXcjm-bbZkPRZ.dgV@flex--fvdl.bounces.google.com designates 209.85.216.74 as permitted sender) smtp.mailfrom=34q6aZwQKCO0UkSaVddVaT.RdbaXcjm-bbZkPRZ.dgV@flex--fvdl.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-2f5538a2356so221261a91.2 for <linux-mm@kvack.org>; Wed, 29 Jan 2025 14:42:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1738190562; x=1738795362; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=+CyhHbVHq5bo9c6pVj60jCqfagJdD0XsxqtGn3cmahY=; b=YJzKaG0qQujewB1fKzsIrB2sPGwk0c8YCHekeZyh6S0T4Yh1bOlxO3wrkb70cbWDT7 aEEF1oNRc+ap0enc80y5JpIppZhJRgC5qb1iX49oVD/FMVunWpf8T8fTD/W6R7qoE6t4 AWtnUYO4nMrZ9oSiGcVhvgvoWEPMI5z9G0OcxtcjdItyX5Fnz7orAE/PDv9eEdm/qmQm rwcCqqy8/8iKReZfJ2YCqGeB222vwhE209qf779JiBjyfdoN+MDy6tJRNuUpaAcp4Hfs J2xch+wmnrAUBxUGybQItq5mg69TEaX9qUkwSQgyLBjGOE0/+H/n/t0mdmb1tH20ZRmA z8fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738190562; x=1738795362; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+CyhHbVHq5bo9c6pVj60jCqfagJdD0XsxqtGn3cmahY=; b=KTiWH+H429I1SDv5n3Rop5YhJNo11zbcheQ2o3pmNEHUYuHgteRsJcZMk6RcxomTvv dW+J5/G9sss5nucC/KISaGuDzCIynzeW/alqaLBFrQb41II82ddQp6Qv163ae7Bcferr 5d3+rVKSx8Wp5aTLCvDxBkMf4nQXVVU7QILSXta6RozcxiR7PZNayxdyjl10U3mG6m9L 1Qbsis6vBVFGANvMPPMrOWMbpPLiYWc02XSrNgU4UBsEZe6drPcPjXBCd8C46oAT+PVS HDi2BTe3/p9rtyVaHa1JBRksUyHjr43hekaiGU9qzEYw60DdpGHoCC1Od6cusVxYEnup ZuQQ== X-Forwarded-Encrypted: i=1; AJvYcCUo4+wrGlrac4j+D6TZ487MZvG85uq21mmcaXEOmQxu71IMJwmBhPLgCIV3kXpiSzJfhYIzLzC7aQ==@kvack.org X-Gm-Message-State: AOJu0Yxa1/wMpJrQttazZlPeAljUHHUqF38KY4qskO+iiH8fQiCECQgG 8s+QrJenHEcHNGkMz91CyMdhAyc1hLJIav7PtNSOG/sdcjPyuz7ItDQlDnyN0YkhqfTriQ== X-Google-Smtp-Source: AGHT+IE89jnX+A7X0+O3NBJ62H6UTgZMQLLOdEOYxcL1kGIfjMQLQgaW2k8akmMH2SlD3zsDkP21quJB X-Received: from pjbpa2.prod.google.com ([2002:a17:90b:2642:b0:2f4:3ea1:9033]) (user=fvdl job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:1f8c:b0:2ee:94d1:7a89 with SMTP id 98e67ed59e1d1-2f83ab8c371mr6910663a91.1.1738190562213; Wed, 29 Jan 2025 14:42:42 -0800 (PST) Date: Wed, 29 Jan 2025 22:41:45 +0000 In-Reply-To: <20250129224157.2046079-1-fvdl@google.com> Mime-Version: 1.0 References: <20250129224157.2046079-1-fvdl@google.com> X-Mailer: git-send-email 2.48.1.262.g85cc9f2d1e-goog Message-ID: <20250129224157.2046079-17-fvdl@google.com> Subject: [PATCH v2 16/28] mm/hugetlb: deal with multiple calls to hugetlb_bootmem_alloc From: Frank van der Linden <fvdl@google.com> To: akpm@linux-foundation.org, muchun.song@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: yuzhao@google.com, usamaarif642@gmail.com, joao.m.martins@oracle.com, roman.gushchin@linux.dev, Frank van der Linden <fvdl@google.com> Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: wihj8c6mqbxrrjm8cn7nub4psuadx66w X-Rspamd-Queue-Id: 65A641C0005 X-Rspam-User: X-Rspamd-Server: rspam06 X-HE-Tag: 1738190563-370648 X-HE-Meta: U2FsdGVkX1/YWyvEHWxpKOMIWSlVdRJsS3hs2NWiukPR2u8dlZBSUqZjdM7z9HTufqZ4DtxSNOmc4bCqsvwGk1MEhGEvEEIQMqFdovaj+7Dh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Yh904OncYKNKZQZWjMFHEsBS6R3ZE9UvwuiUhWYW3YJ+O7MZvF1V546TSZqHooPB6mhuQU5rPFYzRdpB0lboMXP4fTdkHaI5UtHMMTKgxPipgj+++QALzOI3jIEXrId8j0OG9KfvBTXu+zQryJEqIpzDH9UbKZlcrVnBgNR6DlS4sgDI42Efte56yG3JP2l9PKTe7FhkUtBUzdNmmNLMm5MlIj670KwuC7KUJswSRb4nJtORII1u2giq6hoGvAezTBDmf0MCUj/lWi5wMXx5e14bCpK7UkOz6H5c6Z8Ky5JcvwDYjFgpd8R7pr3co8YTHMpyi0DfUDMRVQhaW2Aked86dpnmiaIhWglZzKUzVzq 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
hugetlb/CMA improvements for large systems
|
expand
|
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 9cd7c9dacb88..5061279e5f73 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -175,6 +175,7 @@ extern int sysctl_hugetlb_shm_group; extern struct list_head huge_boot_pages[MAX_NUMNODES]; void hugetlb_bootmem_alloc(void); +bool hugetlb_bootmem_allocated(void); /* arch callbacks */ @@ -1256,6 +1257,11 @@ static inline bool hugetlbfs_pagecache_present( static inline void hugetlb_bootmem_alloc(void) { } + +static inline bool hugetlb_bootmem_allocated(void) +{ + return false; +} #endif /* CONFIG_HUGETLB_PAGE */ static inline spinlock_t *huge_pte_lock(struct hstate *h, diff --git a/mm/hugetlb.c b/mm/hugetlb.c index a0a87d1a8569..0a27659d9290 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -4911,16 +4911,28 @@ static int __init default_hugepagesz_setup(char *s) } hugetlb_early_param("default_hugepagesz", default_hugepagesz_setup); +static bool __hugetlb_bootmem_allocated __initdata; + +bool __init hugetlb_bootmem_allocated(void) +{ + return __hugetlb_bootmem_allocated; +} + void __init hugetlb_bootmem_alloc(void) { struct hstate *h; + if (__hugetlb_bootmem_allocated) + return; + hugetlb_parse_params(); for_each_hstate(h) { if (hstate_is_gigantic(h)) hugetlb_hstate_alloc_pages(h); } + + __hugetlb_bootmem_allocated = true; } static unsigned int allowed_mems_nr(struct hstate *h)
Architectures that want pre-HVO of hugetlb vmemmap pages will need to call hugetlb_bootmem_alloc from an earlier spot in boot (before sparse_init). To facilitate some architectures doing this, protect hugetlb_bootmem_alloc against multiple calls. Also provide a helper function to check if it's been called, so that the early HVO code, to be added later, can see if there is anything to do. Signed-off-by: Frank van der Linden <fvdl@google.com> --- include/linux/hugetlb.h | 6 ++++++ mm/hugetlb.c | 12 ++++++++++++ 2 files changed, 18 insertions(+)