I am trying to look for a way to register a user process into preempt_notifier_register and then somehow use its callback functions defined in struct preempt_ops { sched_in , sched_out } to come back and tell this process whenever it is preempted and rescheduled. I went ahead and created a character device module since preempt_register_notifier is part of kernel , and called it using an ioctl call.

After all this , my sched_in and sched_out calls which are till part of module fails ( causing system crash ) whenever they are called in. After some debugging i realise this occured because my callback functions are in the module i.e kernel space , whereas the process that registered the preempt_notifier was in user space. So most probably i am assuming the page fault occured since the callback functions are not in user space.

My question is , IS there a way for me to get these call backs into the user space , is it possible to define a function pointer for these call backs and allocate them onto these hooks .

Is there any way Kernel space programs would ever invoke a user space functions ???