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>] [day] [month] [year] [list]
Date:   Fri,  6 Jan 2023 00:04:17 +0100
From:   Yann Droneaud <ydroneaud@...eya.com>
To:     Hugh Dickins <hughd@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        Yann Droneaud <ydroneaud@...eya.com>
Subject: [PATCH] shmem: optimize shmem_huge_enabled() and shmem_is_huge() when !CONFIG_TRANSPARENT_HUGEPAGE

When CONFIG_TRANSPARENT_HUGEPAGE is not set, shmem_is_huge() is not needed
outside of shmem.c.

Signed-off-by: Yann Droneaud <ydroneaud@...eya.com>
---
 include/linux/shmem_fs.h | 9 +++++++++
 mm/shmem.c               | 4 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index d500ea967dc7..18a4968ded73 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -92,6 +92,7 @@ extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
 extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end);
 int shmem_unuse(unsigned int type);
 
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
 extern bool shmem_is_huge(struct vm_area_struct *vma, struct inode *inode,
 			  pgoff_t index, bool shmem_huge_force);
 static inline bool shmem_huge_enabled(struct vm_area_struct *vma,
@@ -100,6 +101,14 @@ static inline bool shmem_huge_enabled(struct vm_area_struct *vma,
 	return shmem_is_huge(vma, file_inode(vma->vm_file), vma->vm_pgoff,
 			     shmem_huge_force);
 }
+#else /* !CONFIG_TRANSPARENT_HUGEPAGE */
+static inline bool shmem_huge_enabled(struct vm_area_struct *vma,
+				      bool shmem_huge_force)
+{
+	return false;
+}
+#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
+
 extern unsigned long shmem_swap_usage(struct vm_area_struct *vma);
 extern unsigned long shmem_partial_swap_usage(struct address_space *mapping,
 						pgoff_t start, pgoff_t end);
diff --git a/mm/shmem.c b/mm/shmem.c
index c301487be5fb..9437c200a311 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -678,8 +678,8 @@ static long shmem_unused_huge_count(struct super_block *sb,
 
 #define shmem_huge SHMEM_HUGE_DENY
 
-bool shmem_is_huge(struct vm_area_struct *vma, struct inode *inode,
-		   pgoff_t index, bool shmem_huge_force)
+static inline bool shmem_is_huge(struct vm_area_struct *vma, struct inode *inode,
+				 pgoff_t index, bool shmem_huge_force)
 {
 	return false;
 }
-- 
2.37.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ