Messages in this thread | | | Date | Thu, 15 Mar 2001 11:11:03 -0500 | From | Krisztian Flautner <> | Subject | task switch hook - crashes |
| |
I am experimenting with adding a few hooks to the kernel. One of the hooks gets invoked every time the kernel switches two tasks. To do this I added a single line to schedule() right before the tasks are switched:
... if (task_switch_hook) task_switch_hook(prev, next)
switch_to(prev, next, prev); ...
I then wrote a module that attaches a function to this hook in its init_module() function. The problem is that if I do this, the kernel crashes. Sometimes, the hooks are invoked a few times, other times, the machine locks up immediately. I previous version that compiled everything into the kernel worked fine.
I don't quite understand why this does not work. Is this due to some virtual memory interactions? Maybe the problem is that modules are vmalloc-ed and the hook function should be kmalloc-ed?
Any insights?
Thanks, -- Kris
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |