Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1911646pxb; Mon, 13 Sep 2021 08:02:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBfe1XSKPHZM8mfEWUMgiZ1opV0A5SaaMdD0AjrQmVXnFjkfaJZ/vq828nsH/FGkal1TA9 X-Received: by 2002:a17:906:3146:: with SMTP id e6mr13155176eje.296.1631545357822; Mon, 13 Sep 2021 08:02:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631545357; cv=none; d=google.com; s=arc-20160816; b=GpJaEs/o8Un/NeLcbwROhAIjdQI0HexxvPBLEzbstWDv1ZmbrENl1Q75JL2X1g18km lKHq1Hq5P2iiscmK6jbkey4mFhzj5HCo8PpINf95i1P3bN2uNLoD0RYE5iTCtfMYFlbw RGYFyVGHosUP+Q0ENJnzZ4223G9enpwN/p/JDfoZ601gsjLTRIjwGHmgk+DqMuK0Hljm Q7iyKsBLVPx7ukRoLi++KnknUPiicY32tt4OCeieuHPXG2j/Bx7jeBa7MFVtXhkhN2qf yzCCPLJkCbcTq3rrj65SVJU5XpO7XLShp3k+NvVMTEh/7BAiPNXbrXn3QDz1OEQNbDM4 VLUA== 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=JEDO9UReGPZvdx/V/S56cVYMLNJqllL738d8C4A9xG0=; b=ZCY+trqLSJhokmV48Ahm5VRRWOQV1TUMG2ovhA0e4rIkadvC3o4Os+Kc5Z6oXd6yyE 6P5Clq3JQ/L0sBAf3mnJ1ZC4EByYIVBQBkGIq3T3WFRGG+VFwZXU52U0ou+amS5hHur6 XUGnSm5g3iARIV2JSPO5JpnZmDwou+g+qCdPZJO6xaPB18tA9WNO77GpkK13E6DGgGP+ yt6qXT/GoIoMY6dKPr6qqUxz8GQmy3fRqW2Zh4lT5ZwJExQ508uzGec3GkQ7D+zDlAj6 4Cz2kKtd1J5hy08IgWhT9RKPDwZZIMFqQLvoo71WxvDJxyolN0ei48ISJ764yQHE8F3W GTFg== 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 18si10114051ejc.508.2021.09.13.08.02.10; Mon, 13 Sep 2021 08:02:37 -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 S1345781AbhIMPAZ (ORCPT + 99 others); Mon, 13 Sep 2021 11:00:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:51924 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346443AbhIMO7S (ORCPT ); Mon, 13 Sep 2021 10:59:18 -0400 Received: from oasis.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 4C70F60F36; Mon, 13 Sep 2021 14:58:02 +0000 (UTC) Date: Mon, 13 Sep 2021 10:58:00 -0400 From: Steven Rostedt To: Tang Yizhou Cc: , , Subject: Re: [PATCH] trace: Do some cleanups for osnoise tracer Message-ID: <20210913105800.77699437@oasis.local.home> In-Reply-To: <20210913033206.23682-1-tangyizhou@huawei.com> References: <20210913033206.23682-1-tangyizhou@huawei.com> X-Mailer: Claws Mail 3.18.0 (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 Mon, 13 Sep 2021 11:32:06 +0800 Tang Yizhou wrote: > 1. Add 'static' and 'const' qualifier when necessary. > 2. Use DEFINE_MUTEX() to define a mutex. > > Signed-off-by: Tang Yizhou > --- > kernel/trace/trace_osnoise.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c > index ce053619f289..c1a8dc6a154e 100644 > --- a/kernel/trace/trace_osnoise.c > +++ b/kernel/trace/trace_osnoise.c > @@ -105,7 +105,7 @@ struct osnoise_variables { > /* > * Per-cpu runtime information. > */ > -DEFINE_PER_CPU(struct osnoise_variables, per_cpu_osnoise_var); > +static DEFINE_PER_CPU(struct osnoise_variables, per_cpu_osnoise_var); > > /* > * this_cpu_osn_var - Return the per-cpu osnoise_variables on its relative CPU > @@ -128,7 +128,7 @@ struct timerlat_variables { > u64 count; > }; > > -DEFINE_PER_CPU(struct timerlat_variables, per_cpu_timerlat_var); > +static DEFINE_PER_CPU(struct timerlat_variables, per_cpu_timerlat_var); > > /* > * this_cpu_tmr_var - Return the per-cpu timerlat_variables on its relative CPU > @@ -220,7 +220,7 @@ struct timerlat_sample { > /* > * Protect the interface. > */ > -struct mutex interface_lock; > +static DEFINE_MUTEX(interface_lock); > > /* > * Tracer data. > @@ -1818,8 +1818,8 @@ static struct trace_min_max_param osnoise_print_stack = { > /* > * osnoise/timerlat_period: min 100 us, max 1 s > */ > -u64 timerlat_min_period = 100; > -u64 timerlat_max_period = 1000000; > +static const u64 timerlat_min_period = 100; > +static const u64 timerlat_max_period = 1000000; Can't be const because it can be modified. -- Steve > static struct trace_min_max_param timerlat_period = { > .lock = &interface_lock, > .val = &osnoise_data.timerlat_period, > @@ -2087,8 +2087,6 @@ __init static int init_osnoise_tracer(void) > { > int ret; > > - mutex_init(&interface_lock); > - > cpumask_copy(&osnoise_cpumask, cpu_all_mask); > > ret = register_tracer(&osnoise_tracer);