Quoting Arjan van de Ven <arjan@xxxxxxxxxxxxx>: > On Sun, 2005-04-17 at 14:10 +0100, A.M. Fradley wrote: > > I'm not sure if it's much different to the swap token thing. What area > should > > I > > look in for that if I want to get data from there to the scheduler? > > has_swap_token(current->mm) is the function you want. The basic idea > behind the token is that only one task at a time has the token, and that > the task with the token is "protected" from swapping, so that it can > make actual progress, and that it is made to pass this token on to some > other task after a fixed amount of time; this to prevent the situation > where no tasks make actual progress in a heavy swapping situation due to > the tasks stealing the memory from eachother all the time. By giving the > tasks one at a time a period of "immunity" at least one can make > progress. For your work it might be interested to investigate if giving > this special task more CPU time is an interesting thing to do. OK, this seems interesting. What if no task has the swap token, would that mean that either virtual memory is not being used at the time or that all the tasks have the pages they need already swapped in? Either way, the swap token thing is something I can look into. > > from the scheduler. My plan was that as the ram gets full (I chose 90% or > above > > to start with) then the page swapping must have started. > > in linux ram will always be "full" as seen by sysinfo because of the > disk cache. The kernel actually keeps swap related statistics (just run > "vmstat 1" in userspace and you see so/si blocks), that is the > information you most likely would be interested in. I'm not sure what you mean by this. Is "vmstat 1" a function I can call from sched.c? I assume so/si is swap in/swap out. I'm trying to find something about that in Linux Kernel Development but I can't see so/si blocks or anything like "vmstat 1" in the index. There's a bit about what userspace is at the beginning but perhaps these things would be under different headings. I'm still not sure how to find why I it crashes when I call sys_sysinfo from the scheduler. It seems to be reconising both the struct I give as an arguement and the function itself otherwise it wouldn't compile. It works fine when I comment that line out. Perhaps I'm supposed to do something else to set it up or maybeit can only be used from elsewhere. ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/