Re: Since no one else has stepped forward: 'ZeroD' patch

Greg Alexander (galexand@sietch.bloomington.in.us)
Wed, 8 Jan 1997 16:18:48 -0500 (EST)


On Tue, 7 Jan 1997, Ingo Molnar wrote:

> Here is a patch that implements 'ZeroD', a simple kernel thread that uses
> up CPU idle time to keep a pool of pre-zeroed pages around. Almost
> anything that doesnt burn 100% CPU time all the time should benefit from
> this.
>
> the patch is against a clean 2.1.20. Comments, ideas, flames welcome.

Interesting idea. I see only one problem -- it allocates some memory for
it's internal pool. Doesn't this mean that thingies that call
__get_free_page() might be disadvantaged, such as requests for DMA buffers
and whatnot. especially thingies that call __get_free_pages() that want a
number of contiguous pages -- this could "fragment" memory, couldn't it?

And here's one thing:

> +unsigned long get_precleared_page (void)
> +{
> + unsigned long flags;
> + unsigned long page=0;
> +
> + save_flags(flags);
> + cli();
> +
> + if (cleared_pages[first_page]) {
> + page=cleared_pages[first_page];
> + cleared_pages[first_page++]=0;
> + first_page &= ZEROD_POOLSIZE-1;
> +
> + wake_up (&zerod_wait);
> + }
> +
> + restore_flags(flags);
> + return page;
> +}

I may not really know what I'm talking about...but shouldn't you call
sti() after that if, or maybe even during the if, before the wake_up call?

Greg Alexander
http://www.cia-g.com/~sietch/