[RFC PATCH 04/11] mm/huge_memory: remove file_thp_enabled() and its caller.

Zi Yan posted 11 patches 1 week, 5 days ago
[RFC PATCH 04/11] mm/huge_memory: remove file_thp_enabled() and its caller.
Posted by Zi Yan 1 week, 5 days ago
It is used by no-long-exist READ_ONLY_THP_FOR_FS.

Signed-off-by: Zi Yan <ziy@nvidia.com>
---
 mm/huge_memory.c | 21 ---------------------
 1 file changed, 21 deletions(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 54b3d21e4cbb..de4a1e6ce376 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -85,24 +85,6 @@ unsigned long huge_anon_orders_madvise __read_mostly;
 unsigned long huge_anon_orders_inherit __read_mostly;
 static bool anon_orders_configured __initdata;
 
-static inline bool file_thp_enabled(struct vm_area_struct *vma)
-{
-	struct inode *inode;
-
-	if (!IS_ENABLED(CONFIG_READ_ONLY_THP_FOR_FS))
-		return false;
-
-	if (!vma->vm_file)
-		return false;
-
-	inode = file_inode(vma->vm_file);
-
-	if (IS_ANON_FILE(inode))
-		return false;
-
-	return !inode_is_open_for_write(inode) && S_ISREG(inode->i_mode);
-}
-
 /* If returns true, we are unable to access the VMA's folios. */
 static bool vma_is_special_huge(const struct vm_area_struct *vma)
 {
@@ -199,9 +181,6 @@ unsigned long __thp_vma_allowable_orders(struct vm_area_struct *vma,
 		 */
 		if (((in_pf || smaps)) && vma->vm_ops->huge_fault)
 			return orders;
-		/* Only regular file is valid in collapse path */
-		if (((!in_pf || smaps)) && file_thp_enabled(vma))
-			return orders;
 		return 0;
 	}
 
-- 
2.43.0