From patchwork Thu Mar 2 07:16:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengen Du X-Patchwork-Id: 1750397 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=rQNnlBh9; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PS2TX66mwz1yWy for ; Thu, 2 Mar 2023 18:16:32 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pXdAw-0006AG-HZ; Thu, 02 Mar 2023 07:16:26 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pXdAt-00069k-0j for kernel-team@lists.ubuntu.com; Thu, 02 Mar 2023 07:16:23 +0000 Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 250223F116 for ; Thu, 2 Mar 2023 07:16:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1677741382; bh=P39b98i4+EIo9MYAQ1MFa+ONR0JlgeskTl5sLTtEi2c=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rQNnlBh9xM7/LXroLdsvoEoryVdfLw7Qmhg1J1QNwtWtDg6b0dUELmpTuCQ+VwJzr 1bJrY5MeYpCe8gelhiP/QGxVpPbSvliYVMIA5W0Dz/Ym/Z4QrDFzSDKV4waeNQ3T7N jd8Iq6/7a5eMjC6K2qKwbxBlNxcaPuwgyYikrT2t2/t1gx84E3YGb8n504rqx1aUpE NPGA+cjYNrdhQ3DztmgftVgI3dx9VcxFys2tvq9f29W6K0nm7/VOXU718+bt3K0Ueg RK49zNwMYePtNcwIOXssvw9xzv6mjL2KG3y0/BkuskUhAZAggerQ6J8xsqjcBj5xq0 nM9ChvbUuGunw== Received: by mail-pf1-f200.google.com with SMTP id i15-20020aa78d8f000000b005edc307b103so7426728pfr.17 for ; Wed, 01 Mar 2023 23:16:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677741380; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P39b98i4+EIo9MYAQ1MFa+ONR0JlgeskTl5sLTtEi2c=; b=VPyNIxYDCH45GfHQkUFEy7ko8zvpPlg579lLXGgMPuvXfGt7tropwM/wOx8SleKOK9 4A3JMkSbPmiAGKdqLlugXC1x4ZGyOc5n81uauiNAqiVLP1BQz5uO+UCp5KhYKiAqjCPz h1eVgrWjJk6MTtmWYlJUEccwKaicj9RYc4MYNhOsMlxPKS1WA9DakxF++CFk4AaP+f/Q lJ2gK3om532xlc5JbeZwW4Icw44K7O/51VKiJV74INC3x+CudgAzcqxjS9dJFzakkBSr yjwLZaBeBguCYvDZqgRgLUwHGUix6ko4njLpuCB18oRJYGo0WRi/ETaNmfK58gcOX35o WKEw== X-Gm-Message-State: AO0yUKUkIVJ1TyXUpPM7IQhmylubdjww/z73jRMEPXbWtB7EboOhZFHS 3OMLMRGCUuyDgbJLcaQ0ZwQleVq5TQR4O07CEG8ZeeI2G4OtXsuWB8tSZPsI8OPCtAuDU9D+naQ XON9bj9Jbi4SsiiQm+XnHOCdy1u56Y/2IRzKWKn+kKLFbhQA= X-Received: by 2002:a17:90b:388a:b0:230:1acb:191f with SMTP id mu10-20020a17090b388a00b002301acb191fmr10561762pjb.32.1677741380682; Wed, 01 Mar 2023 23:16:20 -0800 (PST) X-Google-Smtp-Source: AK7set92xBYh5/UNshN27zp+AND9117nVrHBrTVvoth74kbMm1NI/u0pqD7j8+HUhGFqUMREd9ITDg== X-Received: by 2002:a17:90b:388a:b0:230:1acb:191f with SMTP id mu10-20020a17090b388a00b002301acb191fmr10561743pjb.32.1677741380374; Wed, 01 Mar 2023 23:16:20 -0800 (PST) Received: from chengendu.. (111-248-105-208.dynamic-ip.hinet.net. [111.248.105.208]) by smtp.gmail.com with ESMTPSA id a11-20020a170902900b00b0019a9637b2d3sm9576523plp.279.2023.03.01.23.16.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 23:16:20 -0800 (PST) From: Chengen Du To: kernel-team@lists.ubuntu.com Subject: [SRU][Jammy][PATCH 1/1] perf synthetic-events: Don't sort the task scan result from /proc Date: Thu, 2 Mar 2023 15:16:16 +0800 Message-Id: <20230302071616.40489-2-chengen.du@canonical.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230302071616.40489-1-chengen.du@canonical.com> References: <20230302071616.40489-1-chengen.du@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Namhyung Kim BugLink: https://bugs.launchpad.net/bugs/2008971 It should not sort the result as procfs already returns a proper ordering of tasks. Actually sorting the order caused problems that it doesn't guararantee to process the main thread first. Signed-off-by: Namhyung Kim Acked-by: Ian Rogers Cc: Jiri Olsa Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/20220701205458.985106-1-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo (cherry picked from commit 363afa3aef24f5e08df6a539f5dc3aae4cddcc1a) Signed-off-by: Chengen Du --- tools/perf/util/synthetic-events.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic-events.c index c69ad7a1a6a7..285802ebc30b 100644 --- a/tools/perf/util/synthetic-events.c +++ b/tools/perf/util/synthetic-events.c @@ -764,7 +764,7 @@ static int __event__synthesize_thread(union perf_event *comm_event, snprintf(filename, sizeof(filename), "%s/proc/%d/task", machine->root_dir, pid); - n = scandir(filename, &dirent, filter_task, alphasort); + n = scandir(filename, &dirent, filter_task, NULL); if (n < 0) return n; @@ -994,7 +994,7 @@ int perf_event__synthesize_threads(struct perf_tool *tool, return 0; snprintf(proc_path, sizeof(proc_path), "%s/proc", machine->root_dir); - n = scandir(proc_path, &dirent, filter_task, alphasort); + n = scandir(proc_path, &dirent, filter_task, NULL); if (n < 0) return err;