From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755324AbdLTPFJ (ORCPT ); Wed, 20 Dec 2017 10:05:09 -0500 Received: from merlin.infradead.org ([205.233.59.134]:46836 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754846AbdLTPFI (ORCPT ); Wed, 20 Dec 2017 10:05:08 -0500 Date: Wed, 20 Dec 2017 16:05:02 +0100 From: Peter Zijlstra To: Vincent Guittot Cc: Brendan Jackman , Dietmar Eggemann , Ingo Molnar , linux-kernel , Ingo Molnar , Morten Rasmussen Subject: Re: [PATCH v2 1/2] sched: force update of blocked load of idle cpus Message-ID: <20171220150502.nyjrbvwgbh56bgbs@hirez.programming.kicks-ass.net> References: <20171201180157.18937-1-brendan.jackman@arm.com> <20171201180157.18937-2-brendan.jackman@arm.com> <20171220140306.egxub7sog4il2plm@hirez.programming.kicks-ass.net> <20171220150110.4iglytjqgqinehy6@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171220150110.4iglytjqgqinehy6@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 20, 2017 at 04:01:10PM +0100, Peter Zijlstra wrote: > Well, you shouldn't mix atomic and non-atomic ops to the same word, > that's asking for trouble. > > But why don't you do something like: > > nohz_kick() > > flags = NOHZ_STAT; > if (!only_update) > flags |= NOHZ_BALANCE; > > atomic_long_or(flags, &nohz_cpu(cpu)); > > > nohz_idle_balance() > > unsigned long do_flags = atomic_long_fetch_andnot(NOHZ_BALANCE|NOHZ_STAT, &nohz_flags(cpu)); > > if (do_flags & NOHZ_STAT) > update_blocked_stuff(); > > if (do_flags & NOHZ_BALANCE) > rebalance_domains(); > > That way its far more readable. we could use atomic_t too, there's not that many flags in there, the only reason its long is because of that bitmap crud.