Re: Kernel profile

Gonzalo Tornaria (tornaria@cmat.edu.uy)
Wed, 31 Jul 96 21:23:13 EST


DUPRE Christophe <duprec@jsp.umontreal.ca> wrote:

> 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.

You can do with one list. Take zeroed structures from the head, and put used
non-zeroed structures at the end. You just need a pointer to the first
non-zeroed structure in the list, so the "scavenger" knows where to start
zeroing, and you can check whether you are out of zeroed structures. Or you can
add non-zeroed after the first non-zeroed (so you don't need a pointer to the
end).

Saludos,
Gonzalo

GM/CS/S d? a-- C++(+++) UL++(+++)>++++ P++>+++ L+++>++++ E---
W-(+) N+(++) w--- O M-(--) V-(--) PGP(--) b++(+++) G++ e>++++