Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp1061525rdb; Wed, 1 Nov 2023 10:09:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH3axDPPv7+NbHPzqmzXktUMfu2MeAJ70yEC73+Aq4rFqWr9tZ4l6iz5bo5KTgq5+Nqr7kK X-Received: by 2002:a17:90a:1a0b:b0:280:c576:31b6 with SMTP id 11-20020a17090a1a0b00b00280c57631b6mr1663641pjk.39.1698858563820; Wed, 01 Nov 2023 10:09:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698858563; cv=none; d=google.com; s=arc-20160816; b=VB/6DxTiJ66TmPeUjoJnakDMlI54CAG4cMzYSdtZd74SaZCMPiCPMNd6xbbpFSjnOw ZdJEFmTvw5MWzYp3CHPVhEky5xCfhyz8yZiXdw3PUzJD/fSomRaAG03VjviESMmqqTsW bxzkubvDGL3dyie+MI+GaJlyfYInckCJ9DPvRBh8iRQckaYfylU8v+e5ySJydgK7AxxS 45SpbSXsYIojYoewM7koc1cFF4q1cOs3P+/5nAuoli1p36zcBV8vKq+dGaP5rC3RPMLh shP/0lfU2Ivjr6upk8SEOjrXBN/09KkLwTRUH4g336TO8kqI7sMn+HpJ3JbvcrzkmL9C C0gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=VxqC4haUmO6O6zFKwa2JDemqA1Zr0ZXCW08zDQAdl+M=; fh=WJ+b3xtE2XdcLOWjtCsDn/xOVhx1MWDcw6SJP6BKAGo=; b=Q5ZTt+LuYEO7RVAQ3H/mi1Y/i+DIM0ARz4lc7D2c4cO8+ban5Yx8Lz2TFy8XgdKX+H m74CsmSSwM7xamRdn7WcgtDyM6uOlGkNCRl90ocThw5xsANClNliJfN9BYJoxh9LLrJD b2pOj8RB93Owwpmf7qiGjf5/Pywza6s+QkBF6JRb/g3i7LV1L0v0gbuphlTvO9eyGuhc XFgt/6SzuSBM6f9Cl3PQ9+6VZQmZRBvz+yDQndoRj1+/kBDDsXzHQxXflUCaAhr0XFTW MdDvJ2APv7aiyNbUP5XfGixp/HmtY9ZFDtSBUByjBsChTYZjT37UOTvkIpz2FTd51LJk LKRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YJ5cPBx7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id oc1-20020a17090b1c0100b002801b7112f5si1387902pjb.86.2023.11.01.10.08.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 10:09:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YJ5cPBx7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 408F48184E1A; Wed, 1 Nov 2023 10:08:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344598AbjKARIv (ORCPT + 99 others); Wed, 1 Nov 2023 13:08:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344351AbjKARIu (ORCPT ); Wed, 1 Nov 2023 13:08:50 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2F67FD; Wed, 1 Nov 2023 10:08:47 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-9d10f94f70bso2004366b.3; Wed, 01 Nov 2023 10:08:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698858526; x=1699463326; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=VxqC4haUmO6O6zFKwa2JDemqA1Zr0ZXCW08zDQAdl+M=; b=YJ5cPBx7s/w1G3jpaDof0yohlE5FynVbV3+YjI+zgj0MXmKlMoAD+jkfqbaTAeOPNm 9cyWveC/fAkIEgb1pkVzQ1b50m4Wt3COsnGbLNs4qxA7pQLNvcoFJx+tUs0QATiSBtYl jGw9SgJsSywkmYGss+fCiwRxX58woUCYQ4yyNXzxtURm4o9ppG/5GmRvJ0vK3O9RZ4ZM DJwM3uLypvp/LVUE+5FKCDWuBJt4KTdKHaQVrd99XEH/2c6pqHw5Dv4A0kBlwhUMSUhD h9TOkUA2vb9aDMeoNMqxEgv4LsGjAqASwUWIVYoXIPbDc/NteyDOiOCAc1XMMd5D/Wh0 kaiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698858526; x=1699463326; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VxqC4haUmO6O6zFKwa2JDemqA1Zr0ZXCW08zDQAdl+M=; b=pes6iMfFV7WDBKzkbQCfrMGdkDn0GV6iA56plmPu7o4OOZqHWg0u3DDv05PzhieodS PbZgwN4fLW0WmHsag/nWITHbyNwJugHukqhXnSgx2gCudulnHmsVrV7A47KwWCGQpNWf YfTSaaUNYTwKUHiAZ920YGhvvppCqTwGnowgU2qWjl6UQiDMe8nuthLxPvcCgQRc09xG NkAXaMxAHfgr/XppkICiIuqeRLmDQTBVrDc+bmF3ADuAcAy6vGKSb0BChfGRHKuVswvk Z0/0Mqu4pl5z6y2jJB45QRqjHiGkZAYgmpLz6xtFOux+eZxaZLUtqf5Iuojcx86jctKs TDHw== X-Gm-Message-State: AOJu0YzACtJfTtig5jYbat5b4NkL+fimjBLUTI3ws+2f95yQKBv9GopP JviuOfUC52W+JhzeLk4G1bskY4fd3MCOa7Vy00A= X-Received: by 2002:a17:906:dc93:b0:9c7:3611:9e7c with SMTP id cs19-20020a170906dc9300b009c736119e7cmr2502264ejc.61.1698858525799; Wed, 01 Nov 2023 10:08:45 -0700 (PDT) MIME-Version: 1.0 References: <20231101102837.25205-1-ddrokosov@salutedevices.com> <20231101102837.25205-2-ddrokosov@salutedevices.com> In-Reply-To: <20231101102837.25205-2-ddrokosov@salutedevices.com> From: Andrii Nakryiko Date: Wed, 1 Nov 2023 10:08:34 -0700 Message-ID: Subject: Re: [PATCH v1 1/2] mm: memcg: print out cgroup name in the memcg tracepoints To: Dmitry Rokosov Cc: rostedt@goodmis.org, mhiramat@kernel.org, hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev, shakeelb@google.com, muchun.song@linux.dev, akpm@linux-foundation.org, kernel@sberdevices.ru, rockosov@gmail.com, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 01 Nov 2023 10:08:53 -0700 (PDT) On Wed, Nov 1, 2023 at 3:29=E2=80=AFAM Dmitry Rokosov wrote: > > Sometimes it is necessary to understand in which memcg tracepoint event > occurred. The function cgroup_name() is a useful tool for this purpose. > To integrate cgroup_name() into the existing memcg tracepoints, this > patch introduces a new tracepoint template for the begin() and end() > events, utilizing static __array() to store the cgroup name. > > Signed-off-by: Dmitry Rokosov > --- > include/trace/events/vmscan.h | 77 +++++++++++++++++++++++++++++------ > mm/vmscan.c | 8 ++-- > 2 files changed, 69 insertions(+), 16 deletions(-) > > diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.= h > index d2123dd960d5..124bc22866c8 100644 > --- a/include/trace/events/vmscan.h > +++ b/include/trace/events/vmscan.h > @@ -141,19 +141,47 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_templat= e, mm_vmscan_direct_reclaim_b > ); > > #ifdef CONFIG_MEMCG > -DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_re= claim_begin, > > - TP_PROTO(int order, gfp_t gfp_flags), > +DECLARE_EVENT_CLASS(mm_vmscan_memcg_reclaim_begin_template, > > - TP_ARGS(order, gfp_flags) > + TP_PROTO(const struct mem_cgroup *memcg, int order, gfp_t gfp_fla= gs), > + > + TP_ARGS(memcg, order, gfp_flags), By adding memcg in front of existing tracepoint arguments, you unnecessarily break everyone who currently has some scripts based on this tracepoint. Given there is no reason why memcg has to be the very first argument, it would be nice if you can just append it at the end to make it nicely backwards compatible. Same for other tracepoints below. Tracepoints are not an ABI, but there is also no point in arbitrarily breaking all current scripts for such a trivial reason. > + > + TP_STRUCT__entry( > + __field(int, order) > + __field(unsigned long, gfp_flags) > + __array(char, name, NAME_MAX + 1) > + ), > + > + TP_fast_assign( > + __entry->order =3D order; > + __entry->gfp_flags =3D (__force unsigned long)gfp_flags; > + cgroup_name(memcg->css.cgroup, > + __entry->name, > + sizeof(__entry->name)); > + ), > + > + TP_printk("memcg=3D%s order=3D%d gfp_flags=3D%s", > + __entry->name, > + __entry->order, > + show_gfp_flags(__entry->gfp_flags)) > ); [...]