Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp1146048ybs; Mon, 25 May 2020 08:12:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAyoJPtjXd/dVsjNliLZ+/IMfbroxyIvtQ7ieEczEi/uzZCdW+E0jyB8aNyeiqBP7JwQiH X-Received: by 2002:a17:906:3b1b:: with SMTP id g27mr18184074ejf.397.1590419531817; Mon, 25 May 2020 08:12:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590419531; cv=none; d=google.com; s=arc-20160816; b=PMZvle0pNx9vDJo608DJz3qdu9FoKRvGMt9jZR9R9OyeW1+f/WOfuIlxvoxQlyN1kJ ouiGgHAI0XdONEz1zTaaV1sO1fKffG4/RXJy9xuJj3mg4f7d3ssN7Rtji55AY1roSOl0 jpmOr9xWdBMmp3OJiXKyMaX7r958/k4KSQ0nc/vHq+WGBRrj4FGX5QoeDQIdbTMYdBWE pfSpWet2/4P6bk0J8XYF5dqdyfIhuDDCDSzQXUPvZ4EJ9Bd5lhyF08rqShYzLzpjDywf 8k5VzJZek30XY0dQqI9EqUaJ2Zg0hgqGE7VFB9IMH6aErHWPI04vxlg2e4HFY8Ve9nbq bLcg== 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=J3zcph5qbnEIK2mfgsi3XVhXEzhK7DzF9yw1yjIjidM=; b=T+tAGraTcWN+A8kJG3KTx/AaO4DgX/HBiSYcxiddjF4oGUyk3s7YwNRbBx2AKjbTkl smU+VJ06BkTudjFfUeHu+RG/8HXPumT/O0/mgEXUVZTIPsI9auuBiljhcDw5SLcOOd9w V1xF6XitNhjK7efrdWbh2O30bH0jFiDeAC0haHzUrox+R/S1oYmWizI7incO8V9yFpFo CUEGraYFphI89KZ4ORgabTq0m//jz7yAw5L2Ff2m9MRTCsezF7VrZFp11O4IoHgseePe e3fIyKZrBZ8qyGaMwmFtZ8vzH7fRZm+DRvVfCPHveHdtkXbdJ8M9rQHLXC1Cyzh3+de4 JHXQ== 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 i27si9779294ejb.63.2020.05.25.08.11.48; Mon, 25 May 2020 08:12:11 -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 S2390992AbgEYPHY (ORCPT + 99 others); Mon, 25 May 2020 11:07:24 -0400 Received: from mx2.suse.de ([195.135.220.15]:50720 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725809AbgEYPHX (ORCPT ); Mon, 25 May 2020 11:07:23 -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 4F542B187; Mon, 25 May 2020 15:07:25 +0000 (UTC) Subject: Re: [PATCH v3 08/19] mm: memcg/slab: save obj_cgroup for non-root slab objects 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-9-guro@fb.com> From: Vlastimil Babka Message-ID: <3e02b3c6-2bf5-bddb-d855-83a1a1a54034@suse.cz> Date: Mon, 25 May 2020 17:07:22 +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-9-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:46 PM, Roman Gushchin wrote: > Store the obj_cgroup pointer in the corresponding place of > page->obj_cgroups for each allocated non-root slab object. > Make sure that each allocated object holds a reference to obj_cgroup. > > Objcg pointer is obtained from the memcg->objcg dereferencing > in memcg_kmem_get_cache() and passed from pre_alloc_hook to > post_alloc_hook. Then in case of successful allocation(s) it's > getting stored in the page->obj_cgroups vector. > > The objcg obtaining part look a bit bulky now, but it will be simplified > by next commits in the series. > > Signed-off-by: Roman Gushchin Reviewed-by: Vlastimil Babka Nit below: > 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?