Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp39377imm; Mon, 14 May 2018 20:30:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpj5gN6LE5X3VfGIIHAYFMQnZiK0c7felnYzC4m39JY5PMYKp3wyOm99HyKEevhX4DddlnC X-Received: by 2002:a63:ae42:: with SMTP id e2-v6mr6514315pgp.424.1526355002242; Mon, 14 May 2018 20:30:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526355002; cv=none; d=google.com; s=arc-20160816; b=DKsIeLzQ8nWWUFdeLcuodNsD1EWTcIcRjuYuONweGXtIX3XGs05gQFgBlEdi0VBOdj qZq5qZBfL81FPU5BNQoR9mzSGqWwkylACYCFJOJTD2eE93Ou37dNboN6owCZYwE/E8Fe kdIt53SzfDAOujOF0rQzygICIhoZ9Z/Ne5Ab1PVM+m/U6V3NVLNg7fz5U8m6FSJ7cYB8 rDDE02Wwj0rf2gyGZvsMV/FPOzib1VbShtcPD7+lpjRUWz2Dj4+jlp7DQYYlKkYHofto Td/JqufQ/LdD9BqvhRNTjxYR4TwJX19K5eh9s9i9qAFlXSJ3HKsSwM1LR3MCJyQYuQP0 yPAg== 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=2Lj4naZtZqt9irH9/MoqsnFeZIJXiLGfMZqBHu0zp2U=; b=RIH0pxUnVmIOJV0kXICHDyreDwNgMvYpVdnsowy/stQkHDFUL4gVTehSM4a893o+5A eLIRA/rZu8MiVwkEOaEUPySq6l84b51FjidpGw1BP1+APcdjxLQoOdH8at/lHfL9V3BZ X1lls2I2pTGEvHxq6o1cukyUfRhYV1dX+RRwFOcxAdBM1w30Yh2w8d1bHssKyOeMd4Uc 7xxzeJyHMr6cH9Lnm7gXsK5x0wUwXBOcv7Rz7HRdn5kzx6rU3qWl3PLKRCEx7mWgs8Nf NvyYqiXyyNz7HsdgmFMwhLNX4UY75HhpLOvdy/QPl5YUGxUZ3gWSbWrJL3srrveQCO/F DBvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sXepanG6; 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 a68-v6si11062930pli.158.2018.05.14.20.29.47; Mon, 14 May 2018 20:30:02 -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=sXepanG6; 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 S1752243AbeEOD3P (ORCPT + 99 others); Mon, 14 May 2018 23:29:15 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:37039 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752079AbeEOD3O (ORCPT ); Mon, 14 May 2018 23:29:14 -0400 Received: by mail-lf0-f68.google.com with SMTP id r2-v6so21111668lff.4 for ; Mon, 14 May 2018 20:29:13 -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=2Lj4naZtZqt9irH9/MoqsnFeZIJXiLGfMZqBHu0zp2U=; b=sXepanG6NyOuABcxKUlLd8xbIc2rg+faajbJw125zURRvX2Ide4MWj/uFScu2mP4RL GPfu1ybZP+AL8bvPn7blBg1M6OG7HH867J5EGRD8tE0K4Wlevwt5D9ZuydXw0abejVIp SR6GSN66zMUeg70m4pki7rPLS9vQqmnPf69dI5h8zr3pDFYgHwvimT0NqgrqfV+VsRNY GzrTjHVhtOpmpXrbRCi0p/n4lGAjoBRNWmra/DA9AEhapoil62OUS4QiMQPgRZFvoG7l ZWpz74w18SrWaiNw+gdoPfLKZPCvBkAp21wtBIzLJUwGTthPxVJH160Sv9dgDWOm28sU dVzw== 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=2Lj4naZtZqt9irH9/MoqsnFeZIJXiLGfMZqBHu0zp2U=; b=rfbBxwJRS66Qfc+lEL0OO2Rzk3U3BJG47GOsRcHibImlTn4dxYjBHq8xrZxBuGdKbe 7Buj1nvmFSiyL24r2I2Y4IGeyFZes/K/8ByuQ5ASRGmvDXWItpbh9a1gYY8olriVqUPH aGDz29IRtzWvo7I6qUYFoQsYwHosdL5vPOyE/D0KohD36lZRP39Jmbm9wdOVzkuZGcLx VVaAB434roPY5cmRYwYydNtnB8UsOQtVJ6Xalb88MzceDbPvgjDPX3nipNbIAIArIxVK ermGLU+YOylhU8O3AZayo7fqrnAecHaYDroq/reVeOKv1aapj2DdDOCz0H/3ZlxXIAgy o3zg== X-Gm-Message-State: ALKqPweBvgGMXqhbx3yQRGB14ZAbXdvLge+DBUbSLC1HPF+Hy1Q+kq7T jJpMDl6XJ8+wZcUYPT9XYcE= X-Received: by 2002:a19:ded9:: with SMTP id i86-v6mr10883794lfl.42.1526354952858; Mon, 14 May 2018 20:29:12 -0700 (PDT) Received: from esperanza (81.5.110.211.dhcp.mipt-telecom.ru. [81.5.110.211]) by smtp.gmail.com with ESMTPSA id b20-v6sm2043597ljf.51.2018.05.14.20.29.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 May 2018 20:29:11 -0700 (PDT) Date: Tue, 15 May 2018 06:29:09 +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 01/13] mm: Assign id to every memcg-aware shrinker Message-ID: <20180515032909.kjbhxxg7463nnvwo@esperanza> References: <152594582808.22949.8353313986092337675.stgit@localhost.localdomain> <152594593798.22949.6730606876057040426.stgit@localhost.localdomain> <20180513051509.df2tcmbhxn3q2fp7@esperanza> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 14, 2018 at 12:03:38PM +0300, Kirill Tkhai wrote: > On 13.05.2018 08:15, Vladimir Davydov wrote: > > On Thu, May 10, 2018 at 12:52:18PM +0300, Kirill Tkhai wrote: > >> The patch introduces shrinker::id number, which is used to enumerate > >> memcg-aware shrinkers. The number start from 0, and the code tries > >> to maintain it as small as possible. > >> > >> This will be used as to represent a memcg-aware shrinkers in memcg > >> shrinkers map. > >> > >> Since all memcg-aware shrinkers are based on list_lru, which is per-memcg > >> in case of !SLOB only, the new functionality will be under MEMCG && !SLOB > >> ifdef (symlinked to CONFIG_MEMCG_SHRINKER). > > > > Using MEMCG && !SLOB instead of introducing a new config option was done > > deliberately, see: > > > > http://lkml.kernel.org/r/20151210202244.GA4809@cmpxchg.org > > > > I guess, this doesn't work well any more, as there are more and more > > parts depending on kmem accounting, like shrinkers. If you really want > > to introduce a new option, I think you should call it CONFIG_MEMCG_KMEM > > and use it consistently throughout the code instead of MEMCG && !SLOB. > > And this should be done in a separate patch. > > What do you mean under "consistently throughout the code"? Should I replace > all MEMCG && !SLOB with CONFIG_MEMCG_KMEM over existing code? Yes, otherwise it looks messy - in some places we check !SLOB, in others we use CONFIG_MEMCG_SHRINKER (or whatever it will be called). > > >> diff --git a/fs/super.c b/fs/super.c > >> index 122c402049a2..16c153d2f4f1 100644 > >> --- a/fs/super.c > >> +++ b/fs/super.c > >> @@ -248,6 +248,9 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags, > >> s->s_time_gran = 1000000000; > >> s->cleancache_poolid = CLEANCACHE_NO_POOL; > >> > >> +#ifdef CONFIG_MEMCG_SHRINKER > >> + s->s_shrink.id = -1; > >> +#endif > > > > No point doing that - you are going to overwrite the id anyway in > > prealloc_shrinker(). > > Not so, this is done deliberately. alloc_super() has the only "fail" label, > and it handles all the allocation errors there. The patch just behaves in > the same style. It sets "-1" to make destroy_unused_super() able to differ > the cases, when shrinker is really initialized, and when it's not. > If you don't like this, I can move "s->s_shrink.id = -1;" into > prealloc_memcg_shrinker() instead of this. Yes, please do so that we don't have MEMCG ifdefs in fs code. Thanks.