History

mm: thp: only regular file could be THP eligible

Since commit a4aeaa06d45e ("mm: khugepaged: skip huge page collapse for special files"), khugepaged just collapses THP for regular file which is the intended usecase for readonly fs THP. Only show regular file as THP eligible accordingly. And make file_thp_enabled() available for khugepaged too in order to remove duplicate code.

Yang Shi committed 4 years ago

Commit 78d12c11 parent 52b52bf3 files · +18 −16Browse files

Showing the changes to include (1 of 3 files). Show all

Unified · Split

include/linux/huge_mm.h+14−0
@@ -173,6 +173,20 @@ static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma) · 172 unmodified lines
173 return false;173 return false;
174}174}
175 175
176static inline bool file_thp_enabled(struct vm_area_struct *vma)
177{
178 struct inode *inode;
179
180 if (!vma->vm_file)
181 return false;
182
183 inode = vma->vm_file->f_inode;
184
185 return (IS_ENABLED(CONFIG_READ_ONLY_THP_FOR_FS)) &&
186 (vma->vm_flags & VM_EXEC) &&
187 !inode_is_open_for_write(inode) && S_ISREG(inode->i_mode);
188}
189
176bool transparent_hugepage_active(struct vm_area_struct *vma);190bool transparent_hugepage_active(struct vm_area_struct *vma);
177 191
178#define transparent_hugepage_use_zero_page() \192#define transparent_hugepage_use_zero_page() \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t