preempt_notifiers for user processes

Hi,

I am currently working on a project which requires me to somehow indentify preemption on some sets of user processes. I stumbled upon preempt_notifiers hooks which were designed primarily for KVM by Avi Kivity. I assumed that these hooks were generic enough to be registered from user process as well.

To test this I wrote a char device module which has an ioctl function allowing any user process to call in and register onto preempt_notifier . The call backs in preempt_ops ( sched_in and sched_out ) are also part of the module code. Currently the kernel / machine crashes as soon as the sched_out function is fired in . When I debugged this it looks like it is caused by some major page fault.

I need some help in understanding if it is at all possible to use these hooks from User process , if it is currently not possible , how difficult is it to have it updated so that user process can use these hooks as well.

Thanks,
Mahesh.