Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp899877imm; Wed, 20 Jun 2018 08:21:13 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKY6yk7xaC76BLYKYAS2jitliUkBbn2aaLwe9smYHGuTw/m/4UzwJLx8lSYVDrG3DF8Ym/5 X-Received: by 2002:a62:f551:: with SMTP id n78-v6mr23565355pfh.200.1529508073342; Wed, 20 Jun 2018 08:21:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529508073; cv=none; d=google.com; s=arc-20160816; b=IloJVa+uwyOKEpuh5mwnNW759DPIeRF1T6HU5x00qGmac0RzVQ8NXp9MVMBuAku2uh 4lb0oyEh7OroaqWQ3hq6kKJmwknw12X01keFnt8/8ZtzNhQ3jUFvXv9dIQqQaz6tbM8z GVSuSz90MC2DadQWG3ziXeICI0PFe0M5WoxasMqOiAP3u0Jo6P97zcMg9fl+6FCsiFSS pYSufU+tO3GU63yeaNpHLCOLqSSki4xHvaX8TZb6+PUh5EAkzBnCYsjoWiH52nAW0rA9 lNZ7MxDmJABTKq/RY2tY84zzmx8TXZTAuEsMI5LHj8hgNu2yCEildVxwFFq/4aafaeDB 3I6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=ODfGZfJ34dLcUmeJ0tXg09XWEsQZcPRgJ3EeQerPpTE=; b=M0cHKu/SsJMvaoHXF8HOBYC+++KEZGTya8mhO79jXTIncaWmxkeufTu6ldcqY1YL7r sMPToc2deJRhEFabFWrSiLK6HOxhR3TI5Vyh02vXH2kcIWGRZu54Leoeu69DA5KmkdzL HJgZypFuTlWkZMRR5D5cqKtUZQfmE6nUHISaaCro1fZqJpuUcLCixLTeDO9lmBW/6/fh 38pInY2QGuZzEbldzakbGv2IIdRhCEJBT+NVe8p7+g8f/JnMvRnW7Q8xVu05ov3pW8Hq yVE+A0QLo8wVjLQrKwL25PEjbPV06o5b8aGDgiskLHUNls7sMgmGWJR+fIXSVkVqB6AO eeWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@cmpxchg.org header.s=x header.b=SDq+eh9h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y2-v6si2153463pgr.677.2018.06.20.08.20.58; Wed, 20 Jun 2018 08:21:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@cmpxchg.org header.s=x header.b=SDq+eh9h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754189AbeFTPUU (ORCPT + 99 others); Wed, 20 Jun 2018 11:20:20 -0400 Received: from gum.cmpxchg.org ([85.214.110.215]:48592 "EHLO gum.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753853AbeFTPUS (ORCPT ); Wed, 20 Jun 2018 11:20:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=cmpxchg.org ; s=x; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject: Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ODfGZfJ34dLcUmeJ0tXg09XWEsQZcPRgJ3EeQerPpTE=; b=SDq+eh9h8Nlh26PWdUiBzUB84E mNkefWmSe0TwXlEUJDjor4JDs9dF+dJ220eqbnl5lED4PeNd7nHe81YdsoZsZSVYa+/98sl2VoD9U M4pjOOpEMuKGUTLZklv9iYv6VkbI14zQoJ84MzoF60zp74xmZkBP8vy33Hdt4Uv7Fwyo=; 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: User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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!