Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3263555iob; Mon, 16 May 2022 17:31:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTi5fz6KatxdoMC4uGVGlmji0CkMchjDGSkkMvFZJRKzc8bNkknqynnWAFzgSY7CD1xtFZ X-Received: by 2002:a17:90b:1b42:b0:1dc:c56b:58a8 with SMTP id nv2-20020a17090b1b4200b001dcc56b58a8mr22164811pjb.73.1652747502861; Mon, 16 May 2022 17:31:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652747502; cv=none; d=google.com; s=arc-20160816; b=StgGNeNPPLLRjy1pY8afKnXWHJ7dJeWf8hV6tnXEY5YjZpnZXXigozz8IYhAjslwyw U45kcc2JbOok1n2TDzX+cpqQEbQagar8GNKub/FDLqI5xzCWGXK4CFZx1meeuJu8Ljus p3pftCZYLYqhlbOsv2IF0NGRHWhsiSQOj76KzSs+RoC9P26+p0SxnJJJL5ad7fTWpyXs jaYL6Uxg4xJP3X9vkFtsZjPqy417977vDxm+PomO7OH+7eAVcC2hIZaSnqPwHopIwcvg nYikxKXlClmNeee9hE3oOALJY8Iqm25uOoKLk/fNUZ/iufmVbYuIuihK6RAJ76DVukpU hxrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=AzwHC12xjer9Ig+ea0Xvx8LodsMoE3YZd88jEGNk3hU=; b=lDWqns/tfBaJztVKyQURk+hFmQAhLFd3Cc3RwGWSaEzdQO98Jo9vYvqtxZYd3Hz3z7 a7J6egqzzAoWHDpr8kkbFenFtqgciIdf3bmPKRJTviaitgCxNoKOCirnA7C1NFSu44tD M4k+vZydQ1OuZwn3WvfJhEl+5+ddKejSrgQV1g+Cc+vpNOocxU1f3w4F1S6isuRxkluQ I5VtWcK7slDEeSCI+i+CSSFxlEA4MUdr+8xd5O7OSQthB31C4j0oZgzf/T1dII6jxWkH q8LVr11R8IatC43Wnk1rvlQKyfCwvk0bzJ5o/4qlC76j3oqN8Bw/GQ243iPEOWLqwADV cg1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=XS6eR1qE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b5-20020a170903228500b00156893e1c70si1570066plh.260.2022.05.16.17.31.31; Mon, 16 May 2022 17:31:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=XS6eR1qE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349626AbiEPWI7 (ORCPT + 99 others); Mon, 16 May 2022 18:08:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238952AbiEPWI5 (ORCPT ); Mon, 16 May 2022 18:08:57 -0400 Received: from out1.migadu.com (out1.migadu.com [IPv6:2001:41d0:2:863f::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A3A53BFA1 for ; Mon, 16 May 2022 15:08:56 -0700 (PDT) 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.