Received: by 2002:ab2:23c8:0:b0:1f2:fdbc:cb93 with SMTP id a8csp167546lqe; Wed, 27 Mar 2024 02:05:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUqcKDSFdMtAszTAdNWS4d0IfmvyIbuFftxrlCsHe2KTFrbdSUfA/k51qQ6uDvlbBEP2coCAVFLbklRkeNH4yhwPiwuyhJ1f/JS/Eol5Q== X-Google-Smtp-Source: AGHT+IEREwmCiFZhbrOuz0/LoJyvu2eoApC7q95lLKG6SPpGA2i1Z+qgBndf6jQZ8Ob5eZIr6uS/ X-Received: by 2002:a05:6a21:a58a:b0:1a3:c3fd:8e03 with SMTP id gd10-20020a056a21a58a00b001a3c3fd8e03mr5953853pzc.38.1711530304448; Wed, 27 Mar 2024 02:05:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711530304; cv=pass; d=google.com; s=arc-20160816; b=kfLhirNOii9ERavnjumfY+rjr2j743VBiaqXdfX8jgg2+95KC63kuEOB2dg6roXDv8 JPcscXISYxU+HKscPvH8keWx350EOTiTUFlqv6HYw2Fuw0kKeQRbippyfOKuvdcBZYPx qG/b7uz/8RLe53A/C1ploxA6+Xg09QDFcSJZdxWudPmJn//u50kSftYgSR06+D5nylSk o9hXfYmfecwOVx5/Aykx53u0jpvu70KVJc/twvlZNpT0HmHcZ+Xm6tfaZ67D629JMjhD CvqH03QNh/4Oi00bdDUaK2e6qr0+TpJk4CsUXH5cWIMfq9pgxcWfAe1FEMtLE0sloIbd /UNQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:mail-followup-to:message-id :subject:cc:to:from:date; bh=Q1yiTwDFOmojAjNsL/8nYyko9BZaBZpG1xB+naQVmkU=; fh=FSWDZuj5qtNsn7SH3yWWM2urmmkPfcKA2tCG7aOVUlw=; b=icxdmhuZIeSgfHPxvkBdLmEAcQWzbgZbUPbM8rZxbCNeD7lbQegfzOZdNwu7ulqz7z qkSGOnCQSVrDfBNvrgeVbczrU2DWHpZRm+KyKnvWwW1k0nzV+hsAnCnLjzIOowgvE4ax srK7/cuQBlWPGiAMWEO65QVnvYViRduQluT3xsuDCZTE3Tz6jZ5soP/BRXhRb5J783cA A+rKODiU7MKIvE70D+GDShSzYgf//Huc9brPbp7YtjPC9ZBPdn/fiuIrQXtinL6Ag9yb mRYzZ4zcdKc8BWXmQCjp7WOUwpwiauiG1bzceu0hUjkmCu31m/xoVqRnalTtvOCWbD3I UXxw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=didiglobal.com dmarc=pass fromdomain=didiglobal.com); spf=pass (google.com: domain of linux-kernel+bounces-120579-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120579-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=didiglobal.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k35-20020a17090a3ea600b0029c13c75255si1045156pjc.50.2024.03.27.02.05.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 02:05:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-120579-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=didiglobal.com dmarc=pass fromdomain=didiglobal.com); spf=pass (google.com: domain of linux-kernel+bounces-120579-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120579-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=didiglobal.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 5A4F6B244F3 for ; Wed, 27 Mar 2024 08:55:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E4E4B38393; Wed, 27 Mar 2024 08:54:17 +0000 (UTC) Received: from mx9.didiglobal.com (mx9.didiglobal.com [111.202.70.124]) by smtp.subspace.kernel.org (Postfix) with SMTP id 7959E364AE; Wed, 27 Mar 2024 08:54:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=111.202.70.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711529657; cv=none; b=PM/toD/F1Mo/HstrC9Lhjuh7sjVXKBDKKVCVxcvqbWNRgODcFJuu4B+IPvC3PwZgzUvQUIcxj6CB1YIIhnvejcR7e+2LVz1RipHPgAxRNrd9P8eebTGUkFQXbyqi6cPRT5/IHAw2Onz++w+TtR9LSGgNk3BQIUteqBNcnHbUoaU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711529657; c=relaxed/simple; bh=F0q1atU/QCJOZoZpsRigCnnKYENo2GCPE2bMe3TQydU=; h=Date:From:To:CC:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=YKmABU3Uv+fMQZCcycH4FtatCY0QmdG2ycucotpDYODoJgyGxxmV7Ld9Ch89mfwsYiLwNn8IxWES+wYBsP6/tdS5BxzlFZ4oPvAQT4BmZxwZBY1/y2tjoZSXVEd0MgDTW1qmJZ/yOXgC43/OMBGrjOaK1cuo5njlYv3+KA2HLto= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=didiglobal.com; spf=pass smtp.mailfrom=didiglobal.com; arc=none smtp.client-ip=111.202.70.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=didiglobal.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=didiglobal.com Received: from mail.didiglobal.com (unknown [10.79.65.12]) by mx9.didiglobal.com (MailData Gateway V2.8.8) with ESMTPS id D794318C709D10; Wed, 27 Mar 2024 16:51:02 +0800 (CST) Received: from didi-ThinkCentre-M930t-N000 (10.79.64.101) by ZJY02-ACTMBX-02.didichuxing.com (10.79.65.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 27 Mar 2024 16:51:02 +0800 Date: Wed, 27 Mar 2024 16:50:57 +0800 X-MD-Sfrom: tiozhang@didiglobal.com X-MD-SrcIP: 10.79.65.12 From: Tio Zhang To: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers CC: Ingo Molnar , Peter Zijlstra , , , , , Subject: [PATCH] trace/sched: add tgid for sched_wakeup_template Message-ID: <20240327084948.GA28114@didi-ThinkCentre-M930t-N000> Mail-Followup-To: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, zyhtheonly@yeah.net, zyhtheonly@gmail.com Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: ZJY01-PUBMBX-01.didichuxing.com (10.79.64.32) To ZJY02-ACTMBX-02.didichuxing.com (10.79.65.12) By doing this, we are able to filter tasks by tgid while we are tracing wakeup events by ebpf or other methods. For example, when we care about tracing a user space process (which has uncertain number of LWPs, i.e, pids) to monitor its wakeup latency, without tgid available in sched_wakeup tracepoints, we would struggle finding out all pids to trace, or we could use kprobe to achieve tgid tracing, which is less accurate and much less efficient than using tracepoint. Signed-off-by: Tio Zhang Signed-off-by: Dylane Chen --- include/trace/events/sched.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index dbb01b4b7451..ea7e525649e5 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h @@ -149,6 +149,7 @@ DECLARE_EVENT_CLASS(sched_wakeup_template, __field( pid_t, pid ) __field( int, prio ) __field( int, target_cpu ) + __field( pid_t, tgid ) ), TP_fast_assign( @@ -156,11 +157,12 @@ DECLARE_EVENT_CLASS(sched_wakeup_template, __entry->pid = p->pid; __entry->prio = p->prio; /* XXX SCHED_DEADLINE */ __entry->target_cpu = task_cpu(p); + __entry->tgid = p->tgid; ), - TP_printk("comm=%s pid=%d prio=%d target_cpu=%03d", + TP_printk("comm=%s pid=%d prio=%d target_cpu=%03d tgid=%d", __entry->comm, __entry->pid, __entry->prio, - __entry->target_cpu) + __entry->target_cpu, __entry->tgid) ); /* -- 2.17.1