Messages in this thread |  | | Date | Tue, 30 Jul 1996 22:56:24 -0400 (EDT) | From | DUPRE Christophe <> | Subject | RE: Kernel profile |
| |
On Tue, 30 Jul 1996, Ray Van Tassle-CRV004 wrote:
> > I think that was the original intention, but the release function was > > never written (to much overhead in a function call?). If the list > > maintained a partial ordering (the reverse order of that mentioned above), > > then the number of iternations - where the active file structures are > > examined - could be reduced (as in tty_io.c - simply break out of the > > loop when the first inactive structure is found). > > > > > > Time to dream of an ideal (over kill) solution? > > The 'idle' process could zero the structures, and move them from the > > non-zeroed list to the zeroed one. > > > > Clearly, this would be fast in allocating a structure, and reduce the > > number if iterations where the active file structures are searched. > > > > Is this using a sledge hammer to crack a nut? > > Actually, you don't need two lists. The idle process ("scavenger") could > walk the list and move empty ones to the front. > > As I said earlier---you'd need to model (or capture) access patterns. > There's the danger of spending a dollar in order to save a dime.
Excuse for talking before checking the code, but I think two lists would be simpler and probably faster...
With one list, your "scavenger" need to walk the list, and when it finds a non-zeroed structure, it needs to zero it then move it to the front of the list. If you have two lists, scavenger only takes the first of the non-zeroed list, zero it then puts it at the front of the second list, no walking necessary.
Secondly, with only one list, you need a way to check if the structure has been zeroed or not - either add a flag to the structure, or re-use an already there flag... Either way, it's a flag that needs to be checked then cleared when a process needs to allocate a structure.
So the one-list solution might use a bit more memory (though not much), add a flag clear, and slow down the "scavenger" in it's job because it needs to walk the list.
My .02 $CDN
Christophe Dupre Universite de Montreal Internet: duprec@jsp.umontreal.ca Qc, Canada Montreal, Qc, Canada "Nous ne sommes pas libres de ne pas etre libres, nous sommes obliges de l'etre" - Fernando Savater
-- Geek Code 2.1 -- GCS d-- H+ s:++ g+ !p au-* a19 w+ v+ C++(+++) UIL++>+++ P+>++ L++ 3- E---- N++ K W- M- V-- Y+ t++ 5++ !j R+ G- tv b++ D+ e+ u** h->++ f+ r++ n---(----) y+
#include <disclaimer.h>
|  |