mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-29 15:43:59 +08:00
cb83b629ba
The current code groups up to 16 nodes in a level and then puts an ALLNODES domain spanning the entire tree on top of that. This doesn't reflect the numa topology and esp for the smaller not-fully-connected machines out there today this might make a difference. Therefore, build a proper numa topology based on node_distance(). Since there's no fixed numa layers anymore, the static SD_NODE_INIT and SD_ALLNODES_INIT aren't usable anymore, the new code tries to construct something similar and scales some values either on the number of cpus in the domain and/or the node_distance() ratio. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Anton Blanchard <anton@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Chris Metcalf <cmetcalf@tilera.com> Cc: David Howells <dhowells@redhat.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: linux-alpha@vger.kernel.org Cc: linux-ia64@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-mips@linux-mips.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-sh@vger.kernel.org Cc: Matt Turner <mattst88@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Richard Henderson <rth@twiddle.net> Cc: sparclinux@vger.kernel.org Cc: Tony Luck <tony.luck@intel.com> Cc: x86@kernel.org Cc: Dimitri Sivanich <sivanich@sgi.com> Cc: Greg Pearson <greg.pearson@hp.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: bob.picco@oracle.com Cc: chris.mason@oracle.com Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andrew Morton <akpm@linux-foundation.org> Link: http://lkml.kernel.org/n/tip-r74n3n8hhuc2ynbrnp3vt954@git.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
99 lines
2.8 KiB
C
99 lines
2.8 KiB
C
/*
|
|
* Copyright 2010 Tilera Corporation. All Rights Reserved.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation, version 2.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
|
* NON INFRINGEMENT. See the GNU General Public License for
|
|
* more details.
|
|
*/
|
|
|
|
#ifndef _ASM_TILE_TOPOLOGY_H
|
|
#define _ASM_TILE_TOPOLOGY_H
|
|
|
|
#ifdef CONFIG_NUMA
|
|
|
|
#include <linux/cpumask.h>
|
|
|
|
/* Mappings between logical cpu number and node number. */
|
|
extern struct cpumask node_2_cpu_mask[];
|
|
extern char cpu_2_node[];
|
|
|
|
/* Returns the number of the node containing CPU 'cpu'. */
|
|
static inline int cpu_to_node(int cpu)
|
|
{
|
|
return cpu_2_node[cpu];
|
|
}
|
|
|
|
/*
|
|
* Returns the number of the node containing Node 'node'.
|
|
* This architecture is flat, so it is a pretty simple function!
|
|
*/
|
|
#define parent_node(node) (node)
|
|
|
|
/* Returns a bitmask of CPUs on Node 'node'. */
|
|
static inline const struct cpumask *cpumask_of_node(int node)
|
|
{
|
|
return &node_2_cpu_mask[node];
|
|
}
|
|
|
|
/* For now, use numa node -1 for global allocation. */
|
|
#define pcibus_to_node(bus) ((void)(bus), -1)
|
|
|
|
/*
|
|
* TILE architecture has many cores integrated in one processor, so we need
|
|
* setup bigger balance_interval for both CPU/NODE scheduling domains to
|
|
* reduce process scheduling costs.
|
|
*/
|
|
|
|
/* sched_domains SD_CPU_INIT for TILE architecture */
|
|
#define SD_CPU_INIT (struct sched_domain) { \
|
|
.min_interval = 4, \
|
|
.max_interval = 128, \
|
|
.busy_factor = 64, \
|
|
.imbalance_pct = 125, \
|
|
.cache_nice_tries = 1, \
|
|
.busy_idx = 2, \
|
|
.idle_idx = 1, \
|
|
.newidle_idx = 0, \
|
|
.wake_idx = 0, \
|
|
.forkexec_idx = 0, \
|
|
\
|
|
.flags = 1*SD_LOAD_BALANCE \
|
|
| 1*SD_BALANCE_NEWIDLE \
|
|
| 1*SD_BALANCE_EXEC \
|
|
| 1*SD_BALANCE_FORK \
|
|
| 0*SD_BALANCE_WAKE \
|
|
| 0*SD_WAKE_AFFINE \
|
|
| 0*SD_PREFER_LOCAL \
|
|
| 0*SD_SHARE_CPUPOWER \
|
|
| 0*SD_SHARE_PKG_RESOURCES \
|
|
| 0*SD_SERIALIZE \
|
|
, \
|
|
.last_balance = jiffies, \
|
|
.balance_interval = 32, \
|
|
}
|
|
|
|
/* By definition, we create nodes based on online memory. */
|
|
#define node_has_online_mem(nid) 1
|
|
|
|
#endif /* CONFIG_NUMA */
|
|
|
|
#include <asm-generic/topology.h>
|
|
|
|
#ifdef CONFIG_SMP
|
|
#define topology_physical_package_id(cpu) ((void)(cpu), 0)
|
|
#define topology_core_id(cpu) (cpu)
|
|
#define topology_core_cpumask(cpu) ((void)(cpu), cpu_online_mask)
|
|
#define topology_thread_cpumask(cpu) cpumask_of(cpu)
|
|
|
|
/* indicates that pointers to the topology struct cpumask maps are valid */
|
|
#define arch_provides_topology_pointers yes
|
|
#endif
|
|
|
|
#endif /* _ASM_TILE_TOPOLOGY_H */
|