Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751539AbcCCFsx (ORCPT ); Thu, 3 Mar 2016 00:48:53 -0500 Received: from mail-pa0-f54.google.com ([209.85.220.54]:34483 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751325AbcCCFsu (ORCPT ); Thu, 3 Mar 2016 00:48:50 -0500 Date: Thu, 3 Mar 2016 11:18:38 +0530 From: Viresh Kumar To: "Rafael J. Wysocki" Cc: Linux PM list , Peter Zijlstra , Juri Lelli , Steve Muckle , ACPI Devel Maling List , Linux Kernel Mailing List , Srinivas Pandruvada , Vincent Guittot , Michael Turquette Subject: Re: [PATCH 1/6] cpufreq: Reduce cpufreq_update_util() overhead a bit Message-ID: <20160303054838.GH2891@vireshk-i7> References: <2495375.dFbdlAZmA6@vostro.rjw.lan> <3575770.L1lplNLqVv@vostro.rjw.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3575770.L1lplNLqVv@vostro.rjw.lan> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1290 Lines: 33 On 02-03-16, 03:04, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Use the observation that cpufreq_update_util() is only called > by the scheduler with rq->lock held, so the callers of > cpufreq_set_update_util_data() can use synchronize_sched() > instead of synchronize_rcu() to wait for cpufreq_update_util() > to complete. Moreover, if they are updated to do that, > rcu_read_(un)lock() calls in cpufreq_update_util() might be > replaced with rcu_read_(un)lock_sched(), respectively, but > those aren't really necessary, because the scheduler calls > that function from RCU-sched read-side critical sections > already. > > In addition to that, if cpufreq_set_update_util_data() checks > the func field in the struct update_util_data before setting > the per-CPU pointer to it, the data->func check may be dropped > from cpufreq_update_util() as well. > > Make the above changes to reduce the overhead from > cpufreq_update_util() in the scheduler paths invoking it > and to make the cleanup after removing its callbacks less > heavy-weight somewhat. > > Signed-off-by: Rafael J. Wysocki > --- > > Supersedes https://patchwork.kernel.org/patch/8443191/ Acked-by: Viresh Kumar -- viresh