page_address is not fast in some systems, we should cache it. Signed-off-by: Lai Jiangshan Signed-off-by: Mathieu Desnoyers --- include/linux/ltt-relay.h | 4 ++-- ltt/ltt-relay-alloc.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) Index: linux-2.6-lttng/include/linux/ltt-relay.h =================================================================== --- linux-2.6-lttng.orig/include/linux/ltt-relay.h 2009-03-05 16:07:47.000000000 -0500 +++ linux-2.6-lttng/include/linux/ltt-relay.h 2009-03-05 16:07:47.000000000 -0500 @@ -34,6 +34,7 @@ struct rchan_buf; struct buf_page { struct page *page; + void *virt; /* page address of the struct page */ size_t offset; /* page offset in the buffer */ struct list_head list; /* buffer linked list */ }; @@ -286,8 +287,7 @@ static inline int ltt_relay_write(struct page = ltt_relay_cache_page(buf, &buf->wpage, page, offset); pagecpy = min_t(size_t, len, PAGE_SIZE - (offset & ~PAGE_MASK)); - ltt_relay_do_copy(page_address(page->page) - + (offset & ~PAGE_MASK), src, pagecpy); + ltt_relay_do_copy(page->virt + (offset & ~PAGE_MASK), src, pagecpy); if (unlikely(len != pagecpy)) _ltt_relay_write(buf, offset, src, len, page, pagecpy); Index: linux-2.6-lttng/ltt/ltt-relay-alloc.c =================================================================== --- linux-2.6-lttng.orig/ltt/ltt-relay-alloc.c 2009-03-05 16:07:47.000000000 -0500 +++ linux-2.6-lttng/ltt/ltt-relay-alloc.c 2009-03-05 16:07:47.000000000 -0500 @@ -54,6 +54,7 @@ static int relay_alloc_buf(struct rchan_ goto depopulate; } list_add_tail(&buf_page->list, &buf->pages); + buf_page->virt = page_address(buf_page->page); buf_page->offset = (size_t)i << PAGE_SHIFT; set_page_private(buf_page->page, (unsigned long)buf_page); if (i == 0) { @@ -529,8 +530,8 @@ void _ltt_relay_write(struct rchan_buf * page = ltt_relay_cache_page(buf, &buf->wpage, page, offset); pagecpy = min_t(size_t, len, PAGE_SIZE - (offset & ~PAGE_MASK)); - ltt_relay_do_copy(page_address(page->page) - + (offset & ~PAGE_MASK), src, pagecpy); + ltt_relay_do_copy(page->virt + + (offset & ~PAGE_MASK), src, pagecpy); } while (unlikely(len != pagecpy)); } EXPORT_SYMBOL_GPL(_ltt_relay_write); @@ -556,8 +557,7 @@ int ltt_relay_read(struct rchan_buf *buf for (;;) { page = ltt_relay_cache_page(buf, &buf->rpage, page, offset); pagecpy = min_t(size_t, len, PAGE_SIZE - (offset & ~PAGE_MASK)); - memcpy(dest, page_address(page->page) + (offset & ~PAGE_MASK), - pagecpy); + memcpy(dest, page->virt + (offset & ~PAGE_MASK), pagecpy); len -= pagecpy; if (likely(!len)) break; @@ -610,7 +610,7 @@ void *ltt_relay_offset_address(struct rc if (offset < page->offset || offset >= page->offset + PAGE_SIZE) buf->hpage[odd] = page = buf->wpage; page = ltt_relay_cache_page(buf, &buf->hpage[odd], page, offset); - return page_address(page->page) + (offset & ~PAGE_MASK); + return page->virt + (offset & ~PAGE_MASK); } EXPORT_SYMBOL_GPL(ltt_relay_offset_address); -- Mathieu Desnoyers OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/