From patchwork Wed Sep 2 07:24:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 248963 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp191220ilg; Wed, 2 Sep 2020 00:25:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyC6p9VVsJnctZaucCG0o3jjOAKZnC8RAUL6gJoZihQCm8rd4a75golScHAAhsmZVHn84aX X-Received: by 2002:a05:6402:1b9a:: with SMTP id cc26mr3688606edb.30.1599031547168; Wed, 02 Sep 2020 00:25:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599031547; cv=none; d=google.com; s=arc-20160816; b=rX1efVZEH4e2g6tnW9/syXwIcn6nVIK1eZFPgyWohgkPE0KxQhPnWkTijcI4egmh1J D26s8yo3H0Gc0fhZPN9mhcFsPvmqLZxkQUypoqkiiI22L0Svd4hFrG3hva5keQKO246U q/gmiyqWu4PSXmfMcJ+/BUziR0Gr31EJimn5DZvW2UZJ5qtEr4c7WhSFfRGoM0Mj/937 FWDJeLS+wJ3T/nSxxAJtskncunKoweAIP+FL+zPF2fT2CxL6EpVdLNB6IgyIv4vqxqBo UfiTVXb4Wqbep/SWbSjIKMvjJSVoKzLxlOdh7hgJtWGa2aiB3SR6f+HD9FUtMok+Bhm3 J7FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+tJBzI8lB5wRp0GmHPQXlUe4WhX44ejADtz0Zhvnig4=; b=VqiJULGPhVZiv88blZMXuanZryUd/3gBsZsO7G/J3qQTg/PUjcEyrEtvjgPYqfcI7Z QoyPuaEg8K7j6OJEfpD2YjlWFPpQIJAU/fCmPYDzD39bF8J789HH7tAMvaxT4FxUT5UU j8gUv2I/mdaTLCAQs1/OX7kzTVmJmdAl0/xMlQ6XqVWP3L/7Zha43YffoGlkG6wlKwIn F3VW3VEY8a/efi/jkm33btogoWzH+G4A+Fdo9jlcyegHSNkx2JEfV5MrKcYbmy49Cw3E HhxuLb7b8cDI6njQ00HZmUMo/NbLOgKcpjDa/A2DATqLZG2nSVBEn50EXM0HdTzKMWnW f2Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aWhkyKDW; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u1si1925801eda.219.2020.09.02.00.25.47; Wed, 02 Sep 2020 00:25:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aWhkyKDW; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727801AbgIBHZG (ORCPT + 10 others); Wed, 2 Sep 2020 03:25:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726247AbgIBHZF (ORCPT ); Wed, 2 Sep 2020 03:25:05 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04672C061246 for ; Wed, 2 Sep 2020 00:25:05 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id ds1so1953445pjb.1 for ; Wed, 02 Sep 2020 00:25:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+tJBzI8lB5wRp0GmHPQXlUe4WhX44ejADtz0Zhvnig4=; b=aWhkyKDWAf5betm7xqDa2cSgBjrX/ykPr83ItMwjnU8aSuoXBr6L5cgQA2wfKMApbI kw6gED2PvEapoNJZ5BuBEykbjCWuQVICq/DMqc9hIa3OSwLAOaTaa5GOiwPaoA4Lb3PP CT2A1RTX68yyGQtdLtMZBJUSgLmMs0jz2zo6bjcSIXqAnbk/LTUtwuA8UMskxth+Am+0 8orfpjeS8IeUv2Dxfxy3FxWqrxMYFukMWwuBF96mREo+fRklhDq/As1WbMpBJscIG3SD AIqPjjmMpZFmNZlVK5tf6Lr1TVOR/ynpstIrM7IQKckzLhg4Ot8zqA/EHZ93B2YMxY9z BBIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+tJBzI8lB5wRp0GmHPQXlUe4WhX44ejADtz0Zhvnig4=; b=me1SWiYA6rLizbMYX20zB2GvUu8AtWx/BKmGJ17znfaxnxDtDXMYCGrcgF7h2ROLMM BV+qZq1rFcYkbMD5WOfZznolV30iSdQW5JycBmgphMd8mE9HiC5XINxuAXr4RJEjFZ9z /x3YZzhmPmEE5KWphuVUgiMHmeWS7o/YO4QSXZFFj5XKGKAX/ZC+vFhQt+0MJi3Rsj8z Q01YqJ11jgo3Tm9mcitkRhGPAbjKUWNrsSISOqd/rsLx5bPfYgimwPDRoyxXTHKGMxiD kM5E2h032Yjs4+L560VX27w6ZwQauW43JnbIir5JVCWqeBae+x/gM1R3Tami7SD+nMSH 6Kcg== X-Gm-Message-State: AOAM531+cRlt4CSBP9A0uRqiE2zNQF+eQ6TgDjEwgewskPc0vIW8PhhK 4qS/eLQi6A33yA0biml0MJAHYoUlfdUk2Q== X-Received: by 2002:a17:902:a50e:: with SMTP id s14mr1053168plq.164.1599031504547; Wed, 02 Sep 2020 00:25:04 -0700 (PDT) Received: from localhost ([122.167.135.199]) by smtp.gmail.com with ESMTPSA id h11sm4240987pgm.79.2020.09.02.00.25.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Sep 2020 00:25:03 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Lukasz Luba , cristian.marussi@arm.com, sudeep.holla@arm.com, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] cpufreq: stats: Remove locking Date: Wed, 2 Sep 2020 12:54:42 +0530 Message-Id: X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: References: MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The locking isn't required anymore as stats can get updated only from one place at a time. Remove it. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq_stats.c | 6 ------ 1 file changed, 6 deletions(-) -- 2.25.0.rc1.19.g042ed3e048af diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index fdf9e8556a49..d86ea9744649 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c @@ -19,7 +19,6 @@ struct cpufreq_stats { unsigned int state_num; unsigned int last_index; u64 *time_in_state; - spinlock_t lock; unsigned int *freq_table; unsigned int *trans_table; @@ -41,7 +40,6 @@ static void cpufreq_stats_reset_table(struct cpufreq_stats *stats) { unsigned int count = stats->max_state; - spin_lock(&stats->lock); memset(stats->time_in_state, 0, count * sizeof(u64)); memset(stats->trans_table, 0, count * count * sizeof(int)); stats->last_time = get_jiffies_64(); @@ -50,7 +48,6 @@ static void cpufreq_stats_reset_table(struct cpufreq_stats *stats) /* Adjust for the time elapsed since reset was requested */ atomic_set(&stats->reset_pending, 0); cpufreq_stats_update(stats, stats->reset_time); - spin_unlock(&stats->lock); } static ssize_t show_total_trans(struct cpufreq_policy *policy, char *buf) @@ -244,7 +241,6 @@ void cpufreq_stats_create_table(struct cpufreq_policy *policy) stats->state_num = i; stats->last_time = get_jiffies_64(); stats->last_index = freq_table_get_index(stats, policy->cur); - spin_lock_init(&stats->lock); policy->stats = stats; ret = sysfs_create_group(&policy->kobj, &stats_attr_group); @@ -277,11 +273,9 @@ void cpufreq_stats_record_transition(struct cpufreq_policy *policy, if (old_index == -1 || new_index == -1 || old_index == new_index) return; - spin_lock(&stats->lock); cpufreq_stats_update(stats, stats->last_time); stats->last_index = new_index; stats->trans_table[old_index * stats->max_state + new_index]++; stats->total_trans++; - spin_unlock(&stats->lock); }