diff options
author | Alan Hourihane <alanh@fairlite.demon.co.uk> | 2005-11-07 02:35:34 -0500 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2005-11-08 16:43:54 -0500 |
commit | 88d51967f56f55a45849efe50858ea7dfa0d38dc (patch) | |
tree | 048db8e12c2b31ec2b88c3154da4c6a77b80028c /drivers/char/agp/generic.c | |
parent | 329f7dba5f7dc3bc9a30ad00cf373d2e83115aa1 (diff) |
[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 <davej@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Diffstat (limited to 'drivers/char/agp/generic.c')
-rw-r--r-- | drivers/char/agp/generic.c | 11 |
1 files changed, 8 insertions, 3 deletions
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) | |||
57 | { | 57 | { |
58 | int i; | 58 | int i; |
59 | i = change_page_attr(page, 1, PAGE_KERNEL_NOCACHE); | 59 | i = change_page_attr(page, 1, PAGE_KERNEL_NOCACHE); |
60 | global_flush_tlb(); | 60 | /* Caller's responsibility to call global_flush_tlb() for |
61 | * performance reasons */ | ||
61 | return i; | 62 | return i; |
62 | } | 63 | } |
63 | EXPORT_SYMBOL_GPL(map_page_into_agp); | 64 | EXPORT_SYMBOL_GPL(map_page_into_agp); |
@@ -66,7 +67,8 @@ int unmap_page_from_agp(struct page *page) | |||
66 | { | 67 | { |
67 | int i; | 68 | int i; |
68 | i = change_page_attr(page, 1, PAGE_KERNEL); | 69 | i = change_page_attr(page, 1, PAGE_KERNEL); |
69 | global_flush_tlb(); | 70 | /* Caller's responsibility to call global_flush_tlb() for |
71 | * performance reasons */ | ||
70 | return i; | 72 | return i; |
71 | } | 73 | } |
72 | EXPORT_SYMBOL_GPL(unmap_page_from_agp); | 74 | EXPORT_SYMBOL_GPL(unmap_page_from_agp); |
@@ -153,6 +155,7 @@ void agp_free_memory(struct agp_memory *curr) | |||
153 | for (i = 0; i < curr->page_count; i++) { | 155 | for (i = 0; i < curr->page_count; i++) { |
154 | curr->bridge->driver->agp_destroy_page(gart_to_virt(curr->memory[i])); | 156 | curr->bridge->driver->agp_destroy_page(gart_to_virt(curr->memory[i])); |
155 | } | 157 | } |
158 | global_flush_tlb(); | ||
156 | } | 159 | } |
157 | agp_free_key(curr->key); | 160 | agp_free_key(curr->key); |
158 | vfree(curr->memory); | 161 | vfree(curr->memory); |
@@ -210,7 +213,9 @@ struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge, | |||
210 | new->memory[i] = virt_to_gart(addr); | 213 | new->memory[i] = virt_to_gart(addr); |
211 | new->page_count++; | 214 | new->page_count++; |
212 | } | 215 | } |
213 | new->bridge = bridge; | 216 | global_flush_tlb(); |
217 | |||
218 | new->bridge = bridge; | ||
214 | 219 | ||
215 | flush_agp_mappings(); | 220 | flush_agp_mappings(); |
216 | 221 | ||