Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4574483rwb; Mon, 31 Jul 2023 08:53:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlFvFRtNKHvsaB03xtTWB1hM4Q+7kZjBcODSPjSvygQoWqGDBTAGnTL1/zqxWkobqBH404b5 X-Received: by 2002:a17:907:b0a:b0:993:eee4:e704 with SMTP id h10-20020a1709070b0a00b00993eee4e704mr229296ejl.38.1690818782266; Mon, 31 Jul 2023 08:53:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690818782; cv=none; d=google.com; s=arc-20160816; b=fO6F51y1x5r30Qiy2smPZz1ho/ZZnlSdicjQDVfu7rW+lzJ4fCNuFzGGuYSqSHk62c aZDR7H8VbonuS6kVKbeM7eWx5htAoOtznK7hfnhGNWne9fTQUcmae1A8DQdpU4cc8bsr TPl5gxX113E3+/AiKDPcJ+RsJolAKtI8VddXRbbr7F4YhyALmJjPoXEUIdFl1AVPpY2A /JSr+ggUbF0IdAjb8CkwWihg+Zpp59ZQWylRKb/hMkNcvMOh6n6zxBSwIWjiizIz6jeI M/hj5UUgScB1jvgp8m5JEwPMnqOy/g1hqgw4dISjfpRoJbLdrG0mhe6eymOE8Szxg+88 T74A== 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=UFiskatlhAQcvWCeTtz1ML6Hy2CHQzzLGLI2vnPl7qw=; fh=cnEp3uneTX0s3nC7QmIskh9dxBXTfoLKll/zh5qFxak=; b=N2NfI63Ntyk00g1vGXZ7Z4GCldeXOePWYua1n0TEOiim+BYmWX8CnUpYBNuQK9Pepv 8PIkY51iGMGQkq8LPn8Wto0tWk7wRQQv3sYMPZGKC8l+JunF1P30B2cdoQkG5DfPOqnN xkYXQlSZ22NR68Ndw6rs9RfQyU0GqxhGUR8NBvM1TZByomfeOJCbJkaAu4sUVKLE75aQ cn5mkxFw7vePieXDrdU4FpHzshRG9RS3t5/3FcjPS+GLQreGQ//x21rDBxvmTIMt74ZJ L8LesvvrD6E5ZKof945jMJO4TBMOZ5MXjXR/fKgZdZEU4kUE9/P/v4IWqWa9o9avPsUF HG3Q== 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 f16-20020a1709067f9000b009893fe84e74si7280557ejr.484.2023.07.31.08.52.35; Mon, 31 Jul 2023 08:53:02 -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 S230509AbjGaPiP (ORCPT + 99 others); Mon, 31 Jul 2023 11:38:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229871AbjGaPiO (ORCPT ); Mon, 31 Jul 2023 11:38:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABB28E0; Mon, 31 Jul 2023 08:38:12 -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 4A5266117D; Mon, 31 Jul 2023 15:38:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBF1BC433C8; Mon, 31 Jul 2023 15:38:09 +0000 (UTC) Date: Mon, 31 Jul 2023 11:38:07 -0400 From: Steven Rostedt To: Ze Gao Cc: Peter Zijlstra , Namhyung Kim , Adrian Hunter , Alexander Shishkin , Arnaldo Carvalho de Melo , Ian Rogers , Ingo Molnar , Jiri Olsa , Mark Rutland , Masami Hiramatsu , 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 v2 1/3] sched, tracing: add to report task state in symbolic chars Message-ID: <20230731113807.1a4a455c@gandalf.local.home> In-Reply-To: <20230726121618.19198-2-zegao@tencent.com> References: <20230726121618.19198-1-zegao@tencent.com> <20230726121618.19198-2-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=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 Wed, 26 Jul 2023 20:16:16 +0800 Ze Gao wrote: > @@ -231,41 +253,29 @@ TRACE_EVENT(sched_switch, > TP_STRUCT__entry( > __array( char, prev_comm, TASK_COMM_LEN ) > __field( pid_t, prev_pid ) > - __field( int, prev_prio ) > - __field( long, prev_state ) > + __field( short, prev_prio ) > + __field( int, 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, next_prio ) > ), The above adds a bunch of holes. This needs to be reordered to condense the event, we don't want to increase it. libtraceevent will handle reordering. The above produces: struct { char prev_comm[16]; pid_t prev_pid; short prev_prio; <-- 2 character padding int prev_state; char prev_state_char; char next_comm[16]; <- 3 character padding pid_t next_pid; short next_prio; <- 2 char padding }; (all events are at least 4 byte aligned, and are multiple of 4 bytes in size, thus that last short of next_prio did nothing) The above is a total of 56 bytes (note, that is the same as the current sched_switch event size); What the above should be: TP_STRUCT__entry( __field( pid_t, prev_pid ) __field( pid_t, next_pid ) __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 ) ), Which would be: struct { pid_t prev_pid; pid_t next_pid; short prev_prio; short next_prio; int prev_state; char prev_comm[16]; char next_comm[16]; char prev_stat_char; <-- 3 characters of padding } which would be 52 byte. Saving us 4 bytes per event. Which is a big deal! -- Steve