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: <20190924134352.GC31919@MiWiFi-R3L-srv>
Date:   Tue, 24 Sep 2019 21:43:52 +0800
From:   Baoquan He <bhe@...hat.com>
To:     Michal Hocko <mhocko@...nel.org>
Cc:     akpm@...ux-foundation.org, tj@...nel.org,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH v2] memcg: Only record foreign writebacks with dirty
 pages when memcg is not disabled

On 09/24/19 at 03:16pm, Michal Hocko wrote:
> On Tue 24-09-19 21:04:58, Baoquan He wrote:
> > On 09/24/19 at 02:27pm, Michal Hocko wrote:
> > > On Tue 24-09-19 19:11:51, Baoquan He wrote:
> > > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > > > index f3c15bb07cce..84e3fdb1ccb4 100644
> > > > --- a/mm/memcontrol.c
> > > > +++ b/mm/memcontrol.c
> > > > @@ -4317,6 +4317,9 @@ void mem_cgroup_track_foreign_dirty_slowpath(struct page *page,
> > > >  
> > > >  	trace_track_foreign_dirty(page, wb);
> > > >  
> > > > +	if (mem_cgroup_disabled())
> > > > +		return;
> > > > +
> > > 
> > > This doesn't seem correct. We shouldn't even enter the slowpath with
> > > memcg disabled AFAIC. The check should be done at mem_cgroup_track_foreign_dirty
> > > level.
> > 
> > You mean the way in v1 patch, right? It's also fine to me.
> > 
> > I am worried about the case that memcg is enabled, the checking by
> > calling mem_cgroup_disabled() will lower efficiency.
> 
> This is hidden by a static branch so I wouldn't really be worried about
> the overhead.
> 
> > And it entering
> > into mem_cgroup_track_foreign_dirty_slowpath() should be a rare event.
> 
> But &page->mem_cgroup->css != wb->memcg_css doesn't make any sense when
> memcg is disabled, right?

Yeah, I think so. Make it like below?

@@ -1261,7 +1261,8 @@ void mem_cgroup_track_foreign_dirty_slowpath(struct page *page,
 static inline void mem_cgroup_track_foreign_dirty(struct page *page,
                                                  struct bdi_writeback *wb)
 {
-       if (unlikely(&page->mem_cgroup->css != wb->memcg_css))
+       if (!mem_cgroup_disabled() &&
+           unlikely(&page->mem_cgroup->css != wb->memcg_css))
                mem_cgroup_track_foreign_dirty_slowpath(page, wb);
 }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ