From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [RFT][PATCH v4 4/7] cpuidle: Return nohz hint from cpuidle_select() Date: Wed, 14 Mar 2018 13:59:29 +0100 Message-ID: <20180314125929.GU4043@hirez.programming.kicks-ass.net> References: <2352117.3UUoYAu18A@aspire.rjw.lan> <15847301.VVmNzm1RNz@aspire.rjw.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <15847301.VVmNzm1RNz@aspire.rjw.lan> Sender: linux-kernel-owner@vger.kernel.org To: "Rafael J. Wysocki" Cc: Linux PM , Frederic Weisbecker , Thomas Gleixner , Paul McKenney , Thomas Ilsche , Doug Smythies , Rik van Riel , Aubrey Li , Mike Galbraith , LKML List-Id: linux-pm@vger.kernel.org On Mon, Mar 12, 2018 at 10:54:18AM +0100, Rafael J. Wysocki wrote: > @@ -378,6 +384,26 @@ static int menu_select(struct cpuidle_dr > if (idx == -1) > idx = 0; /* No states enabled. Must use 0. */ > > + if (drv->states[idx].flags & CPUIDLE_FLAG_POLLING) { > + *nohz_ret = false; > + } else if (drv->states[idx].target_residency < TICK_USEC_HZ) { > + first_idx = idx; > + for (i = idx + 1; i < drv->state_count; i++) { > + if (!drv->states[i].disabled && > + !dev->states_usage[i].disable) { > + first_idx = i; > + break; > + } } > + > + /* > + * Do not stop the tick if there is at least one more state > + * within the tick period range that could be used if longer > + * idle duration was predicted. > + */ > + *nohz_ret = !(first_idx > idx && > + drv->states[first_idx].target_residency < TICK_USEC_HZ); Why though? That comment only states what it does, but gives no clue as to why we're doing this. What was wrong with disabling NOHZ if the selected state (@idx) has shorter target residency. > + } > + > data->last_state_idx = idx; > > return data->last_state_idx; >