Re: PATCH 2.3.26: kmalloc GFP_ZEROt

Gerard Roudier (groudier@club-internet.fr)
Wed, 10 Nov 1999 23:55:32 +0100 (MET)


On Wed, 10 Nov 1999, Andrea Arcangeli wrote:

> On Wed, 10 Nov 1999, Gerard Roudier wrote:
>
> >zeroed with the cache invalidating or snooping the accesses. May-be having
> >some pool of zeroed memory or zeroing some memory is useful for security
> >issue, but speaking of pooled or cached objects, we probably want to most
>
> Yes, the _only_ point of the clear_page in the page fault path is
> security.

Indeed.

> >only zero parts that need to be so. The bzero-mania does not look fine
> >programming to me.
>
> Agreed. OTOH using a different chip for the bzero may really improve
> performances and scale better.

But this add complexity for optimization of the epsilon, in my opinion.
There is some other way to trash L1 cache as walking a too long list. Each
indirection can trash at least one cache line and sometimes far more due
to accessing data outside this first cache line in order to make decision.

> The bzero-mania with a minimal slowdown under heavy load still doesn't
> convince me instead...

Zeroing a datum that will likely stay so is overhead, but when this zeroed
datum will be filled by real information later, then the zeroing is close
to zero-cost compared to the computation of this information and the
change of the previous zero value.
Unless you want to perform everything from kernel-land, being a bit smart
or just not stupid regarding useless zeroing of data should make such a
load negligible compared to the actual load of the system and user
applications, in my opinion.

Fine design is far better at avoiding overhead that brute-force
optimisation in my opinion.

> >PS: If we want to be able to write zero-filled blocks to a disk without
> >bzero overhead, for example, we can reserve a small amount of physical
> >pages filled with zeros at startup.
>
> Currently there's at least one page reserved that must stay zeroed all the
> time. It's the ZERO_PAGE(). mapping /dev/null always fallback on the
> ZERO_PAGE. you can read it as many times and whenever you want.

Who want to ever read data he already knows about the actual value ? ;-)

Gérard.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/