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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable 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 98DF5C433DF for ; Mon, 25 May 2020 15:07:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 752E520888 for ; Mon, 25 May 2020 15:07:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 752E520888 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 1A9F480042; Mon, 25 May 2020 11:07:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 10DE48E0008; Mon, 25 May 2020 11:07:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 022CC80042; Mon, 25 May 2020 11:07:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0009.hostedemail.com [216.40.44.9]) by kanga.kvack.org (Postfix) with ESMTP id DB7128E0008 for ; Mon, 25 May 2020 11:07:24 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 8FAEF180AD81F for ; Mon, 25 May 2020 15:07:24 +0000 (UTC) X-FDA: 76855570008.14.elbow57_238d807e2fc53 X-HE-Tag: elbow57_238d807e2fc53 X-Filterd-Recvd-Size: 2422 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Mon, 25 May 2020 15:07:24 +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 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 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: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?