On Fri 17-01-20 12:42:05, Kirill Tkhai wrote: > On 17.01.2020 12:32, David Rientjes wrote: > > On Fri, 17 Jan 2020, Kirill Tkhai wrote: > > > >>>> I think that's a good point, especially considering that the current code > >>>> appears to unconditionally place any compound page on the deferred split > >>>> queue of the destination memcg. The correct list that it should appear > >>>> on, I believe, depends on whether the pmd has been split for the process > >>>> being moved: note the MC_TARGET_PAGE caveat in > >>>> mem_cgroup_move_charge_pte_range() that does not move the charge for > >>>> compound pages with split pmds. So when mem_cgroup_move_account() is > >>>> called with compound == true, we're moving the charge of the entire > >>>> compound page: why would it appear on that memcg's deferred split queue? > >>> > >>> I believe Kirill asked how do we know that the page should be actually > >>> added to the deferred list just from the list_empty check. In other > >>> words what if the page hasn't been split at all? > >> > >> Yes, I'm talking about this. Function mem_cgroup_move_account() adds every > >> huge page to the deferred list, while we need to do that only for pages, > >> which are queued for splitting... > >> > > > > Yup, and that appears broken before Wei's patch. Since we only migrate > > charges of entire compound pages (we have a mapping pmd, the underlying > > page cannot be split), it should not appear on the deferred split queue > > for any memcg, right? > > Hm. Can't a huge page be mapped in two tasks: It can but it will get charged to only of the initially. I haven't checked the THP code in that aspect but from what I remember subpages shouldn't refer to different memcgs. Kirill Shutemov? -- Michal Hocko SUSE Labs