linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Ignacio.MorenoGonzalez@kuka.com
Cc: lorenzo.stoakes@oracle.com, akpm@linux-foundation.org,
	yang@os.amperecomputing.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH v2 2/2] mm: madvise: no-op for MADV_NOHUGEPAGE if THP is disabled
Date: Tue, 6 May 2025 12:00:37 -0400	[thread overview]
Message-ID: <qpqhkheqdzkzh2q2y4kx7ztoz73vi337mv4osmuc5wpzsif4cm@mrrvn4ivnv4w> (raw)
In-Reply-To: <20250506-map-map_stack-to-vm_nohugepage-only-if-thp-is-enabled-v2-2-f11f0c794872@kuka.com>

* Ignacio Moreno Gonzalez via B4 Relay <devnull+Ignacio.MorenoGonzalez.kuka.com@kernel.org> [250506 09:44]:
> From: Ignacio Moreno Gonzalez <Ignacio.MorenoGonzalez@kuka.com>
> 
> VM_NOHUGEPAGE is a no-op in a kernel without THP. So it makes no sense
> to return an error when calling madvise() with MADV_NOHUGEPAGE.
> 
> Suggested-by: Matthew Wilcox <willy@infradead.org>
> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> Reviewed-by: Yang Shi <yang@os.amperecomputing.com>
> Signed-off-by: Ignacio Moreno Gonzalez <Ignacio.MorenoGonzalez@kuka.com>

Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>

> ---
>  include/linux/huge_mm.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
> index e893d546a49f464f7586db639fe216231f03651a..cdb991f9be918182f94003394cf793654a080224 100644
> --- a/include/linux/huge_mm.h
> +++ b/include/linux/huge_mm.h
> @@ -7,6 +7,10 @@
>  #include <linux/fs.h> /* only for vma_is_dax() */
>  #include <linux/kobject.h>
>  
> +#ifndef CONFIG_TRANSPARENT_HUGEPAGE
> +#include <uapi/asm-generic/mman-common.h>
> +#endif
> +
>  vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf);
>  int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
>  		  pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
> @@ -598,6 +602,8 @@ static inline bool unmap_huge_pmd_locked(struct vm_area_struct *vma,
>  static inline int hugepage_madvise(struct vm_area_struct *vma,
>  				   unsigned long *vm_flags, int advice)
>  {
> +	if (advice == MADV_NOHUGEPAGE)
> +		return 0;
>  	return -EINVAL;
>  }
>  
> 
> -- 
> 2.39.5
> 
> 


  reply	other threads:[~2025-05-06 16:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-06 13:44 [PATCH v2 0/2] Map MAP_STACK to VM_NOHUGEPAGE only if THP is enabled Ignacio Moreno Gonzalez via B4 Relay
2025-05-06 13:44 ` [PATCH v2 1/2] mm: mmap: map " Ignacio Moreno Gonzalez via B4 Relay
2025-05-06 16:00   ` Liam R. Howlett
2025-05-06 23:43   ` Andrew Morton
2025-05-06 13:44 ` [PATCH v2 2/2] mm: madvise: no-op for MADV_NOHUGEPAGE if THP is disabled Ignacio Moreno Gonzalez via B4 Relay
2025-05-06 16:00   ` Liam R. Howlett [this message]
2025-05-06 23:40   ` Andrew Morton
2025-05-07 11:44     ` Ignacio Moreno Gonzalez
2025-05-07 15:57       ` Yang Shi
2025-05-07 16:11         ` Ignacio Moreno Gonzalez
2025-05-07 22:38           ` Yang Shi
2025-05-06 14:28 ` [PATCH v2 0/2] Map MAP_STACK to VM_NOHUGEPAGE only if THP is enabled Lorenzo Stoakes
2025-05-06 15:12   ` Ignacio Moreno Gonzalez
2025-05-06 15:14     ` Lorenzo Stoakes

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=qpqhkheqdzkzh2q2y4kx7ztoz73vi337mv4osmuc5wpzsif4cm@mrrvn4ivnv4w \
    --to=liam.howlett@oracle.com \
    --cc=Ignacio.MorenoGonzalez@kuka.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=willy@infradead.org \
    --cc=yang@os.amperecomputing.com \
    /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