From 88d51967f56f55a45849efe50858ea7dfa0d38dc Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Sun, 6 Nov 2005 23:35:34 -0800 Subject: [PATCH] AGP performance fixes AGP allocation/deallocation is suffering major performance issues due to the nature of global_flush_tlb() being called on every change_page_attr() call. For small allocations this isn't really seen, but when you start allocating 50000 pages of AGP space, for say, texture memory, then things can take seconds to complete. In some cases the situation is doubled or even quadrupled in the time due to SMP, or a deallocation, then a new reallocation. I've had a case of upto 20 seconds wait time to deallocate and reallocate AGP space. This patch fixes the problem by making it the caller's responsibility to call global_flush_tlb(), and so removes it from every instance of mapping a page into AGP space until the time that all change_page_attr() changes are done. Signed-off-by: Dave Jones Signed-off-by: Andrew Morton --- drivers/char/agp/generic.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'drivers/char/agp/generic.c') diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index c4a38715c6f9..19f242b50781 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c @@ -57,7 +57,8 @@ int map_page_into_agp(struct page *page) { int i; i = change_page_attr(page, 1, PAGE_KERNEL_NOCACHE); - global_flush_tlb(); + /* Caller's responsibility to call global_flush_tlb() for + * performance reasons */ return i; } EXPORT_SYMBOL_GPL(map_page_into_agp); @@ -66,7 +67,8 @@ int unmap_page_from_agp(struct page *page) { int i; i = change_page_attr(page, 1, PAGE_KERNEL); - global_flush_tlb(); + /* Caller's responsibility to call global_flush_tlb() for + * performance reasons */ return i; } EXPORT_SYMBOL_GPL(unmap_page_from_agp); @@ -153,6 +155,7 @@ void agp_free_memory(struct agp_memory *curr) for (i = 0; i < curr->page_count; i++) { curr->bridge->driver->agp_destroy_page(gart_to_virt(curr->memory[i])); } + global_flush_tlb(); } agp_free_key(curr->key); vfree(curr->memory); @@ -210,7 +213,9 @@ struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge, new->memory[i] = virt_to_gart(addr); new->page_count++; } - new->bridge = bridge; + global_flush_tlb(); + + new->bridge = bridge; flush_agp_mappings(); -- cgit v1.2.3