[PATCH OLK-6.6] mm: mem_reliable: fix task reliable counter during fork
Offering: HULK hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8USBA -------------------------------- Commit 8fc2546f8508 ("proc: mem_reliable: Count reliable memory usage of reliable tasks") introduce counting reliable memory allocated by the reliable user tasks which need to update reliable counter after rss. However during commit 1741ac635805 ("mm/memory: optimize fork() with PTE-mapped THP") which introduce PTE batching when consecutive present PTEs map consecutive pages of the same large folio and share identical bits aside from PFNs. This patch introuce rss modification without updating memory reliale's counter which lead to memory relabies's counter inbalanced during fork with thp disabled. Fix this by updating memory reliable's counter after rss updates. Fixes: 1741ac635805 ("mm/memory: optimize fork() with PTE-mapped THP") Signed-off-by: Wupeng Ma <mawupeng1@huawei.com> --- mm/memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index d5932b924e08..75900321740f 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -937,6 +937,7 @@ copy_present_page(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma folio_add_new_anon_rmap(new_folio, dst_vma, addr, RMAP_EXCLUSIVE); folio_add_lru_vma(new_folio, dst_vma); rss[MM_ANONPAGES]++; + add_reliable_folio_counter(new_folio, dst_vma->vm_mm, 1); /* All done, just insert the new page copy in the child */ pte = mk_pte(&new_folio->page, dst_vma->vm_page_prot); @@ -1021,6 +1022,7 @@ copy_present_ptes(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma folio_dup_file_rmap_ptes(folio, page, nr); rss[mm_counter_file(folio)] += nr; } + add_reliable_folio_counter(folio, dst_vma->vm_mm, nr); if (any_writable) pte = pte_mkwrite(pte, src_vma); __copy_present_ptes(dst_vma, src_vma, dst_pte, src_pte, pte, @@ -1048,8 +1050,8 @@ copy_present_ptes(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma } else { folio_dup_file_rmap_pte(folio, page); rss[mm_counter_file(folio)]++; - add_reliable_folio_counter(folio, dst_vma->vm_mm, 1); } + add_reliable_folio_counter(folio, dst_vma->vm_mm, 1); copy_pte: __copy_present_ptes(dst_vma, src_vma, dst_pte, src_pte, pte, addr, 1); -- 2.43.0
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/19725 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/2GU... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/19725 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/2GU...
participants (2)
-
patchwork bot -
Wupeng Ma