I must add that I do null pointer checking.
I also tried it with remove_from_wait_queue folowed by wake_up_process. They dont work as expected. I searched the web and found out that there is something called TASK_EXCLUSIVE but this is not supported by the kernel I am working on either.
The closest I get is when I tried to clone wake_up system call with a slight modification. It returns after awaking first process from the queue. This works without any error but sometimes no one wakes.
Thank you