Message ID | 20250127232207.3888640-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 A019CC02188 for <linux-mm@archiver.kernel.org>; Mon, 27 Jan 2025 23:23:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 464722801C6; Mon, 27 Jan 2025 18:22:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4155728013A; Mon, 27 Jan 2025 18:22:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 28EF22801C6; Mon, 27 Jan 2025 18:22:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id F027028013A for <linux-mm@kvack.org>; Mon, 27 Jan 2025 18:22:52 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id A6FF8471FA for <linux-mm@kvack.org>; Mon, 27 Jan 2025 23:22:52 +0000 (UTC) X-FDA: 83054808984.26.A7E63C5 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) by imf08.hostedemail.com (Postfix) with ESMTP id D21AB16000E for <linux-mm@kvack.org>; Mon, 27 Jan 2025 23:22:50 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="Yl2wg/Em"; spf=pass (imf08.hostedemail.com: domain of 3SRWYZwQKCBg3J194CC492.0CA96BIL-AA8Jy08.CF4@flex--fvdl.bounces.google.com designates 209.85.216.73 as permitted sender) smtp.mailfrom=3SRWYZwQKCBg3J194CC492.0CA96BIL-AA8Jy08.CF4@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=1738020170; 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=yQdEXb7VrREiqENOyRwQSlPqHVu4TlSVRGhdtKj9UPA=; b=35j+SHE09J/jwNeudwDSHyaAgGzvYbN6Eb4jV+PL2jK4481r7F4L+2dkRpGpe98ZgvGbsY 2sK+Qkh//918IV2QFcEHYuB1RJ2maErTcu1qHxYXtAcWd43Be1JR6ejEpG9uWGDaVt9cqC jlrYVKMfRajRNYEmJMXNg0SVDx/j9fM= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="Yl2wg/Em"; spf=pass (imf08.hostedemail.com: domain of 3SRWYZwQKCBg3J194CC492.0CA96BIL-AA8Jy08.CF4@flex--fvdl.bounces.google.com designates 209.85.216.73 as permitted sender) smtp.mailfrom=3SRWYZwQKCBg3J194CC492.0CA96BIL-AA8Jy08.CF4@flex--fvdl.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738020170; a=rsa-sha256; cv=none; b=p7gGsXjSvD4CXXWGlaeDbwV5fqJxPOtifF0DidK2QKiWIs0QijwN9+TkKRcPrPYGfGY8D7 PxJr5EJIyaTrdihjOHrIsF0XHeqUbD9bq/eO8TI5+X1fJlm2uBbMFnwszSmsRQOueFGWfL 75T9D0cbLgmL6RM3GG0XEP+P9DFCClY= Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-2ee5616e986so13984334a91.2 for <linux-mm@kvack.org>; Mon, 27 Jan 2025 15:22:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1738020170; x=1738624970; 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=yQdEXb7VrREiqENOyRwQSlPqHVu4TlSVRGhdtKj9UPA=; b=Yl2wg/EmW1inl+xTuCa63xa6Xui6J7YJ45HW01oGWcmZUiWa5n0hjjZaVpoHsofogy 2DK72nEcsofdDCMl/4zib6AFDsR8HAJs/1pI26QXQyDRlBEW7Q7ENSSqGL43gNYVIvU2 p+cS5inau2zdjWrp01f5mIvw+lB4Enu6oWVKdcRKfQs7Shn4KwKwHsokoDikgSy0iNaF a1T2DABdz/064v+BzA45CONmDmJrZDntAB+qsoKSWXZWBr2L2X3gNCGKYxYfWEqPTDS/ c3LF+BCnXs9wL9UZPE0uiYfGDBCPTc5ID3AWQT7/D/3ngoHK3WOpn21HYVcsLHVth8s3 NBiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738020170; x=1738624970; 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=yQdEXb7VrREiqENOyRwQSlPqHVu4TlSVRGhdtKj9UPA=; b=Ry4LTh8cZpotYjvGUPv3qjglqyX5PvbUE5P7cqE6Ou8Tmoi8ockxJZxveP5qxAjn/P W1UnMZfckPHDSeVwjOWPvf+eBupACEWbWfbbzUIjK3D0pslP93fZtQj0+fuqV9F0gIn7 91GBs83ckxqejDLxC98zY0HlOx2j4O4tg6ckQtnd4a/l18EU/6RkP6BCIaajMZwJlmXA WeqTcQkQJ3kvcOwAHRzUXFT32vEkJg6mCTZFvC9J5XN/fWuSCiV2igw8tWeJBIEw7di5 OVHDFsfxkQjcGOTedl1lTrWUaNUg3fRf/HEzJYzFzhruKVHOo2p44geEREuEzAxZJ+YP j7Bw== X-Forwarded-Encrypted: i=1; AJvYcCUddv5u7ZBoBwGuIIWkBLMd0il61aoRi3wwBIEYVQLFqv4uEsJzeBhT4pns90U5AS6i2+fvEfiwHw==@kvack.org X-Gm-Message-State: AOJu0YxQSlnzX5K8mpjXxwVkXvrErI6+Tf50s7TKHz7PubULNacRq13G Or2IqhHSWoiWYc1K7b3qrC/fAm7bH79Qifxi1UjtZNWXRB24yMLXqkf//RbEgPalkbSoMA== X-Google-Smtp-Source: AGHT+IGOxA/LjCFXYDhUCJvwKiwBW39Jv15WSyjwI6Z7bApcIx6+wrwzNjIWdbWHTiCawWQ9bGPb1PBa X-Received: from pfbds10.prod.google.com ([2002:a05:6a00:4aca:b0:725:ceac:b484]) (user=fvdl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:2917:b0:71e:13ac:d835 with SMTP id d2e1a72fcca58-72dafa442bdmr62065805b3a.11.1738020169612; Mon, 27 Jan 2025 15:22:49 -0800 (PST) Date: Mon, 27 Jan 2025 23:21:56 +0000 In-Reply-To: <20250127232207.3888640-1-fvdl@google.com> Mime-Version: 1.0 References: <20250127232207.3888640-1-fvdl@google.com> X-Mailer: git-send-email 2.48.1.262.g85cc9f2d1e-goog Message-ID: <20250127232207.3888640-17-fvdl@google.com> Subject: [PATCH 16/27] 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, usama.arif@bytedance.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-Rspamd-Queue-Id: D21AB16000E X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: uj14jeaybnt5f7tdqcjsf9kj5bfesgps X-HE-Tag: 1738020170-253258 X-HE-Meta: U2FsdGVkX1/2Ta8tsHH/hEbyIrJ4LvpHqo/XIsAuabouxfBh4IFztYYCxmveBfTD1JlmF4c/acUeQAx9hsQszL8au/X88rZ0a7kVvMP+FJSdHefYj2CRv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jjQk+FnOlBj0ChP21e0JC7YUWF7GACSV1cFicV8l8Wpp4rG8y7Smo4n2Ln3+mvuF3/3wsyND7K31/Pz+Ku8nHHZGSfqKyXZvK9buzy/qOgoDVTrLycb1rGr0ErhdI6z5mD3jXxgbRAfOLyHKzr9juXQ3XPQH/ZbMANIO9N9eI5uhfRf2Sfk7ir64Wpl6Xj+55ZZ3baEql4GBNJL1+87CfkrUR0408nLgUhjrpP9wHd9pybQe8FSuysCpI1lpd43F8E/s+JkM6gSPwkMiAY74kPjIR+IpE4XrhpCohrDg0SDk+o15KimnXxf7uXzUlywcbSm/gFDo4V6eRK5hpB7WCBZb2edPuPThZYFiqpDbgc7RyW+bvzp6f5q6dEC5glUwCzHPX6U= 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 a4d29a4f3efe..18cd232b5df2 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(+)