Re: PG_zero

Martin J. Bligh
2004-11-03T01:24:40Z

--On Wednesday, November 03, 2004 02:09:52 +0100 Andrea Arcangeli <andrea@novell.com> wrote:

> On Tue, Nov 02, 2004 at 02:41:15PM -0800, Martin J. Bligh wrote:
>> eh? I don't see how that matters at all. After the DMA transfer, all the
>> cache lines will have to be invalidated in every CPUs cache anyway, so
>> it's guaranteed to be stone-dead zero-degrees-kelvin cold. I don't see how
>> however hot it becomes afterwards is relevant?
>
> if the cold page becomes hot, it means the hot pages in the hot
> quicklist will become colder. The cache size is limited, so if something
> becomes hot, something will become cold.

Aaah. OK - I see what you mean. Not sure I agree, but at least I understand
now ;-) will think on that some more, but I'm still not sure it makes any
difference.

> The only difference is that the hot pages will become cold during the
> dma if we return an hot page, or the hot pages will become cold while
> the cpu touches the data of the previously cold page, if we return a
> cold page. Or are you worried that the cache snooping is measurable?

Not really, I just don't want to waste hot pages on DMA that we could
be using for something else.

...

> NOTE: I'm not talking about the freeing of cold pages. the freeing of
> cold pages definitely must not free at the head, this way hot
> allocations will keep going fast. But reserving hot pages during cold
> allocations I doubt it's measurable. I wonder if you've any measurement
> that collides with my theory. I could be wrong of course.

Mmmm. probably depends on cache size vs readahead windows, etc. I'm don't
think either of us has any numbers, so we're both postulating ;-)

> I can change my patch to reserve hot pages during cold allocations, no
> problem, but I'd really like to have any measurement data before doing
> that, since I feel I'd be wasting some tons of memory on a many-cpu
> lots-of-ram box for a worthless cause.

Why is it tons of memory? Shouldn't be more that cache-size * nr_cpus,
and as long as we fetch from the cold to the hot, it's not really wasted
at all, it's just sitting in the cache. I guess we don't steal from other
cpu's caches (maybe we ought to when we're under very heavy pressure),
but still ... I think it's a marginal amount of memory, not "tons" ;-)

M.