Re: [patch] cache pipe buf page address for non-highmem arch

Andi Kleen
2007-03-27T14:02:14Z

"Ken Chen" <kenchen@google.com> writes:

> It is really sad that we always call kmap and friends for every pipe
> buffer page on 64-bit arch that doesn't use HIGHMEM, or on
> configuration that doesn't turn on HIGHMEM.
>
> The effect of calling kmap* is visible in the execution profile when
> pipe code is being stressed. It is especially true on amd's x86-64
> platform where kmap() has to traverse through numa node index
> calculation in order to convert struct page * to kernel virtual
> address.

What is the problem? You have cache misses on the the hash table
or are the instructions really an issue on a modern CPU?

e.g. i out of lined virt_to_page to save space, but it could be probably
inlined again if it was severly time critical.

> +
> +#ifdef CONFIG_HIGHMEM
> +#define pipe_kmap kmap
> +#define pipe_kmap_atomic kmap_atomic

I think it would be better to have a somewhat generic kmap_caching()
or similar interface that could be used by more subsystems.

-Andi