From patchwork Fri Apr 5 12:24:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13618998 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 994A2C67861 for ; Fri, 5 Apr 2024 12:24:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 147FC6B016E; Fri, 5 Apr 2024 08:24:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F8416B016F; Fri, 5 Apr 2024 08:24:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F28966B0170; Fri, 5 Apr 2024 08:24:32 -0400 (EDT) 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 D6BCF6B016E for ; Fri, 5 Apr 2024 08:24:32 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 7592EA116D for ; Fri, 5 Apr 2024 12:24:32 +0000 (UTC) X-FDA: 81975396384.15.4F83ACA Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) by imf03.hostedemail.com (Postfix) with ESMTP id 0B0E82000E for ; Fri, 5 Apr 2024 12:24:28 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=pNYw5Nim; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf03.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.113 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712319870; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=Xgh9CRUBvGZe+XyUWVoXRS+621S2VeB7U0nxfDSeTKc=; b=xIommWb6OVWpuJE4IwuvYDiISFbQbrdzkMABNywV7KUmlRRZxg2g61wuQecLBMNB2gyggh 51m8iVB2A21cL8imrJeTTPb1ehaPU7ynXVoXQzi74OMytouU9wugIyB9jpexx6vx+I7cBm wSf6qmll2Xp0O+jsxLZPcJUWgElxNIA= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=pNYw5Nim; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf03.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.113 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712319870; a=rsa-sha256; cv=none; b=7bvZyf47FqUDQZFH9uPfXU9HLUXNNnjmoVn7wJDHsGClFy86PHSEh2Iey5WFkAG8oWTxzk veoi+gugRMgUiuv214JK/5Yvv5FTpOcl4xl9qQCUGgavjvLrpjD/tAO+3LI+l7SIPWI4sI KtpBN02+FkSNGdt6gmM/3a8s3tz5bDI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1712319865; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=Xgh9CRUBvGZe+XyUWVoXRS+621S2VeB7U0nxfDSeTKc=; b=pNYw5NimxpWXixbiL5lb6Y3u+oj6B637T4lcTk9AdBgJtkjmiyzLUefxAvH5Sar+2Hnp4ZitmnUtdral8BnCcdfE8KRoLYQOpSszINDjhykD2kb9OSuP0k3/75yK4IvkVtx6ZAPRLwUXY+FWrO/Tsu1VuRtG0mBPWASturzqL3Y= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045170;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0W3wypEZ_1712319863; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W3wypEZ_1712319863) by smtp.aliyun-inc.com; Fri, 05 Apr 2024 20:24:24 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: mgorman@techsingularity.net, vbabka@suse.cz, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm: set pageblock_order to HPAGE_PMD_ORDER in case with !CONFIG_HUGETLB_PAGE but THP enabled Date: Fri, 5 Apr 2024 20:24:16 +0800 Message-Id: <3d57d253070035bdc0f6d6e5681ce1ed0e1934f7.1712286863.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-Rspamd-Queue-Id: 0B0E82000E X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: zy95q5k8spm45ioum5qy1g64ria8hc9k X-HE-Tag: 1712319868-607712 X-HE-Meta: U2FsdGVkX1/wei5cYKUPABn8AzU7wLrg8CmmmKKVsd+EZlwhKWJemkcow2dI9nsBH6nEOXD/kqVw3Z7gPoRwdFuAr4kiFViFEpu059NWDaB5X5bIbPAu2yDvwMoFaU/vFm6UW9GLs3f4pmHuAfLlYieamLMuiaEM6VgLQD1MVornDR/MDBLhJzWzPmsqYdoJ+A+XuZeQl6/vlZMd2sKxM9yhlq8bP+N2kwByjJWwxeKbaYgZ2rywfIhrzspmJLQInQZg+NeYFGR2nOetiW2T4ON0p4MSoO/uxA0djra1/KmrYhwocZTJAW5BI3KxGxA5DquMgA72DbhR/AM9f3Ly6/fdxGD9ILmXpuSC4fxcVsIuDNOViMuysG1Ffra2z7mWWDxuJTlH9o584O2Q20u5xlTZ7oGqMTsLAy2CJiTfHQKl5m6ORObozS85movbZVad1OR5qCUNxVWHMCHIsSBb19opOYh3Wa+3KdACCG2IElZAiSj4g13iVYA72pq9tBMO981mE//qGskMWJPoWy0N1gVPQMYaSwVm3DH802cXoJ/iRa5J9ult0ETRQKW5tZOMr3lWNtFv2Zc4kLqMw0Yuqfxh040G5vo6if5eCsZvaCryiw/U7qcxAoGGtD2BWCLeA6it2K/G3O7de7IB3R2ddGTb9TcMaag/qkAEnk9xksPxBxjBARCp2DauciYeK0RMM4T8RxGkkJObJlQbrHqfwbv0f5C0BkUOjj8ZaQWe1BgNQ9eop4WpmabTuJAXMl+8N0jDxYJx+Rg8VoxpaTb8JENGo/P6YXjnKq/xZo4IejjWzqB7f5xWsijM3CGtplYHGAa5ZTAGu7UXus1GPYpH0W1uMbloF4GzcBcKpuDY59UYu9gwgbSk315nufFXUi774xcgCvql+AfAnzGUcwfU6MU/0TetCKnqytmLRPvCQtQLlTi6DIrv4Gn3VHgN5IHRiLoDS74tbxm4Bh1dX9m gyWPlQ7W wUfWskPLr2C6rAzWgjqO+fp2CLNEMW+tEJfW4p6brJBtDaav8fHOeqaMmV9cJoD65R1AwNSOF/N7B8N8YCTQpkUQ88FBAQZEpN2Ao5qjgPtqaZlvfXiBA1qM5vUrSxuPyeI0MiluSnnAtk73BrpZlZZSnOL0INqEcX51xVYdGrIg7xtEM5FPEYTwfPlve9L4/IvwcAB3MHbtPBpTRoL5T/jsw7G0VnRnpJw8KsKWcWCIJqXcQCkBW58UljTS4unW01lVgceYH7DyO3Yw13cksMcFeiCYONXPVHa2Id2t2IQ54SWHyIQIu67+5l/AQ9CDK9L4D/VPQuHWuF7SbYtPetf7Zs4QHqfaMFLtGMRLrCjmEkwkB/7SIJVcAkkdW0yCl3wn+ 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: List-Subscribe: List-Unsubscribe: As Vlastimil suggested in previous discussion[1], it doesn't make sense to set pageblock_order as MAX_PAGE_ORDER when hugetlbfs is not enabled and THP is enabled. Instead, it should be set to HPAGE_PMD_ORDER. [1] https://lore.kernel.org/all/76457ec5-d789-449b-b8ca-dcb6ceb12445@suse.cz/ Suggested-by: Vlastimil Babka Signed-off-by: Baolin Wang Acked-by: Vlastimil Babka Acked-by: David Hildenbrand --- include/linux/pageblock-flags.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h index 3f2409b968ec..547e82cdc89a 100644 --- a/include/linux/pageblock-flags.h +++ b/include/linux/pageblock-flags.h @@ -28,7 +28,7 @@ enum pageblock_bits { NR_PAGEBLOCK_BITS }; -#ifdef CONFIG_HUGETLB_PAGE +#if defined(CONFIG_HUGETLB_PAGE) #ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE @@ -45,7 +45,11 @@ extern unsigned int pageblock_order; #endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */ -#else /* CONFIG_HUGETLB_PAGE */ +#elif defined(CONFIG_TRANSPARENT_HUGEPAGE) + +#define pageblock_order min_t(unsigned int, HPAGE_PMD_ORDER, MAX_PAGE_ORDER) + +#else /* CONFIG_TRANSPARENT_HUGEPAGE */ /* If huge pages are not used, group by MAX_ORDER_NR_PAGES */ #define pageblock_order MAX_PAGE_ORDER