<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi,<br>
On 05/23/2012 02:18 AM, drewd77.gm wrote:
<blockquote
cite="mid:CAMmx0woDVmusLb3qNdqN=2Y4wfucwaaHeKMXuu9EpJMiBXU_Gw@mail.gmail.com"
type="cite">Hi,
<div><br>
</div>
<div>Is there any way to call a function defined in a kernel
module from within the kernel proper?</div>
<div><br>
</div>
<div>Here's what I'm trying to do:</div>
<div><br>
</div>
<div>I'm trying to keep track of when and for how long a process
is being executed on the processor, i.e. I need to know when
context switches occur.</div>
<div><br>
</div>
<div>There is a function called context_switch()
in linux/kernel/sched/core.c that is called whenever a context
switch happens. I would like to call a function in a kernel
module I've written from within context_switch() and pass some
data to it.</div>
</blockquote>
There are lots of ways to do it, maybe you don't need to write a
module or hacking the kernel like that... Check perf and systemtap.
They may help.<br>
<blockquote
cite="mid:CAMmx0woDVmusLb3qNdqN=2Y4wfucwaaHeKMXuu9EpJMiBXU_Gw@mail.gmail.com"
type="cite">
<div><br>
</div>
<div>I've seen how to communicate between user space and kernel
space, such as using a file in /dev or using system calls, but
not how to communicate within the kernel itself.</div>
<div><br>
</div>
<div>Regards,</div>
<div>Drew</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Kernelnewbies mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a>
<a class="moz-txt-link-freetext" href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a>
</pre>
</blockquote>
Regards,<br>
LIU Zhiyou<br>
</body>
</html>