mm: remove redundant clear page when CONFIG_INIT_ON_ALLOC_DEFAULT_ON configured

Message ID 20230911104906.2058503-1-zhaoyang.huang@unisoc.com
State New
Headers
Series mm: remove redundant clear page when CONFIG_INIT_ON_ALLOC_DEFAULT_ON configured |

Commit Message

zhaoyang.huang Sept. 11, 2023, 10:49 a.m. UTC
  From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>

There will be redundant clear page within vma_alloc_zeroed_movable_folio
when CONFIG_INIT_ON_ALLOC_DEFAULT_ON is on. Remove it by judging related
configs.

Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
---
 include/linux/highmem.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 99c474de800d..3926f8414729 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -227,7 +227,7 @@  struct folio *vma_alloc_zeroed_movable_folio(struct vm_area_struct *vma,
 	struct folio *folio;
 
 	folio = vma_alloc_folio(GFP_HIGHUSER_MOVABLE, 0, vma, vaddr, false);
-	if (folio)
+	if (folio && !want_init_on_alloc(GFP_HIGHUSER_MOVABLE))
 		clear_user_highpage(&folio->page, vaddr);
 
 	return folio;