From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-f197.google.com (mail-io0-f197.google.com [209.85.223.197]) by kanga.kvack.org (Postfix) with ESMTP id EF00B6B0005 for ; Wed, 18 Apr 2018 11:02:35 -0400 (EDT) Received: by mail-io0-f197.google.com with SMTP id x7-v6so1818027iob.21 for ; Wed, 18 Apr 2018 08:02:35 -0700 (PDT) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0134.outbound.protection.outlook.com. [104.47.1.134]) by mx.google.com with ESMTPS id f82-v6si1520489itf.9.2018.04.18.08.02.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Apr 2018 08:02:34 -0700 (PDT) Subject: Re: [PATCH v2 01/12] mm: Assign id to every memcg-aware shrinker References: <152397794111.3456.1281420602140818725.stgit@localhost.localdomain> <152399118252.3456.17590357803686895373.stgit@localhost.localdomain> <201804182314.IIG86990.MFVJSFQLFOtHOO@I-love.SAKURA.ne.jp> <201804182332.FAC65178.FLVJFMSOtHOFQO@I-love.SAKURA.ne.jp> From: Kirill Tkhai Message-ID: <3a9fe2e8-284a-3d0a-8e75-617e9803e02c@virtuozzo.com> Date: Wed, 18 Apr 2018 18:02:26 +0300 MIME-Version: 1.0 In-Reply-To: <201804182332.FAC65178.FLVJFMSOtHOFQO@I-love.SAKURA.ne.jp> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Tetsuo Handa , willy@infradead.org, wei.w.wang@intel.com Cc: akpm@linux-foundation.org, 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, chris@chris-wilson.co.uk, longman@redhat.com, minchan@kernel.org, hillf.zj@alibaba-inc.com, ying.huang@intel.com, mgorman@techsingularity.net, jbacik@fb.com, linux@roeck-us.net, linux-kernel@vger.kernel.org, linux-mm@kvack.org, lirongqing@baidu.com, aryabinin@virtuozzo.com On 18.04.2018 17:32, Tetsuo Handa wrote: > Kirill Tkhai wrote: >> On 18.04.2018 17:14, Tetsuo Handa wrote: >>> 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. >>> >>> I'm not reading this thread. But is there reason "id" needs to be managed >>> using smallest numbers? Can't we use address of shrinker object as "id" >>> (which will be sparse bitmap, and would be managed using linked list for now)? >> >> Yes, it's needed to have the smallest numbers, as next patches introduce >> per-memcg bitmap containing ids of shrinkers. > > If you use sparse bitmap (xbitmap ?), I think you can do it. There is no implementation in kernel, and search gave me this link: https://patchwork.kernel.org/patch/10128397/ The problem is that it may allocate memory, and hence to fail. While adding an element to shrinker lists (and setting a bit in bitmap) mustn't fail. So, it's not possible to use sparse bitmap. Kirill