lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201001172713.GA500308@cmpxchg.org>
Date:   Thu, 1 Oct 2020 13:27:13 -0400
From:   Johannes Weiner <hannes@...xchg.org>
To:     Michal Koutný <mkoutny@...e.com>
Cc:     Roman Gushchin <guro@...com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Shakeel Butt <shakeelb@...gle.com>,
        Michal Hocko <mhocko@...nel.org>, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org, kernel-team@...com
Subject: Re: [PATCH v4 4/4] mm: convert page kmemcg type to a page memcg flag

On Thu, Oct 01, 2020 at 07:00:36PM +0200, Michal Koutný wrote:
> Hi.
> 
> On Wed, Sep 30, 2020 at 05:27:10PM -0700, Roman Gushchin <guro@...com> wrote:
> > @@ -369,8 +371,12 @@ enum page_memcg_data_flags {
> >   */
> >  static inline struct mem_cgroup *page_memcg(struct page *page)
> >  {
> > +	unsigned long memcg_data = page->memcg_data;
> > +
> >  	VM_BUG_ON_PAGE(PageSlab(page), page);
> > -	return (struct mem_cgroup *)page->memcg_data;
> > +	VM_BUG_ON_PAGE(memcg_data & MEMCG_DATA_OBJCGS, page);
> > +
> > +	return (struct mem_cgroup *)(memcg_data & ~MEMCG_DATA_FLAGS_MASK);
> >  }
> Shouldn't this change go also into page_memcg_rcu()? (I don't think the
> current single user (workingset_activation() would pass a non-slab
> kernel page but for consistency sake.)

+1

> Alternatively, I'm thinking why (in its single use) is there
> page_memcg_rcu() a separate function to page_memcg() (cross memcg page
> migration?).

It goes back to commit 55779ec759ccc3c12b917b3712a7716e1140c652.

The activation code is the only path where page migration is not
excluded. Because unlike with page state statistics, we don't really
mind a race when counting an activation event.

I do think there is a bug, though: mem_cgroup_move_account() should
use WRITE_ONCE() on page->mem_cgroup.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ