From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753592AbcCAM5i (ORCPT ); Tue, 1 Mar 2016 07:57:38 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:60333 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750823AbcCAM5h (ORCPT ); Tue, 1 Mar 2016 07:57:37 -0500 Date: Tue, 1 Mar 2016 13:57:27 +0100 From: Peter Zijlstra To: "Rafael J. Wysocki" Cc: Steve Muckle , Ingo Molnar , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Vincent Guittot , Morten Rasmussen , Dietmar Eggemann , Juri Lelli , Patrick Bellasi , Michael Turquette , Ricky Liang Subject: Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency selection Message-ID: <20160301125727.GT6357@twins.programming.kicks-ass.net> References: <1456190570-4475-1-git-send-email-smuckle@linaro.org> <1792311.cuUNhUde5n@vostro.rjw.lan> <20160226091843.GX6356@twins.programming.kicks-ass.net> <1743951.Hhdov0yvNG@vostro.rjw.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1743951.Hhdov0yvNG@vostro.rjw.lan> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 27, 2016 at 01:08:02AM +0100, Rafael J. Wysocki wrote: > @@ -95,18 +98,20 @@ EXPORT_SYMBOL_GPL(cpufreq_set_update_uti > * > * This function is called by the scheduler on every invocation of > * update_load_avg() on the CPU whose utilization is being updated. > + * > + * It can only be called from RCU-sched read-side critical sections. > */ > void cpufreq_update_util(u64 time, unsigned long util, unsigned long max) > { > struct update_util_data *data; > > - rcu_read_lock(); > - Maybe, just because I'm paranoid, add something like: #ifdef CONFIG_LOCKDEP WARN_ON(debug_locks && !rcu_read_lock_sched_held()); #endif > data = rcu_dereference(*this_cpu_ptr(&cpufreq_update_util_data)); > - if (data && data->func) > + /* > + * If this isn't inside of an RCU-sched read-side critical section, data > + * may become NULL after the check below. > + */ > + if (data) > data->func(data, time, util, max); > - > - rcu_read_unlock(); > }