linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: remove VM_EXEC requirement for THP eligibility
@ 2023-12-20  5:41 Fangrui Song
  2023-12-20 23:42 ` Yang Shi
  0 siblings, 1 reply; 6+ messages in thread
From: Fangrui Song @ 2023-12-20  5:41 UTC (permalink / raw)
  To: Andrew Morton, linux-mm
  Cc: Song Liu, Yang Shi, Miaohe Lin, linux-kernel, Fangrui Song

Commit e6be37b2e7bd ("mm/huge_memory.c: add missing read-only THP
checking in transparent_hugepage_enabled()") introduced the VM_EXEC
requirement, which is not strictly needed.

lld's default --rosegment option and GNU ld's -z separate-code option
(default on Linux/x86 since binutils 2.31) create a read-only PT_LOAD
segment without the PF_X flag, which should be eligible for THP.

Certain architectures support medium and large code models, where
.lrodata may be placed in a separate read-only PT_LOAD segment, which
should be eligible for THP as well.

Signed-off-by: Fangrui Song <maskray@google.com>
---
 include/linux/huge_mm.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index fa0350b0812a..4c9e67e9000f 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -126,7 +126,6 @@ static inline bool file_thp_enabled(struct vm_area_struct *vma)
 	inode = vma->vm_file->f_inode;
 
 	return (IS_ENABLED(CONFIG_READ_ONLY_THP_FOR_FS)) &&
-	       (vma->vm_flags & VM_EXEC) &&
 	       !inode_is_open_for_write(inode) && S_ISREG(inode->i_mode);
 }
 
-- 
2.43.0.472.g3155946c3a-goog



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-12-21 19:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-20  5:41 [PATCH] mm: remove VM_EXEC requirement for THP eligibility Fangrui Song
2023-12-20 23:42 ` Yang Shi
2023-12-21  4:53   ` Fangrui Song
2023-12-21 19:31     ` Yang Shi
2023-12-21 19:45       ` Yang Shi
2023-12-21 19:50     ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox