Lines Matching refs:cid
11 #include "cid.h"
14 * cid tables. The cid kfuncs are available whether the root scheduler is
15 * cid-form or cpu-form, the latter to allow gradual migration to cids, so every
142 * scx_cid_retire_tables - Unpublish and retire the cid tables
168 * scx_cid_init - build the cid mapping
174 * See "Topological CPU IDs" in cid.h for the model. Walk online cpus by
195 s32 cpu, cid, si;
197 /* CMASK_MAX_WORDS in cid.bpf.h covers NR_CPUS up to 8192 */
223 /* -1 sentinels for sparse-possible cpu id holes (0 is a valid cid) */
237 * cid. cpumask_of_node(-1) is undefined.
285 * cid count reaches max. The latter bounds
305 s32 cid = next_cid++;
307 tbls->cid_to_cpu[cid] = ccpu;
308 tbls->cpu_to_cid[ccpu] = cid;
309 tbls->cid_to_shard[cid] = shard_idx;
310 tbls->topo[cid] = (struct scx_cid_topo){
330 * No-topo section: any possible cpu without a cid - normally just the
332 * SCX_CID_SHARD_MAX_CPUS) cids so that every cid has a valid shard
347 cid = next_cid++;
348 tbls->cid_to_cpu[cid] = cpu;
349 tbls->cpu_to_cid[cpu] = cid;
352 notopo_shard_cid = cid;
358 tbls->cid_to_shard[cid] = notopo_shard_idx;
359 tbls->topo[cid] = SCX_CID_TOPO_NEG;
360 tbls->topo[cid].shard_cid = notopo_shard_cid;
361 tbls->topo[cid].shard_idx = notopo_shard_idx;
373 * cid ranges by construction: base_cid is the first cid landing in a
376 for (cid = 0; cid < next_cid; cid++) {
377 s32 sidx = tbls->cid_to_shard[cid];
380 tbls->shard_ranges[sidx].base_cid = cid;
451 * scx_bpf_cid_override - Install an explicit cpu->cid mapping with shard info
452 * @cpu_to_cid__arena: array of nr_cpu_ids s32 entries (cid for each cpu)
454 * @shard_start__arena: array of first-cid-of-each-shard, one entry per shard
459 * topology-probed cid mapping and shard layout with caller-provided ones. Each
460 * possible cpu must map to a unique cid in [0, num_possible_cpus()). The shard
480 s32 cpu, cid, si;
566 scx_error(sch, "cid %d assigned to multiple cpus", c);
586 for (cid = shard_start[si]; cid < end; cid++) {
587 s32 node = cpu_to_node(tbls->cid_to_cpu[cid]);
597 * @shard_start. Walk shards to derive shard_cid/shard_idx for each cid.
600 for (cid = 0; cid < npossible; cid++) {
601 if (si + 1 < nr_shards && cid >= shard_start[si + 1])
603 tbls->cid_to_shard[cid] = si;
604 tbls->topo[cid] = SCX_CID_TOPO_NEG;
605 tbls->topo[cid].shard_cid = shard_start[si];
606 tbls->topo[cid].shard_idx = si;
622 * scx_bpf_cid_to_cpu - Return the raw CPU id for @cid
623 * @cid: cid to look up
626 * Return the raw CPU id for @cid. Trigger scx_error() and return -EINVAL if
627 * @cid is invalid. The cid<->cpu mapping is static for the lifetime of the
631 __bpf_kfunc s32 scx_bpf_cid_to_cpu(s32 cid, const struct bpf_prog_aux *aux)
640 return scx_cid_to_cpu(sch, cid);
644 * scx_bpf_cpu_to_cid - Return the cid for @cpu
648 * Return the cid for @cpu. Trigger scx_error() and return -EINVAL if @cpu is
649 * invalid. The cid<->cpu mapping is static for the lifetime of the loaded
913 * scx_bpf_cid_topo - Copy out per-cid topology info
914 * @cid: cid to look up
919 * Fill @out with the topology info for @cid. Trigger scx_error() if @cid is out
920 * of range. If @cid is valid but in the no-topo section, all fields are set to
921 * -1. All fields are also set to -1 when no cid tables have been published yet,
927 __bpf_kfunc void scx_bpf_cid_topo(s32 cid, struct scx_cid_topo *out, size_t out__sz,
941 if (unlikely(!sch) || !cid_valid(sch, cid) || unlikely(!topo))
944 memcpy(out, &topo[cid], len);
1015 * @base: first cid of the active range
1052 * Set @out to the intersection of @ref's range with @shard_idx's cid range,
1133 * Write @ref's active range one word at a time, setting each cid's bit when
1155 u32 cid = word_first_cid + bit;
1157 if (cid < base || cid >= base + nr_cids)
1159 if (cpumask_test_cpu(__scx_cid_to_cpu(cid), cpumask))