Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp68418imm; Mon, 14 May 2018 21:09:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpfJ5RwZiM1njW3opi7ey5IN7UUAJ+YsSSmO60tBLY45aAuxeQQt40YqlJBkwH284wStbLE X-Received: by 2002:a63:7907:: with SMTP id u7-v6mr1176662pgc.85.1526357346294; Mon, 14 May 2018 21:09:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526357346; cv=none; d=google.com; s=arc-20160816; b=ye+4XjNu0NrkWbsJEZHkiIixAHG4UIfbDpRQeowpL7odXaq2BvxOhOUS3QdkMkvF1T 5gEMkr9N1Jtt3OhLXMPnzOAPeEWn02kro9Bk9T1rgrMixNiTtFxT4+7Xi6fXJuXifmrX YeSWXifai12ltZb6dMr+Hzhd7uHxk6VLS2VaZBqapLUZjN5lpE4ioJNTprdvqsFLWjl8 4AJcXV/lmam4rzH88F+4iG/PHahSOlxECzhhB0FlXO0OZS2iThj0JMYLxoTpXzdRu3q0 Q58o/jnuzVEdJXtcjBl1i8VaSQRtzwak00Wr2/B977WfVVJcfaksALtWwmYoLyhpSUtF Wm1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=xQ5Po2hfSBIS2BDk/g7fXex7vkMx7XX6lZjc1E9QqRE=; b=ZCDguP8bBLSXAUvpIsJcwaanwgaoroJcRVkzq9wc9i7H7aZ5z9xuqyz9twwh0Ujcr5 fQLJX7/pk2qShtj/5ldH2uBjMyoD3zL0DQZX+yBIGkaBbQllvcir2blWdn8Qbgc7bsSQ Y5D8REKfkYcwkuHUmCKTbIuwBQHobLzXY8sZXy3yA0/GEj9hbWhOLVGHdigLxUe+uCbI WACT1zJpFu2X4DwZWNS/FUJxiQkpaUay8kXhd2r8brGRdGh/gHwrTgg6lxLN9pvJbojT tYHOQjs41i9OQkerZQiAGLHXQxSDxQSqTq/JKzacDxT2prCITe3eyBIi7E3t/pgdKigY 0FVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lcTer8a2; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s1-v6si8811801pgq.282.2018.05.14.21.08.49; Mon, 14 May 2018 21:09:06 -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=pass header.i=@gmail.com header.s=20161025 header.b=lcTer8a2; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752116AbeEOEIh (ORCPT + 99 others); Tue, 15 May 2018 00:08:37 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:35111 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750759AbeEOEIg (ORCPT ); Tue, 15 May 2018 00:08:36 -0400 Received: by mail-lf0-f66.google.com with SMTP id y72-v6so21188316lfd.2 for ; Mon, 14 May 2018 21:08:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=xQ5Po2hfSBIS2BDk/g7fXex7vkMx7XX6lZjc1E9QqRE=; b=lcTer8a2iDGkZvmWsjFnBlnRMnrKyxPF5yG27qH/Ma5q/MuIJXK4uaMtSOC/mZIFyA qgKPVD/0gSr8p1fS345KtbnB22jtEahAfJxA+QiDjP8DqAg0rPsL7tovxD008P+s+yyk MUF+RuKu8Sd2HC4UupJ4ENWgTf6FM5NFoIoaT7X6Vd4RTHQdoGQPJsukb0e7WK//xj0r y1y9AtoeKtoWgvXxdmbtzPF8DYH7G+bcFVSFb7Hl+58INluRCqONhSzqJ4+TSJDBMdTp JNHx3mo6AaFf9VESLHCucr4o1Go4MU9UP6JMWC3kEazSgm48O+Mtb7kbQiapUhtNphiG 1GNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xQ5Po2hfSBIS2BDk/g7fXex7vkMx7XX6lZjc1E9QqRE=; b=KH42H1HPxXa7Tu1OUaGvHTWWRV5EVu9qVeg9CZGdz58PEfpzW28oJAv2bbP6eEnpJ2 nfow6lbVGsqLjkeToV4W5IERY6OVocb+Yk0Gjj9tc83wCelQivI4CRHP000IBw35QSiu GjdRBP7ZB2OgvNIc9wW8+g4Ip1cMRRGSTGYqllX6NLwOysi41lLsfTmsVXw2MjKmzuB+ KddMYOrIQ4ImzOnBoUqWOsvQjB5ukx2qXhk2sFNmm2k3px5LUa8W9zzGfCMmhbSmCcN/ v0IMaDUDtl9MzyFPuVxa/j7PJ053qe4ZgdWKffGbN8P6parkG0hzfoHLtittEvRwrb/W dRSg== X-Gm-Message-State: ALKqPwdYypqQzG96YChxo0mMip+r6V/cNJNanlYoRM8TpPSXuSj2xCZG tv9o310cKWFok+HiFMjzT0U= X-Received: by 2002:a2e:9248:: with SMTP id v8-v6mr6352396ljg.133.1526357314938; Mon, 14 May 2018 21:08:34 -0700 (PDT) Received: from esperanza (81.5.110.211.dhcp.mipt-telecom.ru. [81.5.110.211]) by smtp.gmail.com with ESMTPSA id h20-v6sm2080247ljj.85.2018.05.14.21.08.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 May 2018 21:08:34 -0700 (PDT) Date: Tue, 15 May 2018 07:08:32 +0300 From: Vladimir Davydov To: Kirill Tkhai Cc: akpm@linux-foundation.org, shakeelb@google.com, viro@zeniv.linux.org.uk, hannes@cmpxchg.org, mhocko@kernel.org, tglx@linutronix.de, pombredanne@nexb.com, stummala@codeaurora.org, gregkh@linuxfoundation.org, sfr@canb.auug.org.au, guro@fb.com, mka@chromium.org, penguin-kernel@I-love.SAKURA.ne.jp, chris@chris-wilson.co.uk, longman@redhat.com, minchan@kernel.org, ying.huang@intel.com, mgorman@techsingularity.net, jbacik@fb.com, linux@roeck-us.net, linux-kernel@vger.kernel.org, linux-mm@kvack.org, willy@infradead.org, lirongqing@baidu.com, aryabinin@virtuozzo.com Subject: Re: [PATCH v5 10/13] mm: Set bit in memcg shrinker bitmap on first list_lru item apearance Message-ID: <20180515040832.ukmrcdl5czqpldgv@esperanza> References: <152594582808.22949.8353313986092337675.stgit@localhost.localdomain> <152594602582.22949.2526776640167844592.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <152594602582.22949.2526776640167844592.stgit@localhost.localdomain> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 10, 2018 at 12:53:45PM +0300, Kirill Tkhai wrote: > Introduce set_shrinker_bit() function to set shrinker-related > bit in memcg shrinker bitmap, and set the bit after the first > item is added and in case of reparenting destroyed memcg's items. > > This will allow next patch to make shrinkers be called only, > in case of they have charged objects at the moment, and > to improve shrink_slab() performance. > > Signed-off-by: Kirill Tkhai > --- > include/linux/memcontrol.h | 15 +++++++++++++++ > mm/list_lru.c | 22 ++++++++++++++++++++-- > 2 files changed, 35 insertions(+), 2 deletions(-) > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > index e5e7e0fc7158..82f892e77637 100644 > --- a/include/linux/memcontrol.h > +++ b/include/linux/memcontrol.h > @@ -1274,6 +1274,21 @@ static inline void memcg_put_cache_ids(void) > > extern int memcg_shrinker_nr_max; > extern int memcg_expand_shrinker_maps(int old_id, int id); > + > +static inline void memcg_set_shrinker_bit(struct mem_cgroup *memcg, int nid, int nr) Nit: too long line (> 80 characters) Nit: let's rename 'nr' to 'shrinker_id' > +{ > + if (nr >= 0 && memcg && memcg != root_mem_cgroup) { > + struct memcg_shrinker_map *map; > + > + rcu_read_lock(); > + map = MEMCG_SHRINKER_MAP(memcg, nid); Missing rcu_dereference. > + set_bit(nr, map->map); > + rcu_read_unlock(); > + } > +} > +#else > +static inline void memcg_set_shrinker_bit(struct mem_cgroup *memcg, > + int node, int id) { } Nit: please keep the signature (including argument names) the same as in MEMCG-enabled definition, namely 'node' => 'nid', 'id' => 'shrinker_id'. Thanks.