From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752993AbcDRNhR (ORCPT ); Mon, 18 Apr 2016 09:37:17 -0400 Received: from mail-wm0-f53.google.com ([74.125.82.53]:35775 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752044AbcDRNhP (ORCPT ); Mon, 18 Apr 2016 09:37:15 -0400 Date: Mon, 18 Apr 2016 15:37:09 +0200 From: Richard Cochran To: vatikaharlalka@gmail.com Cc: Frederic Weisbecker , Preeti U Murthy , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org Subject: get_nohz_timer_target? Message-ID: <20160418133709.GA10358@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Looking at kernel/sched/core.c:get_nohz_timer_target(), I don't understand the change made in: commit 9642d18eee2cd169b60c6ac0f20bda745b5a3d1e Author: Vatika Harlalka Date: Tue Sep 1 16:50:59 2015 +0200 nohz: Affine unpinned timers to housekeepers After that change, the code now reads like this: int i, cpu = smp_processor_id(); struct sched_domain *sd; if (!idle_cpu(cpu) && is_housekeeping_cpu(cpu)) return cpu; rcu_read_lock(); for_each_domain(cpu, sd) { for_each_cpu(i, sched_domain_span(sd)) { if (!idle_cpu(i) && is_housekeeping_cpu(cpu)) { --------------------------------------------------------------- ^^^ Was this supposed to be 'i' instead? If not, how does this test make any sense? In any case, testing over and over again is surely wasteful. --------------------------------------------------------------- cpu = i; goto unlock; } } } if (!is_housekeeping_cpu(cpu)) cpu = housekeeping_any_cpu(); unlock: rcu_read_unlock(); return cpu; Thanks, Richard