Quoting Rik van Riel <riel@xxxxxxxxxxx>: >On Wed, 27 Apr 2005, A.M. Fradley wrote: > >> Sorry, I didn't get back to you sooner. I had a busy week. Anyway I >> figured the best way to get anywhere with this project would just be to >> get the page faults per second or something and use that to measure the >> vm pressure. > >Think about a system with very large address space, where >somebody mmaps an enormous file and streams through it once. > >In that case a high page fault rate does not mean the system >is thrashing. It simply means the system is streaming through >the data fast. > >> I was thinking of doing something like this: >> >> timeSinceLastFault = currentTime - timeOfLastFault; >> faultsPerSec = 1 / timeSinceLastFault; >> av_fps = (av_fps + faultsPerSec) / 2; >> timeOfLastFault = currentTime; > >Looks like it would work, but make sure to only count major >faults and not minor faults... > >> That would go inside the page fault function. I'm going to look into >> doing it this way as part of the runqueue structure for now. I think I >> should start by moving the strusture definition into sched.h. I also >> need to check the math behind that algorithm. Am I on the right lines >> with the runqueue thing? > >Why move this into the runqueue? The runqueue contains processes >that are runnable, I don't understand how you want to hook into >that processes that are not runnable but waiting for page faults... > >-- >"Debugging is twice as hard as writing the code in the first place. >Therefore, if you write the code as cleverly as possible, you are, >by definition, not smart enough to debug it." - Brian W. Kernighan > >-- >Kernelnewbies: Help each other learn about the Linux kernel. >Archive: http://mail.nl.linux.org/kernelnewbies/ >FAQ: http://kernelnewbies.org/faq/ OK, what I've done so far is at the bottom of do_swap_page (one of the functions in handle_pte_fault) I've put if (ret == VM_FAULT_MAJOR) tLastSwap = jiffies / HZ; So I think that should give me the time of the last page swap or the last majflt involved with one (unless it's the same thing). Then I'll include a function like I suggested in my other email and have that called both after tLastSwap is set and in the scheduler. That way the swap rate will be updated when ever a swap takes place and if there's been no swapping for a while then the scheduler will find out because that's called regularly anyway. Then I could somehow get it to activate and deactivate the tokening according to the info of the swap rate that is gained at those points. Does that sound like it would work? I noticed in the do_swap_page there's an "if (!page) {... your token functions ...}. Perhaps I should put my code in that part rather than checking for a majflt at the end? The do_swap_page seems to be the only one in handle_pte_fault that does the swapping in the context of how much vm pressure there is but I'm still unsure. I should probably just go ahead and try some of these out but I want to make sure I'm not ignoring any page swaps out that I shouldn't be. I want to try to get as much information as possible that would be usefull to the community so I have no particular requirements for this personally other than to improve the performance of the kernel in regards to page swapping. The specification said I should modify the scheduler to do so but I'm starting to thing the scheduler may not be the place to do that from (at least not entirly) and that the memory, swap and thrash files are the areas where I should working from. ---------------------------------------------------------------- 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/