Hi, I'm doing this because this module is meant to be the lower layer from other ones. This layer offers a full interface for monitoring resources and handling overruns on the system. I need both, monitoring and accounting to provide the info to high level applications. I suppose there could be a way to access a module function from the scheduler but i can't find one. The other solution is to solve that memory problem. I can explain it a little more:
MODULE INITIALIZATION: starts the module and active a flag on kernel to inform it that the module has been loaded. The kernel export a pointer to a void function and this initialization points the pointer to the switch process handler. KERNEL SCHEDULER: before switching process it checks if the module is loaded. If it is, the scheduler calls the void function. On the switch process handler function i access a variable declared on the module which contains some info. The direction of this variable changes when is accessed for the function as a callback from the kernel and when is accessed for the function when is called from the module itself ( I have checked this with many kernel traces). I don't know why this can happens, perhaps someone can help me with this. 2008/2/29, Steve <[EMAIL PROTECTED]>: > > Hi David, > > On Fri 29/02/08 4:17 PM , "David Embid" [EMAIL PROTECTED] sent: > > Actually the monitoring is only a first step. With the monitored data > > the module tries to manage the resources. The task monitored have a > > budget linked so when they run more time than their budget a handling > > function is called. > > Just a curious question. Why are you doing this in a kernel module ? You > could > very well implement cpu/memory limits using tools such as 'ulimit', > 'pam_limits', > 'nice', 'chrt', 'taskset' ...etc. Ofcouse, none of these do any > monitoring, but > if you are monitoring just for the sake of implementing limits, I would > think > doing that in the kernel would be way more complicated than using any one > or a > combination of the tools mentioned above. > > regards, > - steve > > > > So I need the function on the module to be > > accessed form the kernel linux in some way. I forget specifying I > > am working with Kernel 2.6 Thanks for answering, Regards > > > > 2008/2/29, Steve : Hi David, > > > > On Fri 29/02/08 12:59 PM , "David Embid" [EMAIL PROTECTED] [2] > > sent: > > > Hi, > > > > > > i have been developing a little module to monitoring the use of CPU > > > for some processes. For this, I need to handle the moment when the > > > scheduler switch the processes. My problem is that I don't know > > > how can I access the handling function (contained on my kernel > > > module) from the kernel scheduler (sched.c). I have tried with a > > > function callback. My module overwrite a function pointer used by > > the > > > kernel to acces the handler when the module is loaded. This > > solution > > > seems to work properly and the function is called every switch made > > > by the scheduler. The problem is that the variables used on the > > > function have different memory direction when the function is > > called > > > by the callback on the kernel and the direction when the variable > > is > > > used on other function in the module. > > > Can someone give me some advice? > > Well, I am a kernel n00b myself, but if you are interested in just > > monitoring and are not really doing this as an exercise to learn > > kernel programming, I think susing systemtap would be ideal for > > something like this. > > http://sourceware.org/systemtap/ [3] > > http://sourceware.org/systemtap/documentation.html [4] > > > > Could someone here possibly post a stap script to do what David needs > > ? > > regards, > > - steve > > > > > > Links: > > ------ > > [1] > > > http://webmail.lonetwin.net/javascript:top.opencompose(\'[EMAIL PROTECTED] > > \',\'\',\'\',\'\')[2] > > > http://webmail.lonetwin.net/javascript:top.opencompose(\'[EMAIL PROTECTED] > > om\',\'\',\'\',\'\')[3] http://sourceware.org/systemtap/ > > [4] http://sourceware.org/systemtap/documentation.html > > > > > > >
