From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69720C433E0 for ; Tue, 26 May 2020 10:52:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 338CE2084C for ; Tue, 26 May 2020 10:52:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 338CE2084C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A7566800A1; Tue, 26 May 2020 06:52:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A260F80061; Tue, 26 May 2020 06:52:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 93B4E800A1; Tue, 26 May 2020 06:52:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0085.hostedemail.com [216.40.44.85]) by kanga.kvack.org (Postfix) with ESMTP id 7AD7980061 for ; Tue, 26 May 2020 06:52:27 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 43D764DDA for ; Tue, 26 May 2020 10:52:27 +0000 (UTC) X-FDA: 76858556334.06.pan94_327fd84dc6e12 X-HE-Tag: pan94_327fd84dc6e12 X-Filterd-Recvd-Size: 2744 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Tue, 26 May 2020 10:52:26 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3477EAC4A; Tue, 26 May 2020 10:52:28 +0000 (UTC) Subject: Re: [PATCH v3 15/19] mm: memcg/slab: deprecate slab_root_caches To: Roman Gushchin , Andrew Morton Cc: Johannes Weiner , Michal Hocko , linux-mm@kvack.org, kernel-team@fb.com, linux-kernel@vger.kernel.org References: <20200422204708.2176080-1-guro@fb.com> <20200422204708.2176080-16-guro@fb.com> From: Vlastimil Babka Message-ID: <613dda66-4fa6-1820-50c4-c7b28235e687@suse.cz> Date: Tue, 26 May 2020 12:52:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200422204708.2176080-16-guro@fb.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 4/22/20 10:47 PM, Roman Gushchin wrote: > Currently there are two lists of kmem_caches: > 1) slab_caches, which contains all kmem_caches, > 2) slab_root_caches, which contains only root kmem_caches. > > And there is some preprocessor magic to have a single list > if CONFIG_MEMCG_KMEM isn't enabled. > > It was required earlier because the number of non-root kmem_caches > was proportional to the number of memory cgroups and could reach > really big values. Now, when it cannot exceed the number of root > kmem_caches, there is really no reason to maintain two lists. > > We never iterate over the slab_root_caches list on any hot paths, > so it's perfectly fine to iterate over slab_caches and filter out > non-root kmem_caches. > > It allows to remove a lot of config-dependent code and two pointers > from the kmem_cache structure. > > Signed-off-by: Roman Gushchin Reviewed-by: Vlastimil Babka > @@ -1148,11 +1126,12 @@ static void cache_show(struct kmem_cache *s, struct seq_file *m) > > static int slab_show(struct seq_file *m, void *p) > { > - struct kmem_cache *s = list_entry(p, struct kmem_cache, root_caches_node); > + struct kmem_cache *s = list_entry(p, struct kmem_cache, list); > > - if (p == slab_root_caches.next) > + if (p == slab_caches.next) > print_slabinfo_header(m); > - cache_show(s, m); > + if (is_root_cache(s)) > + cache_show(s, m); If there wasn't patch 17/19 we could just remove this condition and have /proc/slabinfo contain the -memcg variants?