Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
5e385a6
Documentation
arch
block
certs
crypto
drivers
firmware
fs
include
init
ipc
kernel
bpf
configs
debug
events
gcov
irq
Kconfig
Makefile
affinity.c
autoprobe.c
chip.c
cpuhotplug.c
debug.h
devres.c
dummychip.c
generic-chip.c
handle.c
internals.h
ipi.c
irqdesc.c
irqdomain.c
manage.c
migration.c
msi.c
pm.c
proc.c
resend.c
settings.h
spurious.c
livepatch
locking
power
printk
rcu
sched
time
trace
.gitignore
Kconfig.freezer
Kconfig.hz
Kconfig.locks
Kconfig.preempt
Makefile
acct.c
async.c
audit.c
audit.h
audit_fsnotify.c
audit_tree.c
audit_watch.c
auditfilter.c
auditsc.c
backtracetest.c
bounds.c
capability.c
cgroup.c
cgroup_freezer.c
cgroup_pids.c
compat.c
configs.c
context_tracking.c
cpu.c
cpu_pm.c
cpuset.c
crash_dump.c
cred.c
delayacct.c
dma.c
elfcore.c
exec_domain.c
exit.c
extable.c
fork.c
freezer.c
futex.c
futex_compat.c
groups.c
hung_task.c
irq_work.c
jump_label.c
kallsyms.c
kcmp.c
kcov.c
kexec.c
kexec_core.c
kexec_file.c
kexec_internal.h
kmod.c
kprobes.c
ksysfs.c
kthread.c
latencytop.c
membarrier.c
memremap.c
module-internal.h
module.c
module_signing.c
notifier.c
nsproxy.c
padata.c
panic.c
params.c
pid.c
pid_namespace.c
profile.c
ptrace.c
range.c
reboot.c
relay.c
resource.c
seccomp.c
signal.c
smp.c
smpboot.c
smpboot.h
softirq.c
stacktrace.c
stop_machine.c
sys.c
sys_ni.c
sysctl.c
sysctl_binary.c
task_work.c
taskstats.c
test_kprobes.c
torture.c
tracepoint.c
tsacct.c
uid16.c
up.c
user-return-notifier.c
user.c
user_namespace.c
utsname.c
utsname_sysctl.c
watchdog.c
workqueue.c
workqueue_internal.h
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.get_maintainer.ignore
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
REPORTING-BUGS
Breadcrumbs
linux
/
kernel
/
irq
/
affinity.c
Blame
Blame
Latest commit
History
History
61 lines (51 loc) · 1.46 KB
Breadcrumbs
linux
/
kernel
/
irq
/
affinity.c
Top
File metadata and controls
Code
Blame
61 lines (51 loc) · 1.46 KB
Raw
#include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/slab.h> #include <linux/cpu.h> static int get_first_sibling(unsigned int cpu) { unsigned int ret; ret = cpumask_first(topology_sibling_cpumask(cpu)); if (ret < nr_cpu_ids) return ret; return cpu; } /* * Take a map of online CPUs and the number of available interrupt vectors * and generate an output cpumask suitable for spreading MSI/MSI-X vectors * so that they are distributed as good as possible around the CPUs. If * more vectors than CPUs are available we'll map one to each CPU, * otherwise we map one to the first sibling of each socket. * * If there are more vectors than CPUs we will still only have one bit * set per CPU, but interrupt code will keep on assigning the vectors from * the start of the bitmap until we run out of vectors. */ struct cpumask *irq_create_affinity_mask(unsigned int *nr_vecs) { struct cpumask *affinity_mask; unsigned int max_vecs = *nr_vecs; if (max_vecs == 1) return NULL; affinity_mask = kzalloc(cpumask_size(), GFP_KERNEL); if (!affinity_mask) { *nr_vecs = 1; return NULL; } if (max_vecs >= num_online_cpus()) { cpumask_copy(affinity_mask, cpu_online_mask); *nr_vecs = num_online_cpus(); } else { unsigned int vecs = 0, cpu; for_each_online_cpu(cpu) { if (cpu == get_first_sibling(cpu)) { cpumask_set_cpu(cpu, affinity_mask); vecs++; } if (--max_vecs == 0) break; } *nr_vecs = vecs; } return affinity_mask; }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
You can’t perform that action at this time.