The patch titled Subject: mm-avoid-zeroing-user-movable-page-twice-with-init_on_alloc=1-fix has been added to the -mm mm-unstable branch. Its filename is mm-avoid-zeroing-user-movable-page-twice-with-init_on_alloc=1-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-avoid-zeroing-user-movable-page-twice-with-init_on_alloc=1-fix.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Zi Yan <ziy@xxxxxxxxxx> Subject: mm-avoid-zeroing-user-movable-page-twice-with-init_on_alloc=1-fix Date: Tue, 22 Oct 2024 10:33:40 -0400 comment fixes, per David Link: https://lkml.kernel.org/r/97DB52E1-C594-49B5-9736-89AC302FAB01@xxxxxxxxxx Signed-off-by: Zi Yan <ziy@xxxxxxxxxx> Cc: Alexander Potapenko <glider@xxxxxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: "Huang, Ying" <ying.huang@xxxxxxxxx> Cc: John Hubbard <jhubbard@xxxxxxxxxx> Cc: Kees Cook <keescook@xxxxxxxxxxxx> Cc: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: Miaohe Lin <linmiaohe@xxxxxxxxxx> Cc: Ryan Roberts <ryan.roberts@xxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/huge_memory.c | 5 +++++ mm/memory.c | 7 +++++++ 2 files changed, 12 insertions(+) --- a/mm/huge_memory.c~mm-avoid-zeroing-user-movable-page-twice-with-init_on_alloc=1-fix +++ a/mm/huge_memory.c @@ -1165,6 +1165,11 @@ static struct folio *vma_alloc_anon_foli } folio_throttle_swaprate(folio, gfp); + /* + * When a folio is not zeroed during allocation (__GFP_ZERO not used), + * folio_zero_user() is used to make sure that the page corresponding + * to the faulting address will be hot in the cache after zeroing. + */ if (!alloc_zeroed()) folio_zero_user(folio, addr); /* --- a/mm/memory.c~mm-avoid-zeroing-user-movable-page-twice-with-init_on_alloc=1-fix +++ a/mm/memory.c @@ -4719,6 +4719,13 @@ static struct folio *alloc_anon_folio(st goto next; } folio_throttle_swaprate(folio, gfp); + /* + * When a folio is not zeroed during allocation + * (__GFP_ZERO not used), folio_zero_user() is used + * to make sure that the page corresponding to the + * faulting address will be hot in the cache after + * zeroing. + */ if (!alloc_zeroed()) folio_zero_user(folio, vmf->address); return folio; _ Patches currently in -mm which might be from ziy@xxxxxxxxxx are mm-avoid-vm_bug_on-when-try-to-map-an-anon-large-folio-to-zero-page.patch mm-avoid-zeroing-user-movable-page-twice-with-init_on_alloc=1.patch mm-avoid-zeroing-user-movable-page-twice-with-init_on_alloc=1-fix.patch