From patchwork Sat Jul 15 14:12:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 12088 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp196614vqt; Sat, 15 Jul 2023 07:26:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlEx5jmRVsimwYmyE7vbhET71rtmBTMkD/TBvhmKycQZabbtTcrgKjlh8+ixFDwvsrjCsLOp X-Received: by 2002:a7b:c011:0:b0:3fc:5fa:e2a9 with SMTP id c17-20020a7bc011000000b003fc05fae2a9mr6523443wmb.41.1689431189178; Sat, 15 Jul 2023 07:26:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689431189; cv=none; d=google.com; s=arc-20160816; b=j9X7yPgm552efxHZ4w9r3luDAM7uoemIX81KmihgWyGwu9RitVhM/H+oMVKBAT6sXx lRtKmd6eW1ES5E6H4Os6x9gHVByzLcQjG69x5g+f1u1JQ2KVmwIpHKlpRs1+0coSgQIL rX3wFPYCMnFLYfWcvyYi+W3i8BA2/YGYWzd39hqDZsxRj2jqYTAhZZNCoFosYBktuRY6 gj70FdKcMnBORkyWndBRAUizaHKeuR0rvvxPHBlKL8NH5crVQ2ISFG1SKFW/xNu9djTU XUkPYmlVYGFL2mIeYaIAXp4GOau76Ui1ia/wviWTSh3OYOLvS0M4fB9Y+S3mu5JOKwQ7 rwgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:user-agent:message-id; bh=OzJ1nGpWi6BsZ0OYJ/KmKjhiglj2rJt02qzVDvlQie0=; fh=ST8jSSvP817CUTShQq7KX/jX436RioQu2dYbRCsWhEU=; b=g5mvIa6mZofrWaG4SenIaEjH/VEBEuvJWRk4LeZqyXu3hJbelowBDgY6kfAQL2wYq/ 4/JdkwjLTp+/FdLLQTzj9+EQxp35HPVUlWleshuLJt8Ms78HajLPLv0UhQsCP8YNaxCv 2wIknE3OANKELGqtaFzzq8EKC1Hp7xnzpjxFmiGvZuYJwsZoXf7uvSU+oTuoB0KYTyTc NuxiW5ejI9XkXHPBoo/AUVB0VClcrtIVYyPrYZ36/9Y2CW7uZk3oYhZVAv9dgItaWxef vsb2LqMBs5PP9AjcxNEkJFBYhldvJN348iT1mrmb5jVzu859XayzyIx5MZ9IC8yfNDST 9zfg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qp12-20020a170907206c00b00977cfa6ff4asi4782288ejb.843.2023.07.15.07.26.03; Sat, 15 Jul 2023 07:26:28 -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 S230160AbjGOONy (ORCPT + 99 others); Sat, 15 Jul 2023 10:13:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbjGOONv (ORCPT ); Sat, 15 Jul 2023 10:13:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50B66C0; Sat, 15 Jul 2023 07:13:50 -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 E2AD460BB1; Sat, 15 Jul 2023 14:13:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EAE6C433C8; Sat, 15 Jul 2023 14:13:49 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.96) (envelope-from ) id 1qKg1s-00102r-0L; Sat, 15 Jul 2023 10:13:48 -0400 Message-ID: <20230715141213.970003974@goodmis.org> User-Agent: quilt/0.66 Date: Sat, 15 Jul 2023 10:12:13 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Andrew Morton Subject: [PATCH v2 0/2] tracing: Clean up how iter is freed 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771496998839747768 X-GMAIL-MSGID: 1771496998839747768 The trace iterator is used in various interfaces and needs to be consistent in how it is cleaned up. Add a helper function to clean up its content. But before doing so, I noticed that iter->trace is allocated then the content of tr->current_trace is copied to it. There's no reason for this, so the first patch removes that allocation and just points to the content of tr->current_trace, as tr->current_trace can change, but the content should not. Changes since v1: https://lore.kernel.org/linux-trace-kernel/20230713114510.04c452ca@gandalf.local.home/ - Updated the change log of patch 1, as I remembered why the copy was done. - Remove the allocation and copy of the second patch. I started with the second patch and noticed that there was an inconsistency with the iter->trace. Where in one place it was allocated and copied and the second place it was just pointing to the tr->current_trace. I first started to make it be a copy as well, but then realized that the copy wasn't needed. I created the first patch but forgot to remove the copy and it ended up in the second patch. Steven Rostedt (Google) (2): tracing: Remove unnecessary copying of tr->current_trace tracing: Add free_trace_iter_content() helper function ---- kernel/trace/trace.c | 55 ++++++++++++++++++++++++---------------------------- 1 file changed, 25 insertions(+), 30 deletions(-)