From patchwork Wed Aug 2 12:47:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ze Gao X-Patchwork-Id: 129823 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp447996vqx; Wed, 2 Aug 2023 06:14:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlF7QmCjnAexuF38KAAMGNpeDHtVQmFBayc++0x6tccCw2uxWbmpbnD6UwPNK7Q4BDPkBLJp X-Received: by 2002:a05:6a20:9719:b0:11c:fc27:cda4 with SMTP id hr25-20020a056a20971900b0011cfc27cda4mr16128126pzc.11.1690982079252; Wed, 02 Aug 2023 06:14:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690982079; cv=none; d=google.com; s=arc-20160816; b=dXxQhT2gK+bDE8CxhFQdElYXYJBDgrhs6RchaHuRxfyRXyGwaCWFI7KymuKuGa2YJj MoZZOMtNlLK6fuJcAcPa7Fl6sFsSk4UkMEMTuDzY/H7Wu+qXgVaD67YzdyeW043sqqV/ bRMhyHeYRhrIxxtXXXqzEWqnL3FZEloWhLUGGu3+iBf9SIdRbKAImnWh8nbGa2JG1jyT iMA5hdYWw832W9/b3B8E0CtYZpg5AXVdKlVPIcaHjFZvn9htCz0Ld0N0GIjUwfVAtpqw zHdpCcYxEiWiMHWQ0PdDbdMyf7Bkpv+REL18djvzB/dV/A0db2uklSOsOEWIwof1u+g8 JNSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DEZCAX1WlrsUv3nMNvtTambxp2M6PKeC7k4D0cytuU4=; fh=4S4dukURCUlSsjzSa0Ofy3qHSrrdu/uT1HnGBPj5BK4=; b=VA6lXloz7F4uC0lu/k0DSPvIePYfi2YgWlyJEmYKKnMD0iaa+duOFJhdiUJLcr7R0y BY0snjBs/eqbl4sD6MCZBElNygAAjPvsZXC7X0fYmQAZpBuY+PXiq5RDa4Gq/j4Awi46 +KZzY2V+6SrxXT6f6JOQCUvGx6Ss/i28hV0u6DJcQATslhaeHWLpNRU+LF9vxFGCf8/x TN9Rw6DPFgB5K+XPbMc5XMq4mh2+nm5A2CGOlqwi2JFk1PeMvoE+qWiLOFP+MAdSut6M jZtUF0npyIH8xU7IOC+RdZAaKjlmowmGu8cZ5EVouOghbzreLgebQT+wM0597JeUq/kA nqow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=lPf1Tobb; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l20-20020a63ea54000000b0055be9543340si6163917pgk.872.2023.08.02.06.14.22; Wed, 02 Aug 2023 06:14:39 -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=@gmail.com header.s=20221208 header.b=lPf1Tobb; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234900AbjHBMtl (ORCPT + 99 others); Wed, 2 Aug 2023 08:49:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234737AbjHBMtK (ORCPT ); Wed, 2 Aug 2023 08:49:10 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65FDB2D78; Wed, 2 Aug 2023 05:49:04 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-26830595676so4780327a91.2; Wed, 02 Aug 2023 05:49:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690980544; x=1691585344; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DEZCAX1WlrsUv3nMNvtTambxp2M6PKeC7k4D0cytuU4=; b=lPf1TobbUrw1GTawCUCLEnAAjBp8pdwI/dfI2qxVqSsOzmaDY1I+0giZV4UOon5Bwx aaQF4Ez1LU7MqaKaQztnoUUnCEOS3Eo9ITZInVOl3qTGyypRbi/2ozpnE5g9DTNgvFDR x4gMWe1eSGUT5rT+cmAb9/RzoegOd+IagpZUOpNOvR1AP1oyn7kGFJiuAVsO5611TxVZ 0Qc1Ey/L3IONZ+w8KjzFyGeDwiU9z/JfUJmzka7SXLJFWahWxjGZBoIEnuI506kn4zoc UOIyu73yPY4qu+P4tWN2r0kNbC+L+GnMCrnAJNhvdYENrTKBF0XRIFiJEvenJCK2iEeU hJ+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690980544; x=1691585344; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DEZCAX1WlrsUv3nMNvtTambxp2M6PKeC7k4D0cytuU4=; b=Pj0b3DTgqw67I7VUbLwPIRSOaDMesxzjgztKph26jTS07v7fXyxpxLH+p+9H+3V2sl bRVSPnqFOFN7SsWtUMvGJQyEMWDUPcpZPFkEFSYRNkmpzlLFrl5w1ivV57ina8/avrTD XuiuNCBG2g73w8oVyHmNsozH9MrENKkXIqikhAzuoaZSX+t39trq8079akrxo8xAIz5x er9BVzC/nZe+cQnzusnsxxRnY8Ap17OX/orEQ2MNdaYPpxx5AvKos73rOPWCaNBweLIl MRJt+umsaGmwmASIOj4RbZ+VFPTOgA6OFdY1cWZPs9te+sEEfF/VIj3XHeigtUFTNgTy 2JLg== X-Gm-Message-State: ABy/qLaPzKukVWihMC7q7QpC4wSgWTitabpugKDopXq1chY4KGwbF1HP yShPyyzeNNs+BmOiZffaW8I= X-Received: by 2002:a17:90b:350b:b0:268:634f:61f2 with SMTP id ls11-20020a17090b350b00b00268634f61f2mr15998891pjb.17.1690980543891; Wed, 02 Aug 2023 05:49:03 -0700 (PDT) Received: from localhost.localdomain ([203.205.141.17]) by smtp.googlemail.com with ESMTPSA id x34-20020a17090a6c2500b00264044cca0fsm4811993pjj.1.2023.08.02.05.49.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 05:49:03 -0700 (PDT) From: Ze Gao X-Google-Original-From: Ze Gao To: Adrian Hunter , Alexander Shishkin , Arnaldo Carvalho de Melo , Ian Rogers , Ingo Molnar , Jiri Olsa , Mark Rutland , Masami Hiramatsu , Namhyung Kim , Peter Zijlstra , Steven Rostedt Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-trace-devel@vger.kernel.org, Ze Gao Subject: [RFC PATCH v5 4/7] sched, tracing: reorganize fields of switch event struct Date: Wed, 2 Aug 2023 08:47:27 -0400 Message-ID: <20230802124840.335638-5-zegao@tencent.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230802124840.335638-1-zegao@tencent.com> References: <20230802124840.335638-1-zegao@tencent.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773123224879300837 X-GMAIL-MSGID: 1773123224879300837 Report priorities in 'short' and prev_state in 'int' to save some buffer space. And also reorder the fields so that we take struct alignment into consideration to make the record compact. Suggested-by: Steven Rostedt (Google) Signed-off-by: Ze Gao --- include/trace/events/sched.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index fbb99a61f714..7d34db20b2c6 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h @@ -187,7 +187,7 @@ DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new, TP_ARGS(p)); #ifdef CREATE_TRACE_POINTS -static inline long __trace_sched_switch_state(bool preempt, +static inline int __trace_sched_switch_state(bool preempt, unsigned int prev_state, struct task_struct *p) { @@ -229,23 +229,23 @@ TRACE_EVENT(sched_switch, TP_ARGS(preempt, prev, next, prev_state), TP_STRUCT__entry( - __array( char, prev_comm, TASK_COMM_LEN ) __field( pid_t, prev_pid ) - __field( int, prev_prio ) - __field( long, prev_state ) - __array( char, next_comm, TASK_COMM_LEN ) __field( pid_t, next_pid ) - __field( int, next_prio ) + __field( short, prev_prio ) + __field( short, next_prio ) + __field( int, prev_state ) + __array( char, prev_comm, TASK_COMM_LEN ) + __array( char, next_comm, TASK_COMM_LEN ) ), TP_fast_assign( - memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); - __entry->prev_pid = prev->pid; - __entry->prev_prio = prev->prio; - __entry->prev_state = __trace_sched_switch_state(preempt, prev_state, prev); + __entry->prev_pid = prev->pid; + __entry->next_pid = next->pid; + __entry->prev_prio = (short) prev->prio; + __entry->next_prio = (short) next->prio; + __entry->prev_state = __trace_sched_switch_state(preempt, prev_state, prev); memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); - __entry->next_pid = next->pid; - __entry->next_prio = next->prio; + memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); /* XXX SCHED_DEADLINE */ ),