mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-31 06:14:39 +01:00
mm: align larger anonymous mappings on THP boundaries
Align larger anonymous memory mappings on THP boundaries by going through thp_get_unmapped_area if THPs are enabled for the current process. With this patch, larger anonymous mappings are now THP aligned. When a malloc library allocates a 2MB or larger arena, that arena can now be mapped with THPs right from the start, which can result in better TLB hit rates and execution time. Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Rik van Riel <[email protected]> Reviewed-by: Yang Shi <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Christopher Lameter <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
This commit is contained in:
1 parent
1803d0c5ee
commit
efa7df3e3b
1 file changed
+3
@@ -1829,6 +1829,9 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
|
||||
*/
|
||||
pgoff = 0;
|
||||
get_area = shmem_get_unmapped_area;
|
||||
} else if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
|
||||
/* Ensures that larger anonymous mappings are THP aligned. */
|
||||
get_area = thp_get_unmapped_area;
|
||||
}
|
||||
|
||||
addr = get_area(file, addr, len, pgoff, flags);
|
||||
|
||||
Reference in new issue
Block a user