I boot my kernel
with isolcpus=3-7
and I want to run a thread on one of those isolated CPU cores.
Based on this idea, I do:
ctx->workq = create_singlethread_workqueue("my_work");
struct workqueue_attrs *attr = alloc_workqueue_attrs(GFP_KERNEL);
alloc_cpumask_var(&attr->cpumask, GFP_KERNEL);
cpumask_clear(attr->cpumask);
cpumask_set_cpu(5, attr->cpumask);
apply_workqueue_attrs(ctx->workq, attr);
INIT_WORK(&ctx->work, my_work);
But it's not working. The following code reports 0:
static void my_work(struct work_struct *w) {
printk("CPU is: %d\n", get_cpu());
put_cpu();
How can I run this workqueue thread on a specific core (if possible an isolated one)?