[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20200421143435.GB341682@cmpxchg.org>
Date: Tue, 21 Apr 2020 10:34:35 -0400
From: Johannes Weiner <hannes@...xchg.org>
To: Hillf Danton <hdanton@...a.com>
Cc: Joonsoo Kim <js1304@...il.com>,
Alex Shi <alex.shi@...ux.alibaba.com>,
Shakeel Butt <shakeelb@...gle.com>,
Hugh Dickins <hughd@...gle.com>,
Michal Hocko <mhocko@...e.com>,
"Kirill A. Shutemov" <kirill@...temov.name>,
Roman Gushchin <guro@...com>, linux-mm@...ck.org,
cgroups@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-team@...com
Subject: Re: [PATCH 18/18] mm: memcontrol: update page->mem_cgroup stability
rules
On Tue, Apr 21, 2020 at 05:10:14PM +0800, Hillf Danton wrote:
>
> On Mon, 20 Apr 2020 18:11:26 -0400 Johannes Weiner wrote:
> >
> > The previous patches have simplified the access rules around
> > page->mem_cgroup somewhat:
> >
> > 1. We never change page->mem_cgroup while the page is isolated by
> > somebody else. This was by far the biggest exception to our rules
> > and it didn't stop at lock_page() or lock_page_memcg().
> >
> > 2. We charge pages before they get put into page tables now, so the
> > somewhat fishy rule about "can be in page table as long as it's
> > still locked" is now gone and boiled down to having an exclusive
> > reference to the page.
> >
> > Document the new rules. Any of the following will stabilize the
> > page->mem_cgroup association:
> >
> > - the page lock
> > - LRU isolation
> > - lock_page_memcg()
> > - exclusive access to the page
>
> Then rule-1 makes rule-3 no longer needed in mem_cgroup_move_account()?
Well, mem_cgroup_move_account() is the write side. It's the function
that changes page->mem_cgroup. So it needs to take all these locks in
order for the readside / fastpath to be okay with any one of them.
Powered by blists - more mailing lists