From patchwork Thu Mar 2 06:32:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengen Du X-Patchwork-Id: 1750379 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=LjdMrU5L; 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 4PS1Vc6z7Dz1yWy for ; Thu, 2 Mar 2023 17:32:23 +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 1pXcU7-0003W9-Sr; Thu, 02 Mar 2023 06:32:11 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pXcU4-0003Vm-Se for kernel-team@lists.ubuntu.com; Thu, 02 Mar 2023 06:32:08 +0000 Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.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-0.canonical.com (Postfix) with ESMTPS id 7C1413F1F6 for ; Thu, 2 Mar 2023 06:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1677738728; bh=xxQ+cJbfa33YGwyQkGMm0vOd/qMXL+TTBVgN5Rth7Ng=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LjdMrU5LSaEoYokPFgOl8+NJwPOJCdNW4cAeht734C0l1Z6Cogw+APxyfHnCzQIyT jXp7nB8yYEv0qgV8V8tA4CWOStBU+n2wbvHCXnNq0f+WQDbNR+/axsLpBITG0RVOWA r3tqdpYfhAZMAkb8GTZ/UloiNDNCI6+1XqP4TWrQdIDElvGus7fpXr2gllEucJoxgM 2MHsZvqzB2SMYssSxRJTd3xQFaKAB/OJuRDkCwqfmoj+JLTOTwLpItl+Y9COu1dpsq j46BiHeq1k+ZhqCp7f8uFduSh0TK0UyjiuJqEzDCM99mP5Pp4lSk+5h9gSBnNuwMhu rCHGjZ77SbVKg== Received: by mail-pg1-f200.google.com with SMTP id n66-20020a634045000000b004e8c27fa528so5231672pga.17 for ; Wed, 01 Mar 2023 22:32:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677738724; 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=xxQ+cJbfa33YGwyQkGMm0vOd/qMXL+TTBVgN5Rth7Ng=; b=5thLVTQuQERm0jJU5vJKtWDObFgJNU5JuJmLZQe/5iwoK/zrW45WeYahuzLzAV44ro WI7MEdiyx4q6QYQ5eszo6cemIlO5QQzDJOiIsLltWJl/nv2uNnwv5SOA8ShLXKYd04L3 u48S/WtiEzg444RAXC6pEop66hIgYEaxqf6D53jtAGUjsh7XAr2gt1pn/yUSd21AfX7v i/uiFhpf3xvjIsIZ+uNBfo5h1oucW7h/moQSt1gHvVmiJJSCeWq+S77Vr8n0ZJHNwnlN vsDLpRUbC0qDKU9oStlxSV2xvcSt56PmTHDTrwQuGiT73izF33Xd0UyPgaYZW2HqiRex DXqg== X-Gm-Message-State: AO0yUKX4I0eY6+ptgGSNtBANtXDilqgfFh3g95UeOJZrtEhM81YsD+m3 ZcgkRXDMQP0RgL5VNdSljjgPqHYMvoqQRwFCLStTf58JTRvFLX/y7H87UVvN0Hv/ZmBv5ysTVRJ skXTmSNkAoREvNs6hJqofN6oa+gPBVpwqJPJuuacIXlByV4Q= X-Received: by 2002:a17:902:9a06:b0:19c:eaf0:9859 with SMTP id v6-20020a1709029a0600b0019ceaf09859mr7992066plp.38.1677738724546; Wed, 01 Mar 2023 22:32:04 -0800 (PST) X-Google-Smtp-Source: AK7set9xHcBW0nmQZc1OQXn9UPtFIhTiFTlHY78RwfIUXWRdrR5oClUSeyNYBWNkzb+hIxH9sLE10Q== X-Received: by 2002:a17:902:9a06:b0:19c:eaf0:9859 with SMTP id v6-20020a1709029a0600b0019ceaf09859mr7992055plp.38.1677738724273; Wed, 01 Mar 2023 22:32:04 -0800 (PST) Received: from chengendu.. (111-248-105-208.dynamic-ip.hinet.net. [111.248.105.208]) by smtp.gmail.com with ESMTPSA id v8-20020a170902b7c800b0019c13d032d8sm9441650plz.253.2023.03.01.22.32.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 22:32:04 -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 14:32:00 +0800 Message-Id: <20230302063200.35888-2-chengen.du@canonical.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230302063200.35888-1-chengen.du@canonical.com> References: <20230302063200.35888-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 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;