2 * Copyright (c) 2015 The Regents of the University of California
3 * Valmon Leymarie <leymariv@berkeley.edu>
4 * Kevin Klues <klueska@cs.berkeley.edu>
5 * See LICENSE for details.
10 /* Forward declared from packed_corealloc.c. Internal representation of a
11 * node in the hierarchy of elements in the cpu topology of the machine (i.e.
12 * numa domain, socket, cpu, core, etc.). Needed here to provide a back
13 * reference for a sched_pcore to its node in the hierarchy. */
16 /* The core request algorithm maintains an internal array of these: the
17 * global pcore map. Note the prov_proc and alloc_proc are weak (internal)
18 * references, and should only be used as a ref source while the ksched has a
21 TAILQ_ENTRY(sched_pcore) prov_next; /* on a proc's prov list */
22 TAILQ_ENTRY(sched_pcore) alloc_next; /* on an alloc list (idle)*/
23 struct proc *prov_proc;
24 struct proc *alloc_proc;
25 struct core_info *core_info;
26 struct sched_pnode *sched_pnode;
28 TAILQ_HEAD(sched_pcore_tailq, sched_pcore);
30 struct core_request_data {
31 struct sched_pcore_tailq alloc_me;
32 struct sched_pcore_tailq prov_alloc_me;
33 struct sched_pcore_tailq prov_not_alloc_me;
36 static inline uint32_t spc2pcoreid(struct sched_pcore *spc)
38 return spc->core_info->core_id;
41 static inline struct sched_pcore *pcoreid2spc(uint32_t pcoreid)
43 extern struct sched_pcore *all_pcores;
45 return &all_pcores[pcoreid];