From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Wed, 20 Jun 2018 11:22:35 -0400 From: Johannes Weiner To: Shakeel Butt Cc: Andrew Morton , Michal Hocko , Vladimir Davydov , Jan Kara , Greg Thelen , LKML , Cgroups , linux-fsdevel , Linux MM , Jan Kara , Amir Goldstein , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Mel Gorman , Vlastimil Babka , Alexander Viro Subject: Re: [PATCH 1/3] mm: memcg: remote memcg charging for kmem allocations Message-ID: <20180620152235.GB2441@cmpxchg.org> References: <20180619051327.149716-1-shakeelb@google.com> <20180619051327.149716-2-shakeelb@google.com> <20180619162429.GB27423@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: On Tue, Jun 19, 2018 at 04:31:18PM -0700, Shakeel Butt wrote: > On Tue, Jun 19, 2018 at 9:22 AM Johannes Weiner wrote: > > > > On Mon, Jun 18, 2018 at 10:13:25PM -0700, Shakeel Butt wrote: > > > @@ -248,6 +248,30 @@ static inline void memalloc_noreclaim_restore(unsigned int flags) > > > current->flags = (current->flags & ~PF_MEMALLOC) | flags; > > > } > > > > > > +#ifdef CONFIG_MEMCG > > > +static inline struct mem_cgroup *memalloc_memcg_save(struct mem_cgroup *memcg) > > > +{ > > > + struct mem_cgroup *old_memcg = current->target_memcg; > > > + > > > + current->target_memcg = memcg; > > > + return old_memcg; > > > +} > > > + > > > +static inline void memalloc_memcg_restore(struct mem_cgroup *memcg) > > > +{ > > > + current->target_memcg = memcg; > > > +} > > > > The use_mm() and friends naming scheme would be better here: > > memalloc_use_memcg(), memalloc_unuse_memcg(), current->active_memcg > > > > Ack. Though do you still think is the right place > for these functions? Yeah, since it has the memalloc_* prefix, we should keep it there. If we did use_memcg(), unuse_memcg(), I'd put it into memcontrol.h, but it seems a little terse; memalloc adds valuable context, IMO. Thanks Shakeel!