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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06B0BC433EF for ; Mon, 16 May 2022 22:08:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 714556B0072; Mon, 16 May 2022 18:08:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C31F6B0073; Mon, 16 May 2022 18:08:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 58B436B0074; Mon, 16 May 2022 18:08:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 4AC646B0072 for ; Mon, 16 May 2022 18:08:57 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 21BD3121097 for ; Mon, 16 May 2022 22:08:57 +0000 (UTC) X-FDA: 79472997114.14.86CF0A5 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf18.hostedemail.com (Postfix) with ESMTP id 787271C00B7 for ; Mon, 16 May 2022 22:08:43 +0000 (UTC) Date: Mon, 16 May 2022 15:08:48 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1652738934; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AzwHC12xjer9Ig+ea0Xvx8LodsMoE3YZd88jEGNk3hU=; b=XS6eR1qE5Av1Flrhjy4lsyvXpKirt7flwE3g7l1chuZDgJ+C8qmWOD2Yn/3Bdk1M5oPMs7 zKKDa6iCReM2bd2aEyyV7XETDdLlZTF81rx0FBWFGdAhkEbHng5roiyLVByRRFBi8X5Yfv xaGPBB3ola+UMgkCgfn2uMSts1ie8jY= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Vlastimil Babka Cc: Shakeel Butt , Vasily Averin , Andrew Morton , Joonsoo Kim , David Rientjes , Pekka Enberg , Christoph Lameter , kernel@openvz.org, Linux MM , LKML , Michal Hocko , Hyeonggon Yoo <42.hyeyoo@gmail.com> Subject: Re: [PATCH] tracing: add ACCOUNT flag for allocations from marked slab caches Message-ID: References: <1fd21e25-b095-e055-fc2e-abda640a0575@openvz.org> <8eccb3bc-e6b1-354b-e1de-bd3d896dcb35@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8eccb3bc-e6b1-354b-e1de-bd3d896dcb35@suse.cz> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=XS6eR1qE; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf18.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 787271C00B7 X-Rspam-User: X-Stat-Signature: hs1ogbpwg4dpnm8p9iiwee6snx11noyh X-HE-Tag: 1652738923-463075 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 Mon, May 16, 2022 at 11:41:27PM +0200, Vlastimil Babka wrote: > On 5/16/22 21:10, Shakeel Butt wrote: > > On Mon, May 16, 2022 at 11:53 AM Vasily Averin wrote: > >> > >> Slab caches marked with SLAB_ACCOUNT force accounting for every > >> allocation from this cache even if __GFP_ACCOUNT flag is not passed. > >> Unfortunately, at the moment this flag is not visible in ftrace output, > >> and this makes it difficult to analyze the accounted allocations. > >> > >> This patch adds the __GFP_ACCOUNT flag for allocations from slab caches > >> marked with SLAB_ACCOUNT to the ftrace output. > >> > >> Signed-off-by: Vasily Averin > >> --- > >> mm/slab.c | 3 +++ > >> mm/slub.c | 3 +++ > >> 2 files changed, 6 insertions(+) > >> > >> diff --git a/mm/slab.c b/mm/slab.c > >> index 0edb474edef1..4c3da8dfcbdb 100644 > >> --- a/mm/slab.c > >> +++ b/mm/slab.c > >> @@ -3492,6 +3492,9 @@ void *__kmem_cache_alloc_lru(struct kmem_cache *cachep, struct list_lru *lru, > > > > What about kmem_cache_alloc_node()? > > > >> { > >> void *ret = slab_alloc(cachep, lru, flags, cachep->object_size, _RET_IP_); > >> > >> + if (cachep->flags & SLAB_ACCOUNT) > > > > Should this 'if' be unlikely() or should we trace cachep->flags > > explicitly to avoid this branch altogether? > > Hm I think ideally the tracepoint accepts cachep instead of current > cachep->*size parameters and does the necessary extraction and > modification in its fast_assign. +1 for fast_assign Changing flags just for tracing looks a bit excessive.