From: Shaohua Li <shaohua.li@intel.com>
To: lkml <linux-kernel@vger.kernel.org>
Cc: airlied@linux.ie, Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@redhat.com>,
Arjan van de Ven <arjan@infradead.org>
Subject: [patch 2/2] reduce tlb/cache flush times of agpgart memory allocation
Date: Mon, 04 Aug 2008 14:51:30 +0800 [thread overview]
Message-ID: <1217832690.21811.9.camel@sli10-desk.sh.intel.com> (raw)
To reduce tlb/cache flush, makes agp memory allocation do one flush
after all pages in a region are changed to uc.
All agp drivers except agp-sgi uses agp_generic_alloc_page()
for .agp_alloc_page, so the patch should work for them. agp-sgi is only
for ia64, so not a problem too.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
---
drivers/char/agp/agp.h | 4 ++++
drivers/char/agp/generic.c | 4 +++-
include/asm-x86/agp.h | 3 +++
3 files changed, 10 insertions(+), 1 deletion(-)
Index: linux/drivers/char/agp/generic.c
===================================================================
--- linux.orig/drivers/char/agp/generic.c 2008-08-04 12:03:37.000000000 +0800
+++ linux/drivers/char/agp/generic.c 2008-08-04 12:06:31.000000000 +0800
@@ -274,6 +274,7 @@ struct agp_memory *agp_allocate_memory(s
new->memory[i] = virt_to_gart(addr);
new->page_count++;
}
+ map_page_into_agp_global_flush();
new->bridge = bridge;
return new;
@@ -1186,7 +1187,8 @@ void *agp_generic_alloc_page(struct agp_
if (page == NULL)
return NULL;
- map_page_into_agp(page);
+ /* agp_allocate_memory will do flush */
+ map_page_into_agp_noflush(page);
get_page(page);
atomic_inc(&agp_bridge->current_memory_agp);
Index: linux/include/asm-x86/agp.h
===================================================================
--- linux.orig/include/asm-x86/agp.h 2008-08-04 12:03:37.000000000 +0800
+++ linux/include/asm-x86/agp.h 2008-08-04 12:06:31.000000000 +0800
@@ -15,6 +15,9 @@
#define map_page_into_agp(page) set_pages_uc(page, 1)
#define unmap_page_from_agp(page) set_pages_wb(page, 1)
+#define map_page_into_agp_noflush(page) set_pages_uc_noflush(page, 1)
+#define map_page_into_agp_global_flush() set_memory_flush_all()
+
/*
* Could use CLFLUSH here if the cpu supports it. But then it would
* need to be called for each cacheline of the whole page so it may
Index: linux/drivers/char/agp/agp.h
===================================================================
--- linux.orig/drivers/char/agp/agp.h 2008-08-04 12:03:37.000000000 +0800
+++ linux/drivers/char/agp/agp.h 2008-08-04 12:06:31.000000000 +0800
@@ -30,6 +30,10 @@
#define _AGP_BACKEND_PRIV_H 1
#include <asm/agp.h> /* for flush_agp_cache() */
+#ifndef map_page_into_agp_noflush
+#define map_page_into_agp_noflush(page) map_page_into_agp(page)
+#define map_page_into_agp_global_flush()
+#endif
#define PFX "agpgart: "
next reply other threads:[~2008-08-04 6:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-04 6:51 Shaohua Li [this message]
2008-08-15 14:31 ` Ingo Molnar
2008-08-15 14:40 ` Arjan van de Ven
2008-08-15 14:43 ` Ingo Molnar
2008-08-18 1:21 ` Li, Shaohua
2008-08-18 3:56 ` Arjan van de Ven
2008-08-18 6:19 ` Li, Shaohua
2008-08-18 8:03 ` Ingo Molnar
2008-08-18 17:18 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1217832690.21811.9.camel@sli10-desk.sh.intel.com \
--to=shaohua.li@intel.com \
--cc=airlied@linux.ie \
--cc=akpm@linux-foundation.org \
--cc=arjan@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®