Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp203467ybs; Tue, 26 May 2020 07:14:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+JsQIZJ9XctAh9/Qllj/YTaEBpKys8kvqvEtnASr0fWNBHnZGWJTkaU9EE8Z4Ro3W6Et0 X-Received: by 2002:a17:906:6843:: with SMTP id a3mr1242242ejs.245.1590502453105; Tue, 26 May 2020 07:14:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590502453; cv=none; d=google.com; s=arc-20160816; b=TKML6yeu7iDSJ/kWhof2iT6WrCGQENFOYCcbkbTH78CKZHDudCbbDuovRrUfQaQhJO O3Hqlz+DmzTQZUPU3FL8P8+wLqLUnMJbb10Ii3+8J8le1fQ0IOQsvwsj98rq3qDONi9J nysUtJ6shjzUnIz+F/ire1NtDiyiVQ/eTm6lbRRM746dHRaKiDxC+vKTUTwMGP/+PTOg 7YiEGTUgYHlvCCYjvFHVJnnpmU4cGthAEUVvsyZJjsr9ZuWuBpQ2DOCdRX1mtLGUo/NZ xKDFB/udtl/2RTRMu/BBNg2AV1ybuFWl1DC2X4AVuEAtsBbV49bFJUmp112hpQ1RVDgv p/rQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=uOXUk/Muvk+iOEVhByaQFWjm1qpZA3klj1LqGnYYXDA=; b=TLStIAvKkO9Pw6rWlZ26EZ1oHx3oS7A/nfZfT783mStafXMaO+LN3PWod/5/fKntoK O5vJqVGITSp7fxWI7v73sr50uei093ev9ZeytV5T83/eXIp6OFiAmN55FlRVuBFTPt4J QVj7JlXTCxcjPxWWiMi0Wk03vDlEoLw4fqV3QN4AWBhZaWNsv5FqCVp+5VLweLlbrz8v wgeVXE1737eBeVoGF7QoVrdG9J8e3dD7EsEBmFmDHF6lDN8X20C8rBTtqMbqjL2OPUgb UPWHuff4Tjkr9zNmyz56L1X772hoi3fwj8CPBnwmevYrZqL+0nOrtKYyqI78XTbJJUch XiKA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v7si868584edr.33.2020.05.26.07.13.49; Tue, 26 May 2020 07:14:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388757AbgEZKw0 (ORCPT + 99 others); Tue, 26 May 2020 06:52:26 -0400 Received: from mx2.suse.de ([195.135.220.15]:45716 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388486AbgEZKw0 (ORCPT ); Tue, 26 May 2020 06:52:26 -0400 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?