Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1284035lqp; Fri, 22 Mar 2024 10:15:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX3Iph7AR33VOaTOyZdJiCXIS4tDG59QsaZhsz7j1it+PEhNYQ6q9nxnWyFELUcR2RPWq+rGA4Y6NEpoKX0I53HgVHDhKBo1mLuWb1S+w== X-Google-Smtp-Source: AGHT+IGfb/qGgzxoja818RKj/tKv7tm47DYM56Z1vSgLzT6cHprzFeCGFtfdc+gSCZM5CiODgjJd X-Received: by 2002:a05:622a:cc:b0:431:30b3:dfa1 with SMTP id p12-20020a05622a00cc00b0043130b3dfa1mr125695qtw.34.1711127708204; Fri, 22 Mar 2024 10:15:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711127708; cv=pass; d=google.com; s=arc-20160816; b=gWsH06O9mQNA1KhyX+ttcF0nYZolKlVeW2dw65bCEijr5y3zt3aJXyGjsEpQtB4b+k qnOAKVsVVD55+E2fe3v92DV37aI1TT93B+1Zw8zkJCRZ89fhkxUYeeNi78FOm4Sx+pjt JD8pDnTxPpAgEJkilhYhsgYAcSjvuFlt0sHj9hdzszbLUEGKVIelXPoGFu0kLRf6frC3 sL18qTHbSxjOOScY4vr/oScwI9pMornHyYeO2BBH7bKm5+A1AHhzDtnRulpYpXUC3GJO 5wcki/YScrPfpT2d1FqI44/6bCo/JzidhezsJin0TCeY6bGWJd+4bJqlaKsGjMcyDRL0 x0cA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=UQxTJDkXcHJPogUVvCZqnkUqMP/IBh0RfyWmXzc50i8=; fh=BAmrVRLlqhBMuV6o4Z577bqArqVXOxl6JkuIpQ2MIS0=; b=feO2r5VvhKstHqa/j1EVe/DqUxlS3U7pXZh6THn9N+f3wIH+Vv9VrfU7YMtlNPlo9Z kXyfYCwBEry3Eg+yUJAeaINeo/aSrfd3juXsWELCmwXlwzsjUod0wAF2k0xzFEi7FAYv ebhq2LlKeSSQSVJJtTscWpkuAqTxZ7Hm7QmwSHcAM15S7277KFuJukas1LgSZ3UJwHBE 9haVZfTZXPMYO7kMNiK4N9cZXcuutgOODr8pfnK6a/7xI34Qlmq/LGUOGR/CJq7zp3Ic RgZzhXO13FsaNm7pvN3yoekd22UyA3+WnZev0OuwB+joFkLQjM2+/mnzV53TkjTsaPEY bbSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Cp+0MqbN; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-111857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111857-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id q7-20020a05622a04c700b004312033dc3dsi2319068qtx.656.2024.03.22.10.15.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 10:15:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Cp+0MqbN; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-111857-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111857-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D1BCF1C2194C for ; Fri, 22 Mar 2024 17:15:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 402365FBA5; Fri, 22 Mar 2024 17:15:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Cp+0MqbN" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 672085D752 for ; Fri, 22 Mar 2024 17:15:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711127700; cv=none; b=jhEnObTWA+4llOn0S440ZoqaDtNiRgo5c3CUXUQa4xsaLWq7yQAPdxz5PRDGfI6TVhWCj+Grerwab5as9ac7C5nJK7dRnyQjqV4oIbg/wt8cIW+vUaQUiKCeysJGperyQHnEQC+X5S7z/q4agkxR5xY/Hbu+hyGb812uhuDBN/g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711127700; c=relaxed/simple; bh=C8GD9fG22TLIZK0yuUnEPTKbqHoBiCuXP/x09X9W/Os=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FQuA0PMoCzJAfSUH0woqBXo9xoWotiK7246VoN8y0VAKFQwAnR679xPgMFgwUvVFu8jMHqjeRJoW9Q9x9pMPcw05bjUuZWIpqaOwep15BPrTyKFjOgEakB6U+A5kSaeXYc7wPhQPNtXLLA3xKXgfgX/2TJzVa1uharnsqORzH6I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Cp+0MqbN; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BE9BC433F1; Fri, 22 Mar 2024 17:14:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711127699; bh=C8GD9fG22TLIZK0yuUnEPTKbqHoBiCuXP/x09X9W/Os=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cp+0MqbN/avd7Y97uUQSY5e3e9KLVDxkhGPn+yWRI0D04F60iun6Ic766AOtiq+Md hbLUwftVGSSMtsA0ZZKPudwZqFCd+lo0SsIZJB1oXC/WFV4GXZB8YLu5zC2yPiOhjr 5BMLpXMMG1ZsWtHf0qcbGDiiKeFIJqzhIDyOUzJVdE/6IImQGRiyzKh9HaM766Mex1 s+nFrDQl3Y7IMmiSt07qyqGMJr3O/WR4llweHd32XwKcWLG0J7BQM/mZ/iBnSlmSeA p28TSop2p+oI1SaFWDwF3ryu/RLJndxMfx3mRvQNCX5A2N3t/GOQPwJibZJp9E2p5n mg6iv/YIR0f1w== From: SeongJae Park To: peterx@redhat.com Cc: 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 10:14:56 -0700 Message-Id: <20240322171456.118997-1-sj@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240321220802.679544-4-peterx@redhat.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi Peter, 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<