ARM public key benchmark

David Miller davem at davemloft.net
Thu Apr 4 19:56:00 CEST 2013


From: nisse at lysator.liu.se (Niels Möller)
Date: Thu, 04 Apr 2013 15:42:15 +0200

> And I have no idea about how to write a Linux kernel module that
> makes a certain function be executed on all available cores; if I
> can find out, I'll definitely try that.

#include <linux/smp.h>

...

	on_each_cpu(my_func, my_func_args, 1);

Where my_func has prototype:

void my_func(void *args);

and my_func_args is "void *"

The third argument is an integer boolean which tells whether to
wait for all cpus to complete the function or not.

You can also do things like only invoke the function on cpus present
in a cpu mask:

	on_each_cpu_mask(cpumask, my_func, my_func_args, 1);

or that pass a given predicate test:

	on_each_cpu_cond(predicate_func, my_func, my_func_args, 1, GFP_*)

where predicate func has prototype:

bool predicate_func(int cpu, void *info);

etc. etc.


More information about the gmp-devel mailing list