From patchwork Thu Apr 4 16:25:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank van der Linden X-Patchwork-Id: 13618053 Return-Path: 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 B1AFBCD1284 for ; Thu, 4 Apr 2024 16:25:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 47D826B009E; Thu, 4 Apr 2024 12:25:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 430016B00A0; Thu, 4 Apr 2024 12:25:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 31C066B00A1; Thu, 4 Apr 2024 12:25:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 0FFF36B009E for ; Thu, 4 Apr 2024 12:25:31 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 806681A0588 for ; Thu, 4 Apr 2024 16:25:30 +0000 (UTC) X-FDA: 81972374820.16.D3B36E4 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) by imf01.hostedemail.com (Postfix) with ESMTP id A47A540027 for ; Thu, 4 Apr 2024 16:25:28 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=XUJEwpyF; spf=pass (imf01.hostedemail.com: domain of 3d9QOZgQKCJI1Hz72AA270.yA8749GJ-886Hwy6.AD2@flex--fvdl.bounces.google.com designates 209.85.216.73 as permitted sender) smtp.mailfrom=3d9QOZgQKCJI1Hz72AA270.yA8749GJ-886Hwy6.AD2@flex--fvdl.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712247928; a=rsa-sha256; cv=none; b=7go81xz+iiERjkylSnkz/n6cPgILVvzZBgSLmAcNCi129ARDjg77cbxqSiwruyX751jif8 3YDfF/8YmnaKsqFTjfZIQ3YYVtbjMRNdxdmsdc1YRxS/NBGUa6c/LJdLR9A14gzVSIH2cd 8R74UhTrU3kXgeGYAXOtMs0sUgcah8M= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=XUJEwpyF; spf=pass (imf01.hostedemail.com: domain of 3d9QOZgQKCJI1Hz72AA270.yA8749GJ-886Hwy6.AD2@flex--fvdl.bounces.google.com designates 209.85.216.73 as permitted sender) smtp.mailfrom=3d9QOZgQKCJI1Hz72AA270.yA8749GJ-886Hwy6.AD2@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=1712247928; 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=oHGbNzitA9ppM5Ku65CkqnyMFJ83UqBlfpZsb+skPp4=; b=WH8kY+y95addTGtMJZbLthpkpmx4TquwJ9tXwJa5m7ZwM568URK/FlEL20pTn3Z7S1/5BP Be24XkTqewdDn38EbhV4XMeZ/lKjSOEzv8OHg/EZyihDW3t3d46tHkJUbeyzJDw/tnnMfF LwANYt4CYkAZXXRHazNxu1J81nXWLUs= Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-2a2f7048a7fso263966a91.2 for ; Thu, 04 Apr 2024 09:25:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712247927; x=1712852727; 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=oHGbNzitA9ppM5Ku65CkqnyMFJ83UqBlfpZsb+skPp4=; b=XUJEwpyF3bVGULauZda1VVWasHYGCed9bg2x0WyVjYGB2V8xxOSDqf7AQBDgf8TObH DfasaVWy2RDLH2Xk5lSnZVZ9m/6yAQU/rP1Uobco52OwkEtbH6SK6CFqS+92mdCMmwUw 8KwEw5L0vKsZz4x1HWzGTFxdCcSlE7d+G3uu4iGKnYaogULew2co0elZYDMN9Q8nFo7t zOZn+bc2bg1sVEDizNqdCmakkR4lxcIzb3Y99E/AAsIpa8CWG9hHWOFFp1IrmFxljsie XOoghojpy0goLFVoR6TIDAtl2YEJCIgsctkYKe4mY62qF+QpvrCiQotMlBGGSYDsv7dw zEYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712247927; x=1712852727; 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=oHGbNzitA9ppM5Ku65CkqnyMFJ83UqBlfpZsb+skPp4=; b=PGN+IgDwSDp356G1MS5f9tAhmFxUEYLrysTQseMntnjVsUpncPqo7M7gBHBbjEjafP vPMH/cSu8ZY40nop4ZMUltDSMp8iRDF5CnA/TI2FTzUfrci8tLVAogPugRMOuD3S5cYE b0jYP6NBwqd2UURmVnWLRpBnFPjmT+mBK7bTu2EvihgsDhrYoPupl6ndGeJBd0704WaJ BIXSATk7Ah8lbgs+ZVSQVRw7pGq2tpDYM9z1QVfPO5575ERamjNCgqf1RTjVLw6400rR qkTLr1DVZWIKP/oprgcfeSFAhhiN147OZl4aMkkjvSZ8RNiWonNOpAGXvII9wtJ7Npko kp6g== X-Gm-Message-State: AOJu0YwPNgUa2v8mzd/L2Sxu93sjYP7wN9Gj4UKENCt2GgLSn6TLfGaE ukyccFNG9DDBhGPR2TUA5Vmml8y4JhRoXOI1oxMHth00PXR6eiPRlSHPTGQ44/wSeCG3Boc8x0c 3tDuowHk3PYmPrAb4RipPIabzNIQ7oDlBOJ+2Heq8SFIeAQs2aKQvHxrJ7z2hw2hPYpbC2Wnztd 3igqiuu/UZKWWKBoUy X-Google-Smtp-Source: AGHT+IGXnTdJEgMY2tAcjsPsMJtWw5f7/a3l2Iy2vxpUruJLqcHR32OpW+y0OGvqY2PVU1UyXbfKojhA X-Received: from fvdl-cloudtop.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:46ab]) (user=fvdl job=sendgmr) by 2002:a17:90a:6d64:b0:2a2:1014:58be with SMTP id z91-20020a17090a6d6400b002a2101458bemr363pjj.7.1712247927255; Thu, 04 Apr 2024 09:25:27 -0700 (PDT) Date: Thu, 4 Apr 2024 16:25:15 +0000 In-Reply-To: <20240404162515.527802-1-fvdl@google.com> Mime-Version: 1.0 References: <20240404162515.527802-1-fvdl@google.com> X-Mailer: git-send-email 2.44.0.478.gd926399ef9-goog Message-ID: <20240404162515.527802-2-fvdl@google.com> Subject: [PATCH 2/2] mm/hugetlb: pass correct order_per_bit to cma_declare_contiguous_nid From: Frank van der Linden To: linux-mm@kvack.org, muchun.song@linux.dev, akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, Frank van der Linden , Roman Gushchin X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: A47A540027 X-Stat-Signature: 6huztbk9unegswkwci8zf4xoxqj1e8d6 X-Rspam-User: X-HE-Tag: 1712247928-859681 X-HE-Meta: U2FsdGVkX1+bX/sdD6RJ7CpWoc55UujR/gmERhn7TxqOr0Kc+4NDpt2KPCsXZ3RKvSDbpdOkXDR/pmeR+yUAsjSSw5LX4iOXS55ZvBlImgL9pUHnDIeYsuY5FmCq+RQroT4e9cDphn/W8eccHM0I3nPQN9Ob/Zte3Gz7Jq/zMPRK6N01yDMiEm9Objz/D7k+ytFWNCJTwJVVc+8184IgqtPDTRAe5UBpbIyAJbqvODMREFx99PKINQ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ZGopaACgLXEU5lba9kL0pPq260+R7DZdutrgrOLXI7JcvMY7gM/UrAOjNGIbY2udvBWZOHdoaAKyHt/hhbOwokVOemXRGjvKUPjWYyPA/A2Qe8DHA1w1rLzfo8EF5DiIFgP7HFfAYFJeKuAkPaCtGH6EFvm9w2eIQ2K+nZOuDR0JxnEbWjJCEwR/AsC2orhjej/nMnXHCtFhkSLjLpJlI3I6xCMbtnGaOzvjmlOvENGu6AZcNk7ySKf5O4DlMcEcoIqHBq0tKCxbDZXMMf9Ltvu8ArHhG/1CcGs12N/TmcCFe1Av8K1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000014, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The hugetlb_cma code passes 0 in the order_per_bit argument to cma_declare_contiguous_nid (the alignment, computed using the page order, is correctly passed in). This causes a bit in the cma allocation bitmap to always represent a 4k page, making the bitmaps potentially very large, and slower. So, correctly pass in the order instead. Signed-off-by: Frank van der Linden Cc: Roman Gushchin Fixes: cf11e85fc08c ("mm: hugetlb: optionally allocate gigantic hugepages using cma") Acked-by: Roman Gushchin Acked-by: David Hildenbrand --- mm/hugetlb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 23ef240ba48a..6dc62d8b2a3a 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -7873,9 +7873,9 @@ void __init hugetlb_cma_reserve(int order) * huge page demotion. */ res = cma_declare_contiguous_nid(0, size, 0, - PAGE_SIZE << HUGETLB_PAGE_ORDER, - 0, false, name, - &hugetlb_cma[nid], nid); + PAGE_SIZE << HUGETLB_PAGE_ORDER, + HUGETLB_PAGE_ORDER, false, name, + &hugetlb_cma[nid], nid); if (res) { pr_warn("hugetlb_cma: reservation failed: err %d, node %d", res, nid);