Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp814824ybm; Wed, 27 May 2020 08:39:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrdgQ6D7hZAsMBtoa8B9hquy9lO11PUvLf1hp4oqjzU2w7PCD8AiBc1w81zIqAKcfWy0Ls X-Received: by 2002:a50:cb8a:: with SMTP id k10mr24735431edi.345.1590593972319; Wed, 27 May 2020 08:39:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590593972; cv=none; d=google.com; s=arc-20160816; b=LnnrbEYv1xniHpgwE5YO4QJNePrrnuOlosa+6v55UbdgMXG5cDemL7O68tmRSnO/FM +I6KTXqG+6gjSDduFjFjG8Be7uIx5QL6NVSLDjwsOwaZbIlD7ATDdRLV6/cO002Q9NFg vRq6cB0B3wN6cFFJnpn9ZvqHB/t/BWTrOXE7XmnxO2SH2mqSh11XQtJBHyz5jXtcrRCJ 1OiIrMxzY0/bVMEoRXFqGaHS14qy/vo0CrLBuevThAW56NWhhUGSGo6IgfINXkNuo15d fPGw7dnPTvd5Xmpov7vbtSNYPYiVsU4r9YspcZLW4HRn24vTun4g5fCmLUICb5Vxfkpw 3z+w== 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=I/5kk7gOLou6cAcRaSFas0OhCOPK/bTPspseAl//4rY=; b=LaH+OOZtA74ht7OWDOoieDgStnKgn2rQxTc52DZzfx8dF43f7Pob6wNdYZ4lEJ5Bkf dEWs1wojz0k3A9rufdeNoKHFuk/QLK+cMfJQ4Crw0Gbzo3wghEqbrhakvmRebqbNdtwe qSHMxT3efGzN75nYq/7oHAYRAUuPvZeN9tFq90xxmfFHsHxmGeHPexYeb8Bevgayj6Hl 0oVav62n529tGSmSAJ4MrG55MGsm5iFR4lZYQtQJPOpOfaN1aFilg6OXyrgcBd3uKJi3 nf8MC+EaHJsJJrnt0M1R5XFHGAzmqQPtkxZfla/xjzmkCJ3zFn6cikBRUIQweYfsAsFP IY0A== 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 q5si1824273edr.568.2020.05.27.08.39.07; Wed, 27 May 2020 08:39:32 -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 S2387893AbgE0LDV (ORCPT + 99 others); Wed, 27 May 2020 07:03:21 -0400 Received: from mx2.suse.de ([195.135.220.15]:36164 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387800AbgE0LDT (ORCPT ); Wed, 27 May 2020 07:03:19 -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 297E0AC9F; Wed, 27 May 2020 11:03:21 +0000 (UTC) Subject: Re: [PATCH v3 08/19] mm: memcg/slab: save obj_cgroup for non-root slab objects To: Roman Gushchin Cc: Andrew Morton , 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-9-guro@fb.com> <3e02b3c6-2bf5-bddb-d855-83a1a1a54034@suse.cz> <20200526175330.GB377498@carbon.DHCP.thefacebook.com> From: Vlastimil Babka Message-ID: <90706966-b64d-751d-5f5a-b1e72fbfb30a@suse.cz> Date: Wed, 27 May 2020 13:03:17 +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: <20200526175330.GB377498@carbon.DHCP.thefacebook.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 5/26/20 7:53 PM, Roman Gushchin wrote: > On Mon, May 25, 2020 at 05:07:22PM +0200, Vlastimil Babka wrote: >> On 4/22/20 10:46 PM, Roman Gushchin wrote: >> > diff --git a/mm/slab.h b/mm/slab.h >> > index 44def57f050e..525e09e05743 100644 >> > --- a/mm/slab.h >> > +++ b/mm/slab.h >> ... >> > @@ -636,8 +684,8 @@ static inline void slab_post_alloc_hook(struct kmem_cache *s, gfp_t flags, >> > s->flags, flags); >> > } >> > >> > - if (memcg_kmem_enabled()) >> > - memcg_kmem_put_cache(s); >> > + if (!is_root_cache(s)) >> > + memcg_slab_post_alloc_hook(s, objcg, size, p); >> > } >> > >> > #ifndef CONFIG_SLOB >> >> Keep also the memcg_kmem_enabled() static key check, like elsewhere? >> > > Ok, will add, it can speed things up a little bit. My only concern is that > the code is not ready for memcg_kmem_enabled() turning negative after being positive. > But it's not a concern, right? > > Actually, we can simplify memcg_kmem_enabled() mechanics and enable it > only once as soon as the first memcg is fully initialized. I don't think there > is any value in tracking the actual number of active memcgs. Yeah, it should be acceptable that once the key is enabled after boot, there's no way back until reboot. > Thanks! >