On Mon, 2011-11-14 at 20:36 -0600, Moffett, Kyle D wrote:
So when you are clearing a whole page, there are only 2 things you can do
wrong with "dcbz":
(1) Call "dcbz" with an address outside of the page you want to zero.
(2) Omit calls "dcbz" to dcbz for some physical cachelines in the page.
Now, that's a totally different story from the userspace memset() calls
that caused the problem originally, because they were frequently given
memory much smaller than a page to clear, and if you didn't know exactly
how many bytes a "dcbz" was going to clear you couldn't use it at all.
Right. That's why we pass the cache line sizes to userspace via the elf
AUX table so they don't do stupid things like that :-)
But the kernel doesn't do that anywhere, it just uses it for page clears.
Right, so we could easily precalc the count & increment and use a "soft"
loop.
Cheers,
Ben.