Re: [PATCH v2 6/8] kvm tools: Add rwlock wrapper

Ingo Molnar
2011-05-30T14:43:13Z

* Avi Kivity <avi@redhat.com> wrote:

> On 05/30/2011 05:10 PM, Ingo Molnar wrote:
> >> [...] Windows has a zeroing thread which causes all of RAM to be
> >> committed shortly after boot, though.
> >
> > heh, maybe they read lkml and copied my ancient idea:
> >
> > http://people.redhat.com/mingo/clearpage-patches/clearpage-2.3.18-J1
> >
> > An earlier version had a 'zerod' (page zeroing kernel thread).
> >
> > This was one of my more stupid ideas btw.
> >
>
> I think that with a dma engine it makes sense. We've got an extra
> resource, why not utilize it in the background? Some workloads
> generate a lot of demand for zero pages.

It was one of the early ideas to use DMA engines to clear memory
slowly in the background.

> I agree that using the cpu to clear memory is not a good idea, it
> just causes cache pollution.

Yeah, but even cache-neutral clearing (either driven from the CPU
from the idle thread or by a DMA engine) is not a particularly good
idea: because it uses up a finite resource: memory bandwidth. Can we
create 'idle' DMA transactions - once that never get in the way of
real DMA transactions?

Also, a profile of a typical kernel build shows:

0.69% cc1 [kernel.kallsyms] [k] clear_page_c
0.49% cc1 [kernel.kallsyms] [k] page_fault

So while we could improve it, the question is, can we do this without
accidentally slowing things down by more than 0.69%? And kernel
builds are a pretty clear_page_c() intense workload.

Thanks,

Ingo