Received: by 10.213.65.68 with SMTP id h4csp5877imn; Sat, 24 Mar 2018 11:46:49 -0700 (PDT) X-Google-Smtp-Source: AG47ELu0RapGKPvW1YVslQ/FT51UQKDx/qk9rsoHqPA1ENLBHsAxRa/V5cYmew4lpo3ebg+lBy2I X-Received: by 10.99.3.144 with SMTP id 138mr24537992pgd.364.1521917209439; Sat, 24 Mar 2018 11:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521917209; cv=none; d=google.com; s=arc-20160816; b=JbMcM6IcPr5+eJysL9KYVdRY44Z2nqqMlUtlBRuUTAwbetAjXwzOmK1oNCQe9XEzvB KBjLgIud+BuyC2Bt2FyCXJYE9J9QVoesWP35xLxeFQgWOAPyDtoFrryvAQxMxdV5oGOH WJOdSENfO8v6B41a2rwzwtgKtq/aFOUrVe7HUeaQnHRwRREue32GCPbQgy2Ql8K6OpGR 3uS1SWM/QRkmUFd70ZnUP4B1z+KInagXnDxW4pTBtWlsQPUnXET0engeO8ux514Ocj73 FETu/PKhIwnWYJUzEaTY80Akqp5SmeFbpro83qF/qqt8t89ms+TRQWjEZZttygKfGn11 Eo0g== 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=01eGxy/TyqSnibBdGyokv1RLpRm1TUHGWl/nqDSS0ck=; b=VJauCGgm76Dy30a0SFcOiC0BmJKq4v1F5b8CGepKXWfpCm6o7EEDi+CwnX76W0RdvU gLPzyskdbzs9Zi376/YFF0BNR1xBJ6NTg3O/hkTQ5tda7nxkzU/1eOO8HMHprj4plZpU B7PuMzWjWuDRHtWk5Fgjw8Z0zEE379dKHmmGlXGYLzBX45v147ZQuvdnme/pcO/3pwLU oILwe+mdDZfargoqFhzNi+8YapBveaYB4lBkFcC+rmURiTE3tZVgcKc8tIJ+JKhoGou6 Q3q3pRYqREHnnV/qqlZCmFds4M4CeHgiywaHGCkU3saTZoRvwznwJ92ZACwatzGEIJ2/ 6yIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JbCOK8Bn; 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 m1si7841939pgu.633.2018.03.24.11.46.34; Sat, 24 Mar 2018 11:46:49 -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=JbCOK8Bn; 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 S1752754AbeCXSpW (ORCPT + 99 others); Sat, 24 Mar 2018 14:45:22 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:41631 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752682AbeCXSpV (ORCPT ); Sat, 24 Mar 2018 14:45:21 -0400 Received: by mail-lf0-f66.google.com with SMTP id o102-v6so22707749lfg.8 for ; Sat, 24 Mar 2018 11:45:20 -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=01eGxy/TyqSnibBdGyokv1RLpRm1TUHGWl/nqDSS0ck=; b=JbCOK8BnQ0hwEIRLVvEy6n6gq6kkJec3jUKZincHDreD28sldxclRZtjNG0eFslKFr aeRr973XuGlhf4XaWuCTqSi0jiloCz1o96bzYSftfj/hgzgrgDkAxKDWFBkyF5id+pFP D/1Ji+iW5XXKCQzyYFr+JQ6Sx6TL2aVK1wVnyC6I2oPT9MxlcmkvuSGUyfgOiLeeerdr +3qJCsOccZ/oI5hhbufen3hWuW8cfHjurXFU0UZmYmS/ibiRysMeOtcgFKbnad9ee6Fw bVZ0FlffKdMLE7wk7o2X9fYweNMQqKSAaWk4t7oiqIgQjU5ZWRoB31ElUPoDv4xLnnEU RJFg== 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=01eGxy/TyqSnibBdGyokv1RLpRm1TUHGWl/nqDSS0ck=; b=HKuVD/DHI4H6Sw4+l0YO5sfHhyciq6h9QmtU+Biw0KVtlC7imx8SVLjloNc9pjZmKI FC4zHVkFWdO+ezKjbViHcVQQ/r/4icjlDlYPgVx1ra8bTkvFXH1aZG7BkLzaYMl2YW2W yUUyNoEPvEmMQ7D12VsbUfIh6epuZH05FyQ8s5MQ/ikmMOuOADSosqvEJpPtzDUwDDYV tFLsBiEnR1CoPx7nu2tNyfGN/scaUBQVQUgeXm+lyk6tI/Qqf1/Qcykyv2KiJxmiJXtE 0RFBxz8suV+D+BVZwS1pIdGjmei2jxeMrobHcNH4CjavBp/g9Z10qNCL7Pqd6KfkfI1o Z60w== X-Gm-Message-State: AElRT7FZKe2TDIyXpa8RnrrJMhR4g8BL05sO9GuKANw29zUbsgb5DgBq Oqu3exGRYXMx5moUcPsyEZU= X-Received: by 10.46.15.26 with SMTP id 26mr23665298ljp.147.1521917119694; Sat, 24 Mar 2018 11:45:19 -0700 (PDT) Received: from esperanza (81.5.110.211.dhcp.mipt-telecom.ru. [81.5.110.211]) by smtp.gmail.com with ESMTPSA id r81sm1371546lja.57.2018.03.24.11.45.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 24 Mar 2018 11:45:19 -0700 (PDT) Date: Sat, 24 Mar 2018 21:45:16 +0300 From: Vladimir Davydov To: Kirill Tkhai Cc: viro@zeniv.linux.org.uk, hannes@cmpxchg.org, mhocko@kernel.org, akpm@linux-foundation.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, hillf.zj@alibaba-inc.com, ying.huang@intel.com, mgorman@techsingularity.net, shakeelb@google.com, jbacik@fb.com, linux@roeck-us.net, linux-kernel@vger.kernel.org, linux-mm@kvack.org, willy@infradead.org Subject: Re: [PATCH 02/10] mm: Maintain memcg-aware shrinkers in mcg_shrinkers array Message-ID: <20180324184516.rogvydnnupr7ah2l@esperanza> References: <152163840790.21546.980703278415599202.stgit@localhost.localdomain> <152163848990.21546.2153496613786165374.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <152163848990.21546.2153496613786165374.stgit@localhost.localdomain> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 21, 2018 at 04:21:29PM +0300, Kirill Tkhai wrote: > The patch introduces mcg_shrinkers array to keep memcg-aware > shrinkers in order of their shrinker::id. > > This allows to access the shrinkers dirrectly by the id, > without iteration over shrinker_list list. Why don't you simply use idr instead of ida? With idr you wouldn't need the array mapping shrinker id to shrinker ptr. AFAIU you need this mapping to look up the shrinker by id in shrink_slab. The latter doesn't seem to be a hot path so using idr there should be acceptable. Since we already have shrinker_rwsem, which is taken for reading by shrink_slab, we wouldn't even need any additional locking for it.