Dear All,

I have created a workqueue as follows,

static DECLARE_WORK(task1, file_read, NULL);
static DECLARE_WORK(task2, file_write, NULL);

init_module()
{
sample_wq=create_workqueue("sample1");
BUG_ON(!sample_wq);

if (!queue_work(sample_wq, &task1))
printk("\nProblem in Running Sample1 Workqueue....................\n");
if (!queue_work(sample_wq, &task2))
printk("\nProblem in Running Sample2 Workqueue....................\n");
}

In file_read and file_write tasks i am printing the smp processor id as follows,
void *hcpu = (void *)(long)smp_processor_id();
int cpu = (long)hcpu;
printk("\nCPU%d\n", cpu);

I am expecting the tasks to run in two CPUs in parallel manner. But i they are running serially. Output looks like follows,
file_read is running on CPU0
file_write is running on CPU0
file_read is running on CPU1
file_write is running on CPU1

My expected output is,

file_read is running on CPU0
file_write is running on CPU1
file_read is running on CPU0
file_write is running on CPU1

Can anybody tell me what mistake i am doing here?

Thanks,