Run queue corruption issue
From: Greg KH <hidden>
Date: 2016-05-17 23:20:27
On Tue, May 17, 2016 at 06:55:07PM -0400, Jerrin Shaji George wrote:
Hi All, I wanted help with a piece of code that I have been working on. Please see - https://gist.github.com/jerrinsg/333e584d1f65dc95b9f13b61dcebdaa7 I have written two function, migrate_to and migrate_back. migrate_to is used to remove a process from the run queue, and migrate_back is used to insert this process back into the run queue. The gist is from a taken from a larger project, where we are working on building a mechanism to support thread migration across heterogeneous processors. migrate_to_call() will be called by a thread which wants to remove itself from the run queue (hence, it will pass the current task struct as the migration argument). Once the other processor completes execution of the assigned task, it will interrupt the main processor, which runs an interrupt handler, which in turn calls the migrate_back_call() function. It passes the task struct of the process that was removed from the run queue earlier to this function. This mechanism works fine the first few times, but when this process is repeated many times in a loop, I am seeing a run queue corruption: https://gist.github.com/jerrinsg/0ab09cd435d8d2cb6ae692c7e6f4f26b Is there anything wrong in the process dequeue or enqueue function that I have written? Please help!
volatile doesn't mean what you think it does, please don't use it in the kernel. And why are you using "raw_spin_lock()"?
Kernel used: Linux 3.13
Wow that's obsolete and buggy, why use such an old thing? greg k-h