Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1456517pxb; Sun, 12 Sep 2021 20:14:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpKsq/P9OG8iGT0LcZAFoyCFN1ipSxmDDb3GjbHkfdBzcYK79/i9dTNt8kpq4vsQ4vBfDI X-Received: by 2002:a05:6402:1116:: with SMTP id u22mr10950626edv.262.1631502895101; Sun, 12 Sep 2021 20:14:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631502895; cv=none; d=google.com; s=arc-20160816; b=MVCTeRWR3feA/3ks1AWeGSqDGm0QdIhljYXZV9IyYcSIl66dXCL5YSHUQmEyLtqkgL A9xoWPGt4BV8Xfukxvbo5zDfRfqJdjp7ycJkinQeidTWEET8i/w9Qcp3SQcijPkc1D8O 7NQQNPdDc++oeHsW+vo+74jT1+bdKuk7XdmfzGQVponwMt/CwwuvK6GscWSBM4TMkj2K NOygMQP+AiErq+A+4oG3Zw75QghfTynlcc/hZvDdAQWb8D3zBNBOQ8d6tX/SZQYQPzNA VfFGBr5g+KHVdaHeZOjmDdxDn8TltZxyb+QowkUZ+rj3Pq5KjmulhUML1yvldmjd8av1 /57g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=HSGKH38R9yDmw86jpICpyODPhPKayIESamB4ltBOXMg=; b=dYhUeQLVG9L7M/oe/5Se3NaqWP3EJd8X+O6uqTN2nAJ+lBsqASi94Lmij+8oXdIncX nbaCKZDNJeiu1LzdGlQ9AUTlxLzhYzQ0I2s92IoH7LPWuwMi6Xoh2+1DlDRnuDrs5+B/ AQ0rUONM0vIgu/+fzOBur58ynR23v0YQdy9Cx5wMLf63ZvodbZDbEGi3eqy8S3Qy/pgh sVINsFdFFvjIEyXxi3W+OAZ27R480n4ddNfVe6gX+P/alUE9HjVS4Ojv3v5Bye+mjjSh aXHdiarUmf1grFLrCP9Jua6t1o6LpKdBn40aRp9YrEd7yURyumSWiPcZMEnb2cJEoX5Y /qxg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jz10si5868269ejc.758.2021.09.12.20.14.31; Sun, 12 Sep 2021 20:14:55 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237929AbhIMDO0 (ORCPT + 99 others); Sun, 12 Sep 2021 23:14:26 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:16192 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237919AbhIMDOV (ORCPT ); Sun, 12 Sep 2021 23:14:21 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4H7BNL0xGNz1DGt0; Mon, 13 Sep 2021 11:12:02 +0800 (CST) Received: from dggpeml500006.china.huawei.com (7.185.36.76) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Mon, 13 Sep 2021 11:12:59 +0800 Received: from huawei.com (10.175.100.227) by dggpeml500006.china.huawei.com (7.185.36.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Mon, 13 Sep 2021 11:12:59 +0800 From: Tang Yizhou To: , CC: , , Subject: [PATCH] trace: Do some cleanups for osnoise tracer Date: Mon, 13 Sep 2021 11:32:06 +0800 Message-ID: <20210913033206.23682-1-tangyizhou@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.100.227] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500006.china.huawei.com (7.185.36.76) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; 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); -- 2.17.1