Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\irq\affinity.c Create Date:2022-07-28 10:15:57
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:__irq_build_affinity_masks

Proto:static int __irq_build_affinity_masks(unsigned int startvec, unsigned int numvecs, unsigned int firstvec, cpumask_var_t *node_to_cpumask, const struct cpumask *cpu_mask, struct cpumask *nmsk, struct irq_affinity_desc *masks)

Type:int

Parameter:

TypeParameterName
unsigned intstartvec
unsigned intnumvecs
unsigned intfirstvec
cpumask_var_t *node_to_cpumask
const struct cpumask *cpu_mask
struct cpumask *nmsk
struct irq_affinity_desc *masks
255  done = 0
256  last_affv = firstvec + numvecs
257  curvec = startvec
258  nodemsk = NODE_MASK_NONE
261  If Not pumask_weight - Count of bits in *srcp*@srcp: the cpumask to count bits (< nr_cpu_ids) in. Then Return 0
264  nodes = get_nodes_in_cpumask(node_to_cpumask, cpu_mask, & nodemsk)
270  If numvecs <= nodes Then
272  pumask_or - *dstp = *src1p | *src2p*@dstp: the cpumask result*@src1p: the first input*@src2p: the second input
274  If ++curvec == last_affv Then curvec = firstvec
277  Return numvecs
280  node_vectors = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
283  If Not node_vectors Then Return -ENOMEM
287  Allocate vector number for each node, so that for each node:* 1) the allocated number is >= 1* 2) the allocated numbver is <= active CPU number of this node* The actual allocated total vectors may be less than @numvecs when
290  When i < nr_node_ids cycle
292  nv = node_vectors[i]
294  If nvectors == UINT_MAX Then Continue
298  pumask_and - *dstp = *src1p & *src2p*@dstp: the cpumask result*@src1p: the first input*@src2p: the second input* If *@dstp is empty, returns 0, else returns 1
299  ncpus = pumask_weight - Count of bits in *srcp*@srcp: the cpumask to count bits (< nr_cpu_ids) in.
300  If Not ncpus Then Continue
303  WARN_ON_ONCE(nvectors > ncpus)
306  extra_vecs = ncpus - nvectors * ncpus / nvectors
309  When v < nvectors cycle
313  If extra_vecs Then
314  cpus_per_vec++
315  --extra_vecs
322  If curvec >= last_affv Then curvec = firstvec
327  done += nvectors
329  kfree - free previously allocated memory*@objp: pointer returned by kmalloc.* If @objp is NULL, no operation is performed.* Don't free memory not originally allocated by kmalloc()* or you will run into trouble.
330  Return done
Caller
NameDescribe
irq_build_affinity_masksld affinity in two stages:* 1) spread present CPU on these vectors* 2) spread other possible CPUs on these vectors