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

From: Christoph Hellwig
Date: Fri Mar 23 2007 - 06:15:39 EST


On Thu, Mar 22, 2007 at 05:51:11PM -0700, Ken Chen wrote:
> 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. It is fairly pointless to perform that calculation repeatly
> on system with no highmem (i.e., 64-bit arch like x86-64). This patch
> caches kernel pipe buffer page's kernel vaddr to speed up pipe buffer
> mapping functions.
>
> There is another suboptimal block in pipe_read() where wake_up is
> called twice. I think it was an oversight since in pipe_write(), it
> looks like it is doing the right thing.

I think you're fixing the symptom here and not the cause. If calculating
the virtual address of a page is so expensive on your setup it should
define WANT_PAGE_VIRTUAL and we should always cache the virtual address
in struct page. There's a lot more code, epecially in filesystems that's
rather upset about a slow page_address.

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