lkml.org 
[lkml]   [2001]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjecttask 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/

\
 
 \ /
  Last update: 2005-03-22 13:29    [W:0.051 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site