Message ID | 20200919042003.LTbtjVRr7%akpm@linux-foundation.org |
---|---|
State | New |
Headers | show |
Series | None | expand |
--- a/mm/ksm.c~ksm-reinstate-memcg-charge-on-copied-pages +++ a/mm/ksm.c @@ -2586,6 +2586,10 @@ struct page *ksm_might_need_to_copy(stru return page; /* let do_swap_page report the error */ new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address); + if (new_page && mem_cgroup_charge(new_page, vma->vm_mm, GFP_KERNEL)) { + put_page(new_page); + new_page = NULL; + } if (new_page) { copy_user_highpage(new_page, page, address, vma);