From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753061Ab3GFKjK (ORCPT ); Sat, 6 Jul 2013 06:39:10 -0400 Received: from merlin.infradead.org ([205.233.59.134]:40627 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752938Ab3GFKjI (ORCPT ); Sat, 6 Jul 2013 06:39:08 -0400 Date: Sat, 6 Jul 2013 12:38:13 +0200 From: Peter Zijlstra To: Mel Gorman Cc: Srikar Dronamraju , Ingo Molnar , Andrea Arcangeli , Johannes Weiner , Linux-MM , LKML Subject: Re: [PATCH 06/15] sched: Reschedule task on preferred NUMA node once selected Message-ID: <20130706103813.GQ18898@dyad.programming.kicks-ass.net> References: <1373065742-9753-1-git-send-email-mgorman@suse.de> <1373065742-9753-7-git-send-email-mgorman@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1373065742-9753-7-git-send-email-mgorman@suse.de> 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, Jul 06, 2013 at 12:08:53AM +0100, Mel Gorman wrote: > +static int > +find_idlest_cpu_node(int this_cpu, int nid) > +{ > + unsigned long load, min_load = ULONG_MAX; > + int i, idlest_cpu = this_cpu; > + > + BUG_ON(cpu_to_node(this_cpu) == nid); > + > + rcu_read_lock(); > + for_each_cpu(i, cpumask_of_node(nid)) { > + load = weighted_cpuload(i); > + > + if (load < min_load) { > + /* > + * Kernel threads can be preempted. For others, do > + * not preempt if running on their preferred node > + * or pinned. > + */ > + struct task_struct *p = cpu_rq(i)->curr; > + if ((p->flags & PF_KTHREAD) || > + (p->numa_preferred_nid != nid && p->nr_cpus_allowed > 1)) { > + min_load = load; > + idlest_cpu = i; > + } So I really don't get this stuff.. if it is indeed the idlest cpu preempting others shouldn't matter. Also, migrating a task there doesn't actually mean it will get preempted either. In overloaded scenarios it expected that multiple tasks will run on the same cpu. So this condition will also explicitly make overloaded scenarios work less well. > + } > + } > + rcu_read_unlock(); > + > + return idlest_cpu; > +}