linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: LEROY Christophe <christophe.leroy2@cs-soprasteria.com>
To: Peter Xu <peterx@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>
Cc: Vlastimil Babka <vbabka@suse.cz>,
	David Hildenbrand <david@redhat.com>,
	Oscar Salvador <osalvador@suse.de>,
	"linux-s390@vger.kernel.org" <linux-s390@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Matthew Wilcox <willy@infradead.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Michal Hocko <mhocko@kernel.org>,
	"linux-riscv@lists.infradead.org"
	<linux-riscv@lists.infradead.org>,
	"sparclinux@vger.kernel.org" <sparclinux@vger.kernel.org>,
	Alex Williamson <alex.williamson@redhat.com>,
	Jason Gunthorpe <jgg@nvidia.com>,
	"x86@kernel.org" <x86@kernel.org>,
	Alistair Popple <apopple@nvidia.com>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Ryan Roberts <ryan.roberts@arm.com>,
	Hugh Dickins <hughd@google.com>,
	Axel Rasmussen <axelrasmussen@google.com>
Subject: Re: [PATCH RFC 2/6] mm: PGTABLE_HAS_P[MU]D_LEAVES config options
Date: Thu, 22 Aug 2024 17:22:03 +0000	[thread overview]
Message-ID: <dcdde9fc-7e7c-45a8-8dc7-7f7ed13b81ec@cs-soprasteria.com> (raw)
In-Reply-To: <20240717220219.3743374-3-peterx@redhat.com>



Le 18/07/2024 à 00:02, Peter Xu a écrit :
> Introduce two more sub-options for PGTABLE_HAS_HUGE_LEAVES:
> 
>    - PGTABLE_HAS_PMD_LEAVES: set when there can be PMD mappings
>    - PGTABLE_HAS_PUD_LEAVES: set when there can be PUD mappings
> 
> It will help to identify whether the current build may only want PMD
> helpers but not PUD ones, as these sub-options will also check against the
> arch support over HAVE_ARCH_TRANSPARENT_HUGEPAGE[_PUD].
> 
> Note that having them depend on HAVE_ARCH_TRANSPARENT_HUGEPAGE[_PUD] is
> still some intermediate step.  The best way is to have an option say
> "whether arch XXX supports PMD/PUD mappings" and so on.  However let's
> leave that for later as that's the easy part.  So far, we use these options
> to stably detect per-arch huge mapping support.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>   include/linux/huge_mm.h | 10 +++++++---
>   mm/Kconfig              |  6 ++++++
>   2 files changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
> index 711632df7edf..37482c8445d1 100644
> --- a/include/linux/huge_mm.h
> +++ b/include/linux/huge_mm.h
> @@ -96,14 +96,18 @@ extern struct kobj_attribute thpsize_shmem_enabled_attr;
>   #define thp_vma_allowable_order(vma, vm_flags, tva_flags, order) \
>   	(!!thp_vma_allowable_orders(vma, vm_flags, tva_flags, BIT(order)))
>   
> -#ifdef CONFIG_PGTABLE_HAS_HUGE_LEAVES
> -#define HPAGE_PMD_SHIFT PMD_SHIFT
> +#ifdef CONFIG_PGTABLE_HAS_PUD_LEAVES
>   #define HPAGE_PUD_SHIFT PUD_SHIFT
>   #else
> -#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
>   #define HPAGE_PUD_SHIFT ({ BUILD_BUG(); 0; })
>   #endif
>   
> +#ifdef CONFIG_PGTABLE_HAS_PMD_LEAVES
> +#define HPAGE_PMD_SHIFT PMD_SHIFT
> +#else
> +#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
> +#endif
> +
>   #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
>   #define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER)
>   #define HPAGE_PMD_MASK	(~(HPAGE_PMD_SIZE - 1))
> diff --git a/mm/Kconfig b/mm/Kconfig
> index 60796402850e..2dbdc088dee8 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -860,6 +860,12 @@ endif # TRANSPARENT_HUGEPAGE
>   config PGTABLE_HAS_HUGE_LEAVES
>   	def_bool TRANSPARENT_HUGEPAGE || HUGETLB_PAGE
>   
> +config PGTABLE_HAS_PMD_LEAVES
> +	def_bool HAVE_ARCH_TRANSPARENT_HUGEPAGE && PGTABLE_HAS_HUGE_LEAVES
> +
> +config PGTABLE_HAS_PUD_LEAVES
> +	def_bool HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD && PGTABLE_HAS_HUGE_LEAVES
> +

What if an architecture has hugepages at PMD and/or PUD level and 
doesn't support THP ?

Christophe

>   #
>   # UP and nommu archs use km based percpu allocator
>   #

  reply	other threads:[~2024-08-22 17:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-17 22:02 [PATCH RFC 0/6] mm: THP-agnostic refactor on huge mappings Peter Xu
2024-07-17 22:02 ` [PATCH RFC 1/6] mm/treewide: Remove pgd_devmap() Peter Xu
2024-07-17 22:02 ` [PATCH RFC 2/6] mm: PGTABLE_HAS_P[MU]D_LEAVES config options Peter Xu
2024-08-22 17:22   ` LEROY Christophe [this message]
2024-08-22 19:16     ` Peter Xu
2024-08-23  6:19       ` LEROY Christophe
2024-08-26 14:34         ` Peter Xu
2024-07-17 22:02 ` [PATCH RFC 3/6] mm/treewide: Make pgtable-generic.c THP agnostic Peter Xu
2024-07-17 22:02 ` [PATCH RFC 4/6] mm: Move huge mapping declarations from internal.h to huge_mm.h Peter Xu
2024-07-17 22:02 ` [PATCH RFC 5/6] mm/huge_mapping: Create huge_mapping_pxx.c Peter Xu
2024-07-17 22:02 ` [PATCH RFC 6/6] mm: Convert "*_trans_huge() || *_devmap()" to use *_leaf() Peter Xu
2024-07-22 13:29 ` [PATCH RFC 0/6] mm: THP-agnostic refactor on huge mappings David Hildenbrand
2024-07-22 15:31   ` Peter Xu
2024-07-23  8:18     ` David Hildenbrand
2024-07-23 21:04       ` Peter Xu
2024-07-23 21:22         ` David Hildenbrand
2024-08-22 17:08         ` LEROY Christophe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dcdde9fc-7e7c-45a8-8dc7-7f7ed13b81ec@cs-soprasteria.com \
    --to=christophe.leroy2@cs-soprasteria.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex.williamson@redhat.com \
    --cc=apopple@nvidia.com \
    --cc=axelrasmussen@google.com \
    --cc=dan.j.williams@intel.com \
    --cc=david@redhat.com \
    --cc=hughd@google.com \
    --cc=jgg@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mhocko@kernel.org \
    --cc=osalvador@suse.de \
    --cc=peterx@redhat.com \
    --cc=ryan.roberts@arm.com \
    --cc=sparclinux@vger.kernel.org \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox