Re: [RFC] [PATCH] cache pollution aware __copy_from_user_ll()

Arjan van de Ven
2005-08-15T08:53:50Z

On Mon, 2005-08-15 at 17:44 +0900, Hiro Yoshioka wrote:
> Hi,
>
> I appreciate your suggestion.
>
> On 8/15/05, Arjan van de Ven <arjan@infradead.org> wrote:
> >
> > > Anyway we could not find the cache aware version of __copy_from_user_ll
> > > has a big regression yet.
> >
> >
> > that is because you spread the cache misses out from one place to all
> > over the place, so that no one single point sticks out anymore.
> >
> > Do you agree that your copy is less optimal for the case where the
> > kernel will (almost) immediately use the data?
>
> Yes, I do.
>
> My server has 8KB of L1 cache. (512KB of L2/2MB of L3)
>
> If you move more than 4KB of data using by __copy_from_user_ll(), the
> data will be spilled over L1 cache but in L2 (or L3)

L2 access time isn't too bad. your code evicts the data even from L2 and
L3 though (even if it was in there before)..

> When you move huge data (> 1MB), even L3 cache will not help you.
> (This is known as a cache pollution.)

yes.
> copy_from_user_nocache() is fine.
>
> But I don't know where I can use it. (I'm not so
> familiar with the linux kernel file system yet.)

I suspect the few cases where it will make the most difference will be
in the VFS for the write() system call, and the AIO variants thereof.

generic_file_buffered_write() will be a good candidate to try first...