4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 021110-1307, USA
24 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
26 * Copyright (c) 2012, 2013, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
30 * Lustre is a trademark of Sun Microsystems, Inc.
32 * libcfs/include/libcfs/linux/linux-mem.h
34 * Basic library routines.
36 * Author: liang@whamcloud.com
39 #ifndef __LIBCFS_LINUX_CPU_H__
40 #define __LIBCFS_LINUX_CPU_H__
42 #ifndef __LIBCFS_LIBCFS_H__
43 #error Do not #include this file directly. #include <libcfs/libcfs.h> instead
47 #error This include is only for kernel use.
50 #include <linux/cpu.h>
51 #include <linux/cpuset.h>
52 #include <linux/topology.h>
53 #include <linux/version.h>
57 #define HAVE_LIBCFS_CPT
59 /** virtual processing unit */
60 struct cfs_cpu_partition {
61 /* CPUs mask for this partition */
62 cpumask_t *cpt_cpumask;
63 /* nodes mask for this partition */
64 nodemask_t *cpt_nodemask;
65 /* NUMA distance between CPTs */
66 unsigned *cpt_distance;
67 /* spread rotor for NUMA allocator */
68 unsigned cpt_spread_rotor;
71 /** descriptor for CPU partitions */
72 struct cfs_cpt_table {
73 /* spread rotor for NUMA allocator */
74 unsigned ctb_spread_rotor;
75 /* maximum NUMA distance between all nodes in table */
76 unsigned ctb_distance;
77 /* # of CPU partitions */
79 /* partitions tables */
80 struct cfs_cpu_partition *ctb_parts;
81 /* shadow HW CPU to CPU partition ID */
83 /* all cpus in this partition table */
84 cpumask_t *ctb_cpumask;
85 /* shadow HW node to CPU partition ID */
87 /* all nodes in this partition table */
88 nodemask_t *ctb_nodemask;
91 void cfs_cpu_core_siblings(int cpu, cpumask_t *mask);
93 #endif /* CONFIG_SMP */
95 #ifndef HAVE_TOPOLOGY_SIBLING_CPUMASK
96 # define topology_sibling_cpumask(cpu) topology_thread_cpumask(cpu)
97 #endif /* HAVE_TOPOLOGY_SIBLING_CPUMASK */
99 #endif /* __LIBCFS_LINUX_CPU_H__ */