mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 05:56:14 -04:00
selftests/powerpc: Allow bind_to_cpu() to automatically pick CPU
All current users of bind_to_cpu() don't care _which_ CPU they get, just that they are bound to a single free one. So alter the interface to 1. Accept a BIND_CPU_ANY value that tells it to automatically pick a CPU 2. Return the picked CPU And convert all these users to bind_to_cpu(BIND_CPU_ANY). Signed-off-by: Benjamin Gray <bgray@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20230406043320.125138-4-bgray@linux.ibm.com
This commit is contained in:
committed by
Michael Ellerman
parent
c97b2fc662
commit
6ff4dc2548
@@ -455,13 +455,24 @@ done:
|
||||
int bind_to_cpu(int cpu)
|
||||
{
|
||||
cpu_set_t mask;
|
||||
int err;
|
||||
|
||||
if (cpu == BIND_CPU_ANY) {
|
||||
cpu = pick_online_cpu();
|
||||
if (cpu < 0)
|
||||
return cpu;
|
||||
}
|
||||
|
||||
printf("Binding to cpu %d\n", cpu);
|
||||
|
||||
CPU_ZERO(&mask);
|
||||
CPU_SET(cpu, &mask);
|
||||
|
||||
return sched_setaffinity(0, sizeof(mask), &mask);
|
||||
err = sched_setaffinity(0, sizeof(mask), &mask);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return cpu;
|
||||
}
|
||||
|
||||
bool is_ppc64le(void)
|
||||
|
||||
Reference in New Issue
Block a user