From mboxrd@z Thu Jan 1 00:00:00 1970 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 6B8E5C47DD9 for ; Sat, 23 Mar 2024 01:05:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CB21B6B0087; Fri, 22 Mar 2024 21:05:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C62106B0088; Fri, 22 Mar 2024 21:05:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B02AC6B008A; Fri, 22 Mar 2024 21:05:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A19ED6B0087 for ; Fri, 22 Mar 2024 21:05:54 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 784F4140173 for ; Sat, 23 Mar 2024 01:05:54 +0000 (UTC) X-FDA: 81926511828.17.B0F165D Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf22.hostedemail.com (Postfix) with ESMTP id 4BF16C000A for ; Sat, 23 Mar 2024 01:05:51 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=EcMiWiUk; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf22.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711155953; a=rsa-sha256; cv=none; b=nmJN+ux0bpBVAMNxjnMnaaLymSgQwJv2UibxUgoK2nbjt7njlIR5M7pXFZPOkaSdSth+2b 3n282VSl5cbr5+/U6eo706cH9QxSzm3NWtdcu+JkgUsVVd2gxfJzcxOKexE/+R62tBERhE nMlgKtoL5CC9IuxaVMv7KIIrOcK/aa8= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=EcMiWiUk; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf22.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711155953; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to:references:dkim-signature; bh=qw4e8xfyGYKKEFEJ0g/Iuhbg+Kwe7B07eexTuW3SMxE=; b=t+wCCC7GICiA4EQv2YOTEg9I7UM7yV+y4ywU8wYEIimwPp9GNsw9+x4iivm7zX5ysZ+evG qK2qTGCghSFo11jBASId7TpfrELN1ESmGGO9MGCg0JoveJFs9YKF3AciDW6uCQQm5+N/81 gdhdolQb6EuyLpt/YVHEWVM156xUDpU= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 7A37ECE18C7; Sat, 23 Mar 2024 01:05:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04826C433F1; Sat, 23 Mar 2024 01:05:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711155945; bh=3+zZh3XFJnxQpCAGDeyGmKq33BNtz2+66eAEGL4876Q=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=EcMiWiUkiXF0pmTkhVhDvP+BA3m6SBMpMePHLS3lgvhzbCdo9T5o6x2xTa8QoCvtQ ZiIr3laXn2TxW1OUddMIfS1+bJqiPdQdS/W9Rj6yvZxknL1k5q/DKyC9sWIyvTCsmL qjz9g+3k55UpMTkbn5Fmp2EPQC/vmOSHUkLHq5nPc1YFOdstql4q7f52P4kaf6kZOe OK6Xw3iZcQy36q6zjiD/Nq4FMHprCktSrO9wXGQN1nYHgDgHW9odHpf0M4qlTAphIv Qt9VjffONOVJFRHRVRK9EkkPxU/upViU53CWHBYVwXM057H2FC5cyRrlr1LY92qHmO G5ofpS5wd8PeQ== From: SeongJae Park To: Peter Xu Cc: SeongJae Park , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Michael Ellerman , Christophe Leroy , Matthew Wilcox , Rik van Riel , Lorenzo Stoakes , Axel Rasmussen , Yang Shi , John Hubbard , linux-arm-kernel@lists.infradead.org, "Kirill A . Shutemov" , Andrew Jones , Vlastimil Babka , Mike Rapoport , Andrew Morton , Muchun Song , Christoph Hellwig , linux-riscv@lists.infradead.org, James Houghton , David Hildenbrand , Jason Gunthorpe , Andrea Arcangeli , "Aneesh Kumar K . V" , Mike Kravetz Subject: Re: [PATCH v3 03/12] mm: Make HPAGE_PXD_* macros even if !THP Date: Fri, 22 Mar 2024 18:05:28 -0700 Message-Id: <20240323010528.10959-1-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 4BF16C000A X-Stat-Signature: 8ozdox7cnx5g3sfew37cgfzbg7nmxb3r X-HE-Tag: 1711155951-183224 X-HE-Meta: U2FsdGVkX19kdPr7eMX4NiqtQU55p41b47hBmKFKR3kcluVzPCPW1OPljurQAPL6T6RVGb42dsOC+dwxzIeyFtc03mp8EOf8HchmthVPe456BusjuLgYj7Mjd5jQzQc5KGqlWj8m6pZ1ryEDL+RwstZB7Zc29ZfaTYJ4CjfN7NIr693+1VYJ/sjPy700Z93eS7PcgLJJSqODZmkLy4lo+UlfRyOw0VdRLCFUPW2Gwfp+JwSJoKDFKuLlfjIdVJ/HluBb3YEavYn5yeHU2iQa6hIXx7Dk7Te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HNyZYvWbgthakce2W2797IOfTeb7XMseGiOfa7uWk 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: Hi Peter, On Fri, 22 Mar 2024 20:30:24 -0400 Peter Xu wrote: > On Fri, Mar 22, 2024 at 10:14:56AM -0700, SeongJae Park wrote: > > Hi Peter, > > Hi, SeongJae, > > > > > On Thu, 21 Mar 2024 18:07:53 -0400 peterx@redhat.com wrote: > > > > > From: Peter Xu > > > > > > These macros can be helpful when we plan to merge hugetlb code into generic > > > code. Move them out and define them even if !THP. > > > > > > We actually already defined HPAGE_PMD_NR for other reasons even if !THP. > > > Reorganize these macros. > > > > > > Reviewed-by: Christoph Hellwig > > > Reviewed-by: Jason Gunthorpe > > > Signed-off-by: Peter Xu > > > --- > > > include/linux/huge_mm.h | 17 ++++++----------- > > > 1 file changed, 6 insertions(+), 11 deletions(-) > > > > > > diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h > > > index de0c89105076..3bcdfc7e5d57 100644 > > > --- a/include/linux/huge_mm.h > > > +++ b/include/linux/huge_mm.h > > > @@ -64,9 +64,6 @@ ssize_t single_hugepage_flag_show(struct kobject *kobj, > > > enum transparent_hugepage_flag flag); > > > extern struct kobj_attribute shmem_enabled_attr; > > > > > > -#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) > > > -#define HPAGE_PMD_NR (1< > > - > > > /* > > > * Mask of all large folio orders supported for anonymous THP; all orders up to > > > * and including PMD_ORDER, except order-0 (which is not "huge") and order-1 > > > @@ -87,14 +84,19 @@ extern struct kobj_attribute shmem_enabled_attr; > > > #define thp_vma_allowable_order(vma, vm_flags, smaps, in_pf, enforce_sysfs, order) \ > > > (!!thp_vma_allowable_orders(vma, vm_flags, smaps, in_pf, enforce_sysfs, BIT(order))) > > > > > > -#ifdef CONFIG_TRANSPARENT_HUGEPAGE > > > #define HPAGE_PMD_SHIFT PMD_SHIFT > > > #define HPAGE_PMD_SIZE ((1UL) << HPAGE_PMD_SHIFT) > > > #define HPAGE_PMD_MASK (~(HPAGE_PMD_SIZE - 1)) > > > +#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) > > > +#define HPAGE_PMD_NR (1< > > > > > #define HPAGE_PUD_SHIFT PUD_SHIFT > > > #define HPAGE_PUD_SIZE ((1UL) << HPAGE_PUD_SHIFT) > > > #define HPAGE_PUD_MASK (~(HPAGE_PUD_SIZE - 1)) > > > +#define HPAGE_PUD_ORDER (HPAGE_PUD_SHIFT-PAGE_SHIFT) > > > +#define HPAGE_PUD_NR (1< > > > I just found latest mm-unstable fails one of my build configurations[1] with > > below error. 'git bisect' says this is the first patch set started the > > failure. I haven't looked in deep, but just reporting first. > > > > In file included from .../include/linux/mm.h:1115, > > from .../mm/vmstat.c:14: > > .../mm/vmstat.c: In function 'zoneinfo_show_print': > > .../include/linux/huge_mm.h:87:25: error: 'PMD_SHIFT' undeclared (first use in this function); did you mean 'PUD_SHIFT'? > > 87 | #define HPAGE_PMD_SHIFT PMD_SHIFT > > | ^~~~~~~~~ > > > > [1] https://github.com/awslabs/damon-tests/blob/next/corr/tests/build_m68k.sh > > Apologies for the issue. No problem at all, this blocks nothing in real :) > This is caused by !CONFIG_MMU, I think. > > I thought this would be fairly easy to fix by putting these macros under > CONFIG_PGTABLE_HAS_HUGE_LEAVES, however when doing this I could have found > some other issue that violates this rule.. mm/vmstat.c has referenced > HPAGE_PMD_NR even if vmstat_item_print_in_thp() wanted to guard it only > with CONFIG_THP. > > /home/peterx/git/linux/mm/vmstat.c: In function 'zoneinfo_show_print': > /home/peterx/git/linux/mm/vmstat.c:1689:42: error: 'HPAGE_PMD_NR' undeclared (first use in this function) > 1689 | pages /= HPAGE_PMD_NR; > | ^~~~~~~~~~~~ > /home/peterx/git/linux/mm/vmstat.c:1689:42: note: each undeclared identifier is reported only once for each function it appears in > CC drivers/tty/tty_port.o > /home/peterx/git/linux/mm/vmstat.c: In function 'vmstat_start': > /home/peterx/git/linux/mm/vmstat.c:1822:33: error: 'HPAGE_PMD_NR' undeclared (first use in this function) > 1822 | v[i] /= HPAGE_PMD_NR; > | ^~~~~~~~~~~~ > make[4]: *** [/home/peterx/git/linux/scripts/Makefile.build:243: mm/vmstat.o] Error 1 > > static __always_inline bool vmstat_item_print_in_thp(enum node_stat_item item) > { > if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) > return false; > ... > } > > I think the problem is vmstat_item_print_in_thp() uses IS_ENABLED() however > that won't stop compiler from looking into the "if".. so it'll still try to > find the HPAGE_PMD_NR macro. > > It means, I may need to further change vmstat_item_print_in_thp() to make > this work in the clean way.. by properly switching to a #ifdef. > > For that I'll need to post a formal patch and add people to review. I'll > keep you posted. Thank you for this kind explanation, all makes sense to me. Looking forward to the patch. > > Side note: thank you for your script, just to mention make.cross has been > moved to kbuild/, and it'll also need kbuild.sh now to work. So you may > want to fix your test script (and it worked for you because you kept the > old make.cross around), like: > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/kbuild/make.cross -O ./bin/make.cross > wget https://raw.githubusercontent.com/intel/lkp-tests/master/kbuild/kbuild.sh -O ./bin/kbuild.sh And thank you so much for this nice suggestion. I'll revisit the script soon. Thanks, SJ > > Thanks, > > -- > Peter Xu