Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp58426imm; Tue, 3 Jul 2018 13:55:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfiLcj90btWgWwFERsg/xJeXEZZ+N2Kcd7xTgos2SdpyC213REXehXLq9PubCMPeLFFTCdt X-Received: by 2002:a62:e18:: with SMTP id w24-v6mr2264725pfi.145.1530651304956; Tue, 03 Jul 2018 13:55:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530651304; cv=none; d=google.com; s=arc-20160816; b=gf8qdPqoYTb+EYbq3wXnlnIzGB4SBFsKyq0gecUk5IlB3TeeS1eFQNkj12n48pVu5k Hy70CfPCK8fqc0VE6P5Sh3rThlrn/hmWmgBvZMfElLvPXTeTsUetKccKnKpN1f/1Tuwm 9O6x/K31BFSg/8/9Ha0f+WSq4zkmdtsa2RxlqFVwLza+58eCt1/rcfKubJFfjP1eXhAT ON43tPjOjN/fPUddxH5GuCqvhvYF4IDib7w7NFrq97tTyP2sqyz7mXRH6cK33hbpmeHv jCL14EueRWsrJfIrxqDfV+GDR9Zrzp1keEk6iHAI3K5HK5LqdnNxSaV0P1ZClRb0DlFZ l8gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=qGhuwfBDWfYjbhTk9oaDkCZQlDascA2I5XAek0LvncE=; b=PxlH+klbGYTNYnccKrBQYB9j4oJJgKAA2VighuZUYHwva9C9YY5KbIud0Nrj8LaPZb PSUrYIGcEV6/s/3QWoZxGDP66eDqECn7eFLgU6kK+UXWVB1W2oNW8soDkuYbtgzOkoqN m2mj8eeRwBXz+nKSbPHpwLYGLx7kIRvLLtkT+wAl/pPAZTQap4ZPAfbj9A1+ZH6W/AMc lFkK0xzDMgSuX2dKh2u1Zepsw9WDoYKL546O5JLfXAA4QwJpTEijz99XPCxL9FPPFs9+ 79r5MI0RChXZyy4lMkiHtvQLRoF7g4ES5F8NgTFnt/Fr6KsOaAawtaLpnsJWCm40a5W3 dqHA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j72-v6si1981662pfe.187.2018.07.03.13.54.48; Tue, 03 Jul 2018 13:55:04 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752923AbeGCUyJ (ORCPT + 99 others); Tue, 3 Jul 2018 16:54:09 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42860 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752466AbeGCUyI (ORCPT ); Tue, 3 Jul 2018 16:54:08 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.9.92]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 277A0D06; Tue, 3 Jul 2018 20:54:07 +0000 (UTC) Date: Tue, 3 Jul 2018 13:54:06 -0700 From: Andrew Morton To: Kirill Tkhai Cc: vdavydov.dev@gmail.com, 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 v8 13/17] mm: Set bit in memcg shrinker bitmap on first list_lru item apearance Message-Id: <20180703135406.a5408dd14c31ddfa96894ada@linux-foundation.org> In-Reply-To: <153063065671.1818.15914674956134687268.stgit@localhost.localdomain> References: <153063036670.1818.16010062622751502.stgit@localhost.localdomain> <153063065671.1818.15914674956134687268.stgit@localhost.localdomain> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 03 Jul 2018 18:10:56 +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. > > ... > > --- a/include/linux/memcontrol.h > +++ b/include/linux/memcontrol.h > @@ -1308,6 +1308,18 @@ static inline int memcg_cache_id(struct mem_cgroup *memcg) > > extern int memcg_expand_shrinker_maps(int new_id); > > +static inline void memcg_set_shrinker_bit(struct mem_cgroup *memcg, > + int nid, int shrinker_id) > +{ > + if (shrinker_id >= 0 && memcg && !mem_cgroup_is_root(memcg)) { > + struct memcg_shrinker_map *map; > + > + rcu_read_lock(); > + map = rcu_dereference(memcg->nodeinfo[nid]->shrinker_map); > + set_bit(shrinker_id, map->map); > + rcu_read_unlock(); > + } > +} Three callsites, this seem rather large for inlining.