From patchwork Fri Feb 16 21:00:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 20508 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp782161dyb; Fri, 16 Feb 2024 13:00:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVvOZAEWxmPi6P0/XbR8eOXGKuGVoF/Dp00niT2SkZ0b1hKeNNIbBEEF7PLfzKYsGpxzjDAEpFJDntU3GOiJzdix++l3w== X-Google-Smtp-Source: AGHT+IHRZW81xCZZXtAGw/OBl2FC8g/D1dxOvPDDqK2ECBbJLFaC+koS8nDaal9WG0mk1bIaJz9N X-Received: by 2002:aa7:d986:0:b0:562:6c9:ce29 with SMTP id u6-20020aa7d986000000b0056206c9ce29mr5204782eds.31.1708117250181; Fri, 16 Feb 2024 13:00:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708117250; cv=pass; d=google.com; s=arc-20160816; b=AI0ZKMtLy+6AVqxo1VhBC2OejP4dFMlMz5z0CD5a86U7MMiNYFSC7rfLdJBYoI5pzZ rSvZA0BEkhqgUNmIVucze0PZzBPSerLsmQGL+995ja+Ei7zFV9nUAyKz9M1MBeIPIpDa grQrvJOYeOtHY2XpT1MPraz6v4Fi02MUpYn89PsP3DOzOdH5GFoAbO2qmo3nElIO4LUE 7CCvtIoo+tEeA4u5C/0ZzUtvPLNGk+0TnfMRcbJqWV15a6L+g6Gl3Zyk++wGccS00pZe RyEEimfRuZZbMvIZC1MXt8ULJPDhCkx7py5iRu0wuCb23lJduiWt73JMFdgxnjJ2L9Vf WNOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:subject:cc:to :from:date:user-agent:message-id; bh=Ef+rvtKh+xtRO9HU0iR2gWH2oTVD1C4lxk41TqvpdqE=; fh=agDjUWYo9fuGLwPVzoFqoP6tQUAdz5VzwVjdQhFyOi4=; b=qVh+o1xVsF7mfvlZ8XSoMnlLUbjPlHckYNU//cDofWoxeouquejehQ9fzHjMidQQBZ 9Z3uchr6SOOHjDR0BOpoCFIQin2VukUuQyAez0ZyYUdpuYzBiM/ZBl835Uh91g2rn5H2 wxQuycJWHupeYbaBsS8kWbxp2PAi7zDoW8IztVMOE1I+KYT2MigTpm53MV0ANgBz2bK+ 6zyqE6eRaASFbXxk8rX88L2/TksrQemvvkXNRrM57qCc/ck/urdLRz3PWrHZOAzVyVef zUwWVOtgkerihADYBETyftnlHcV19RJrtxVbCGJTMs+Oj6OOuKOe803scIDVat191o26 6Ffg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-69334-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69334-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a18-20020a50c312000000b005641e5f14ebsi21990edb.340.2024.02.16.13.00.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 13:00:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69334-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-69334-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69334-ouuuleilei=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id C993F1F233CF for ; Fri, 16 Feb 2024 21:00:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 593E9146015; Fri, 16 Feb 2024 21:00:15 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6CFB28E2B; Fri, 16 Feb 2024 21:00:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708117213; cv=none; b=rMq6vydgQKJYUP7++LVyxLRrW50w8p1vWI2kgJod/fr17niAbJfWZeIbj5Linb7KR6hskeRW+C1Jwrf+2IEFm6MM5Jk2UOrgqBiJ7uRtpPiDipW5jh5ZSTYHQBvotH59kOArj/ik1Y7vWlK4N4rDQW6CF0Qq8Whe1WZ1MulsiJc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708117213; c=relaxed/simple; bh=d1b39BTBcPpv6aNOIOnZGThK756SFXqll6sPwSKkkQA=; h=Message-ID:Date:From:To:Cc:Subject; b=BRMiFd0NQa/zk7at5MY//oWYbktzjYBNW88kDVFWhemI8xj3cbUo2twvduZRW1sDesj2jaeua4MiADLOYBEAJRyLZQTnF7zjvxdaR0SHHx7cdxOaw3cPdrgby4JxkLHvu6TwjO7+uirXiXwquZi5H2A6kYgaGd3WXi9eduqC3gc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D5BEC433F1; Fri, 16 Feb 2024 21:00:13 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rb5LC-000000013BK-1TSV; Fri, 16 Feb 2024 16:01:50 -0500 Message-ID: <20240216210047.584712062@goodmis.org> User-Agent: quilt/0.67 Date: Fri, 16 Feb 2024 16:00:47 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Tim Chen , Vincent Donnefort , Sven Schnelle , Mete Durlu Subject: [PATCH v3 0/3] tracing: Changes to saved_cmdlines Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791090754120950644 X-GMAIL-MSGID: 1791090754120950644 Repost of "tracing: Fix wasted memory in saved_cmdlines logic" (hence the v3: v2 at: https://lore.kernel.org/linux-trace-kernel/20240213115232.5fd9e611@gandalf.local.home/) That patch was based on the two other patches in this series, but I forgot to post those two other patches. Instead of applying the update to the saved_cmdlines logic on top of the two phantom patches, apply it first. This way it can be backported nicely. I put a "Fixes" tag on it but not a Cc stable as it's more of a nice to have than fixing any bug (besides wasting some memory). The second two patches simply move code around. The goal is to keep all the saved_cmdlines logic in one place. Currently it's in two files (trace.c and trace_sched_switch.c). Since trace.c is awfully large, move all the code to trace_sched_switch.c, as that's its only purpose today anyway. The first patch is the saved_cmdlines update to consolidate memory. The second patch removes some open coded saved_cmdlines logic in trace.c into a helper function to make it a cleaner move. The last patch simply moves the code from trace.c into trace_sched_switch.c Steven Rostedt (Google) (3): tracing: Have saved_cmdlines arrays all in one allocation tracing: Move open coded processing of tgid_map into helper function tracing: Move saved_cmdline code into trace_sched_switch.c ---- kernel/trace/trace.c | 509 +------------------------------------ kernel/trace/trace.h | 10 + kernel/trace/trace_sched_switch.c | 516 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 529 insertions(+), 506 deletions(-)