![]() |
attach preempt_notifier to user process in linux
I am needing to identify whether a user process was ever preempted somehow, I understand we have hooks in preempt.h and sched.c which allow us to define preempt_notifiers which can in turn call sched_in and sched_out functions whenever a process is rescheduled or preempted.
But I still can't find out how can I attach a notifier to a particular process or pid in user space and then somehow log if this particular process was ever pre-empted. I'm assuming I have to write a module to do so, but how would I go about attaching a pid to a particular notifier? |
Probably the cleanest approach would be to attach a preemption-counter which is incremented (with silent rollover in case of overflow) each time the process is dispatched. I do not readily know if such a counter now exists but it would not surprise me if it did. The process can read the counter twice: if it changed, pre-emption did occur. The value is unimportant.
|
Well , i did find a way to use preempt_notifiers , following thread tells how to do that using psuedo syscall.
http://stackoverflow.com/questions/1...ocess-in-linux But , when i do try to run a user program to to make the call , my linux gnome shell becomes unresponsive and only option is to do a hard reset. Any clues what could possibly cause this ? |
Found the solution notifier has to be global
|
| All times are GMT -5. The time now is 10:15 PM. |