Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp349307pxb; Sat, 11 Sep 2021 07:03:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZ58nNuX7TTqH9MOqWXaPYxPEWPqM25LMg4ePAwVtH7oWbQIgFOSQmw+clMoOoL87ZTVPR X-Received: by 2002:a17:906:6691:: with SMTP id z17mr3007846ejo.207.1631369032276; Sat, 11 Sep 2021 07:03:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631369032; cv=none; d=google.com; s=arc-20160816; b=m51q7iO1zlHcUVIviUeWuns83K139KjOek54aiX0uxGSIcaOoyDvh5djReC2JpP48B WAbhrjEOHnVOPLCRud7WeXY0DKZhOXjIUjYCqi07sr1KP5OUdOIMFro4tvW7r2WNrs6m a+qXBl4/MldNQi/hmupLRynWDAzQ95XEwjAvSangV4CXvzxSMDgjObCLBwhSo06ycJq6 wbvgf3rdVtAWgyJFklHc3Mk+C2jVNWEH0ORdGltqDJnFpHxq2aN6NV+nYob6H9A0cx5O c7WJBfSgDQAuFTMD8IOZf1wXHDXWZ1/dtV2kem1ZOlclB/mx0BGJHxk8pM+B0Igghb2l EjOw== 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=JyJhPZpAsKEw+XVUatC619/5zu+11xXg5A069RI0uLM=; b=FiAFuIo+DPG3pqZ07lRHtZU6g66tByT6Tk2oWO7LDvegVviNBD6aVrdtwoG9qoYcnT JbkSiXV++i1fCXJv4IMmGZyaPnNIvgdSCnSC1vIu19QaU7UwGE1xrKqHh0WIcGJsVEvO V7i+7uvwden96LeyYUIBk82aQtP2vLr1p9LuSZDZhHXbMWuvFKEVILRvOtmVDOMspKaX SPYeJ+79+HR87c7v8zQH4KWy0UEGVXYhsMNVypamfYcft6S9++pFtIwCjSE50jK3T8OT G/zCErUpAfFhMnfVac3bejj/Jp9UYdnTlAVNFk0WtPTGLwB+BO/WGM9vVmvVOgSXdaTb yDZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s18si2290495eji.655.2021.09.11.07.03.28; Sat, 11 Sep 2021 07:03:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236110AbhIKOAw (ORCPT + 99 others); Sat, 11 Sep 2021 10:00:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:40384 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230249AbhIKOAv (ORCPT ); Sat, 11 Sep 2021 10:00:51 -0400 Received: from rorschach.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BE84E61209; Sat, 11 Sep 2021 13:59:38 +0000 (UTC) Date: Sat, 11 Sep 2021 09:59:37 -0400 From: Steven Rostedt To: Yinan Liu Cc: mark-pk.tsai@mediatek.com, peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] scripts: ftrace - move the sort-processing in ftrace_init to compile time Message-ID: <20210911095937.5a298619@rorschach.local.home> In-Reply-To: <20210911135043.16014-2-yinan@linux.alibaba.com> References: <20210911135043.16014-1-yinan@linux.alibaba.com> <20210911135043.16014-2-yinan@linux.alibaba.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 11 Sep 2021 21:50:42 +0800 Yinan Liu wrote: > When ftrace is enabled, ftrace_init will consume a period of > time, usually around 15~20 ms. Approximately 40% of the time is > consumed by sort-processing. Moving the sort-processing to the > compile time can speed up the kernel boot process. > Nice. I like the idea of sorting at compile time. > performance test: > env: Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50GHz > method: before and after patching, compare the > total time of ftrace_init(), and verify > the functionality of ftrace. > > avg_time of ftrace_init: > with patch: 8.352 ms > without patch: 15.763 ms > > Signed-off-by: Yinan Liu > --- > kernel/trace/ftrace.c | 5 ++- > scripts/link-vmlinux.sh | 6 +-- > scripts/sorttable.c | 2 + > scripts/sorttable.h | 109 +++++++++++++++++++++++++++++++++++++++++++++++- > 4 files changed, 115 insertions(+), 7 deletions(-) > > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c > index 7efbc8aaf7f6..c236da868990 100644 > --- a/kernel/trace/ftrace.c > +++ b/kernel/trace/ftrace.c > @@ -6189,8 +6189,9 @@ static int ftrace_process_locs(struct module *mod, > if (!count) > return 0; > > - sort(start, count, sizeof(*start), > - ftrace_cmp_ips, NULL); > + if (mod) Why can't we enforce modules to be sorted too? > + sort(start, count, sizeof(*start), > + ftrace_cmp_ips, NULL); -- Steve