lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3c825374-8db3-413c-b4b0-ea95053be7d0@os.amperecomputing.com>
Date: Wed, 7 May 2025 15:38:33 -0700
From: Yang Shi <yang@...amperecomputing.com>
To: Ignacio Moreno Gonzalez <Ignacio.MorenoGonzalez@...a.com>,
 Andrew Morton <akpm@...ux-foundation.org>
Cc: lorenzo.stoakes@...cle.com, Liam.Howlett@...cle.com, linux-mm@...ck.org,
 linux-kernel@...r.kernel.org, Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH v2 2/2] mm: madvise: no-op for MADV_NOHUGEPAGE if THP is
 disabled



On 5/7/25 9:11 AM, Ignacio Moreno Gonzalez wrote:
> On 5/7/2025 5:57 PM, Yang Shi wrote:
>
>> Can you just simply include <linux/mman.h> ?
> This is what I tried first, but then it won't compile due to 'undeclared MADV_NOHUGEPAGE'

OK, I ran into some compilation errors, but it is not due to 'undeclared 
MADV_NOHUGEPAGE'. The compiler reports some inline functions are not 
declared. It may be because some circular dependency because 
linux/mman.h also includes linux/mm.h. But I didn't have too much time 
investigating it.

The below patch works for me:

diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index 93e509b6c00e..750e17e552a0 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -475,6 +475,8 @@ bool unmap_huge_pmd_locked(struct vm_area_struct 
*vma, unsigned long addr,

  #else /* CONFIG_TRANSPARENT_HUGEPAGE */

+#include <uapi/asm/mman.h>
+
  static inline bool folio_test_pmd_mappable(struct folio *folio)
  {
         return false;
@@ -558,6 +560,9 @@ 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;
  }


This should be slightly better than yours?

Thanks,
Yang



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ