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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220829230014.384722-2-sidhartha.kumar@oracle.com>
Date:   Mon, 29 Aug 2022 16:00:08 -0700
From:   Sidhartha Kumar <sidhartha.kumar@...cle.com>
To:     linux-kernel@...r.kernel.org, linux-mm@...ck.org
Cc:     akpm@...ux-foundation.org, songmuchun@...edance.com,
        mike.kravetz@...cle.com, willy@...radead.org, vbabka@...e.cz,
        william.kucharski@...cle.com, dhowells@...hat.com,
        peterx@...hat.com, arnd@...db.de, ccross@...gle.com,
        hughd@...gle.com, ebiederm@...ssion.com,
        Sidhartha Kumar <sidhartha.kumar@...cle.com>
Subject: [PATCH 1/7] mm/hugetlb: add folio support to hugetlb specific flag macros

Allows the macros which test, set, and clear hugetlb specific page
flags to take a hugetlb folio as an input. The marcros are generated as
folio_{test, set, clear}_hugetlb_{restore_reserve, migratable,
temporary, freed, vmemmap_optimized, raw_hwp_unreliable}.

Signed-off-by: Sidhartha Kumar <sidhartha.kumar@...cle.com>
---
 include/linux/hugetlb.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index acace1a25226..ac4e98edd5b0 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -583,26 +583,47 @@ enum hugetlb_page_flags {
  */
 #ifdef CONFIG_HUGETLB_PAGE
 #define TESTHPAGEFLAG(uname, flname)				\
+static __always_inline								\
+int folio_test_hugetlb_##flname(struct folio *folio)		\
+	{	void **private = &folio->private;		\
+		return test_bit(HPG_##flname, (void *)((unsigned long)private));	\
+	}	\
 static inline int HPage##uname(struct page *page)		\
 	{ return test_bit(HPG_##flname, &(page->private)); }
 
 #define SETHPAGEFLAG(uname, flname)				\
+static __always_inline							\
+void folio_set_hugetlb_##flname(struct folio *folio)		\
+	{	void **private = &folio->private;		\
+		set_bit(HPG_##flname, (void *)((unsigned long)private));		\
+	}	\
 static inline void SetHPage##uname(struct page *page)		\
 	{ set_bit(HPG_##flname, &(page->private)); }
 
 #define CLEARHPAGEFLAG(uname, flname)				\
+static __always_inline								\
+void folio_clear_hugetlb_##flname(struct folio *folio)		\
+	{	void **private = &folio->private;		\
+		clear_bit(HPG_##flname, (void *)((unsigned long)private));		\
+	}	\
 static inline void ClearHPage##uname(struct page *page)		\
 	{ clear_bit(HPG_##flname, &(page->private)); }
 #else
 #define TESTHPAGEFLAG(uname, flname)				\
+static inline int folio_test_hugetlb_##flname(struct folio *folio)		\
+	{ return 0; }										\
 static inline int HPage##uname(struct page *page)		\
 	{ return 0; }
 
 #define SETHPAGEFLAG(uname, flname)				\
+static inline void folio_set_hugetlb_##flname(struct folio *folio)		\
+	{ }		                                                \
 static inline void SetHPage##uname(struct page *page)		\
 	{ }
 
 #define CLEARHPAGEFLAG(uname, flname)				\
+static inline void folio_clear_hugetlb_##flname(struct folio *folio)	\
+	{ }		                                                \
 static inline void ClearHPage##uname(struct page *page)		\
 	{ }
 #endif
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ