Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5810863rwb; Tue, 1 Aug 2023 08:12:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlGuQWv6EDNI1N2hHnLHMle5AkjYAzNGgiwaxKVJzk0G/0rz8b1nsTiYDJNgl47OJAxrOFrz X-Received: by 2002:a05:6a21:339f:b0:12e:4d86:c017 with SMTP id yy31-20020a056a21339f00b0012e4d86c017mr16248511pzb.10.1690902753918; Tue, 01 Aug 2023 08:12:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690902753; cv=none; d=google.com; s=arc-20160816; b=SXJQqVCpnvRF5hpapnKCKfK/o1XvoGEM8y6Czh4cMnxN/fZU6xMGM5OJ1ITuy7bWQP JY1U5yF55xxLGbcBetIrX+azlPzWoI5xdm0o5b9MXsWjz1Ns9ezlw1c9b89AOinBzRHZ O3yhpMoiZt3CDlG1GVBLrExmZW4HICpVGl3S3XDNOmRCTq/2vI7ViYL1nlHTulBKUHp9 T30XZ5KA2US/J4QUc3D5h7kqheNFBigxdPoVxEI3nWUdBRQZo0bdTMYjDClDggAxp5g/ hJ6HXZiXmO5TlYEurbU19J/0+Q5Jsc7kZFNnpbo/BuoGYKXLG8/S7XVs5/U1Z+wNbhzX cSZQ== 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:subject:cc:to:from:date; bh=2q17qXdZVhl5JfGa0qVjPmxvVuM7hhChqD5V64HgesM=; fh=+W+h24UyqrvCEgcJUSCSBCwhRFkn2iVTZdPAA+CSSz4=; b=ZNlgRy1IcYqryLTjC18iuPcEIR42mPd60qlzrXSA7OauE7l1Z7HWlmbRnr2cAtWmWj kcCYt0wiDxlXHKduH0kjc1DI6+w7OnslxHp8xX4xYV1vo5Njr7R2WtdXLA2i4hM1xPML C76dUnFJUEw+s4pg8QarVi8zeSb5NQRLxJmBHLmPWCfaGrByRMTqSYwcVwdFGIJWkoNv BAjDQp1jqwRVIhFb3ZS99oNorEMmxXhz+SiM+vWZFtskmjg65xp8iQkBmlGwlSpb1oaJ 6l7yRuUg5silnqaoVaocOfrW+RPcnu/Ug8cL3sEaSU8SIB6cSRdPINh1xo7+y+5qBzvw AurA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w185-20020a6382c2000000b005538c82b70esi9018338pgd.101.2023.08.01.08.12.11; Tue, 01 Aug 2023 08:12:33 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233694AbjHAOQU (ORCPT + 99 others); Tue, 1 Aug 2023 10:16:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229665AbjHAOQR (ORCPT ); Tue, 1 Aug 2023 10:16:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA295B1; Tue, 1 Aug 2023 07:16:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4821C615CB; Tue, 1 Aug 2023 14:16:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA1A9C433C8; Tue, 1 Aug 2023 14:16:13 +0000 (UTC) Date: Tue, 1 Aug 2023 10:16:12 -0400 From: Steven Rostedt To: Ze Gao Cc: Adrian Hunter , Alexander Shishkin , Arnaldo Carvalho de Melo , Ian Rogers , Ingo Molnar , Jiri Olsa , Mark Rutland , Masami Hiramatsu , Namhyung Kim , Peter Zijlstra , 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: Re: [RFC PATCH v3 4/6] sched, tracing: reorganize fields of switch event struct Message-ID: <20230801101612.0e083e2d@gandalf.local.home> In-Reply-To: <20230801090124.8050-5-zegao@tencent.com> References: <20230801090124.8050-1-zegao@tencent.com> <20230801090124.8050-5-zegao@tencent.com> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,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 Tue, 1 Aug 2023 17:01:22 +0800 Ze Gao wrote: > 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 I'd swap this patch with patch 3. That is, make the field changes first. I'd like this to get in regardless of if the state_char is accepted. We may want to get this in first to see if there's any regressions before we add a state_char. -- Steve > --- > include/trace/events/sched.h | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) > > diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h > index e507901bcab8..36863ffb00c6 100644 > --- a/include/trace/events/sched.h > +++ b/include/trace/events/sched.h > @@ -188,7 +188,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) > { > @@ -251,25 +251,25 @@ 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 ) > - __field( char, prev_state_char ) > - __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 ) > + __field( char, prev_state_char ) > ), > > TP_fast_assign( > - memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); > __entry->prev_pid = prev->pid; > - __entry->prev_prio = prev->prio; > + __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); > __entry->prev_state_char = __trace_sched_switch_state_char(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 */ > ), >