From: Mike Werner <werner@sgi.com>
To: linux-kernel@vger.kernel.org
Cc: davej@redhat.com
Subject: [RFC/PATCH]Allow agp memory allocations to use node information
Date: Wed, 12 May 2004 11:47:39 -0700 [thread overview]
Message-ID: <40A2714B.2F27EA35@sgi.com> (raw)
diff -u linux-2.6.6.orig/drivers/char/agp/agp.h
linux-2.6.6/drivers/char/agp/agp.h
--- linux-2.6.6.orig/drivers/char/agp/agp.h Sun May 9 19:32:28 2004
+++ linux-2.6.6/drivers/char/agp/agp.h Wed May 12 11:43:19 2004
@@ -111,7 +111,7 @@
int (*remove_memory)(struct agp_memory *, off_t, int);
struct agp_memory *(*alloc_by_type) (size_t, int);
void (*free_by_type)(struct agp_memory *);
- void *(*agp_alloc_page)(void);
+ void *(*agp_alloc_page)(int);
void (*agp_destroy_page)(void *);
};
@@ -137,6 +137,7 @@
int max_memory_agp; /* in number of pages */
int aperture_size_idx;
int capndx;
+ int nodeid;
char major_version;
char minor_version;
};
@@ -261,7 +262,7 @@
int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start,
int type);
struct agp_memory *agp_generic_alloc_by_type(size_t page_count, int
type);
void agp_generic_free_by_type(struct agp_memory *curr);
-void *agp_generic_alloc_page(void);
+void *agp_generic_alloc_page(int);
void agp_generic_destroy_page(void *addr);
void agp_free_key(int key);
int agp_num_entries(void);
@@ -325,4 +326,5 @@
#define AGPCTRL_APERENB (1<<8)
#define AGPCTRL_GTLBEN (1<<7)
+#define AGPGART_DEFAULT_NODE (0)
#endif /* _AGP_BACKEND_PRIV_H */
diff -u linux-2.6.6.orig/drivers/char/agp/backend.c
linux-2.6.6/drivers/char/agp/backend.c
--- linux-2.6.6.orig/drivers/char/agp/backend.c Sun May 9 19:32:53 2004
+++ linux-2.6.6/drivers/char/agp/backend.c Wed May 12 11:43:48 2004
@@ -130,12 +130,13 @@
static int agp_backend_initialize(struct agp_bridge_data *bridge)
{
int size_value, rc, got_gatt=0, got_keylist=0;
+ int nid = bridge->nodeid;
bridge->max_memory_agp = agp_find_max();
bridge->version = &agp_current_version;
if (bridge->driver->needs_scratch_page) {
- void *addr = bridge->driver->agp_alloc_page();
+ void *addr = bridge->driver->agp_alloc_page(nid);
if (!addr) {
printk(KERN_ERR PFX "unable to get memory for
scratch page.\n");
diff -u linux-2.6.6.orig/drivers/char/agp/generic.c
linux-2.6.6/drivers/char/agp/generic.c
--- linux-2.6.6.orig/drivers/char/agp/generic.c Sun May 9 19:32:27 2004
+++ linux-2.6.6/drivers/char/agp/generic.c Wed May 12 11:44:03 2004
@@ -154,6 +154,7 @@
int scratch_pages;
struct agp_memory *new;
size_t i;
+ int nid = agp_bridge->nodeid;
if (agp_bridge->type == NOT_SUPPORTED)
return NULL;
@@ -174,7 +175,7 @@
return NULL;
for (i = 0; i < page_count; i++) {
- void *addr = agp_bridge->driver->agp_alloc_page();
+ void *addr = agp_bridge->driver->agp_alloc_page(nid);
if (addr == NULL) {
agp_free_memory(new);
@@ -877,11 +878,11 @@
* against a maximum value.
*/
-void *agp_generic_alloc_page(void)
+void *agp_generic_alloc_page(int nid)
{
struct page * page;
- page = alloc_page(GFP_KERNEL);
+ page = alloc_pages_node(nid, GFP_KERNEL, 0);
if (page == NULL)
return 0;
diff -u linux-2.6.6.orig/drivers/char/agp/i460-agp.c
linux-2.6.6/drivers/char/agp/i460-agp.c
--- linux-2.6.6.orig/drivers/char/agp/i460-agp.c Sun May 9
19:32:39 2004
+++ linux-2.6.6/drivers/char/agp/i460-agp.c Wed May 12 10:49:06 2004
@@ -508,12 +508,12 @@
* Let's just hope nobody counts on the allocated AGP memory being
there before bind time
* (I don't think current drivers do)...
*/
-static void *i460_alloc_page (void)
+static void *i460_alloc_page (int nid)
{
void *page;
if (I460_IO_PAGE_SHIFT <= PAGE_SHIFT)
- page = agp_generic_alloc_page();
+ page = agp_generic_alloc_page(nid);
else
/* Returning NULL would cause problems */
/* AK: really dubious code. */
diff -u linux-2.6.6.orig/drivers/char/agp/intel-agp.c
linux-2.6.6/drivers/char/agp/intel-agp.c
--- linux-2.6.6.orig/drivers/char/agp/intel-agp.c Sun May 9
19:32:36 2004
+++ linux-2.6.6/drivers/char/agp/intel-agp.c Wed May 12 10:47:19 2004
@@ -221,7 +221,7 @@
if (pg_count != 1)
return NULL;
- addr = agp_bridge->driver->agp_alloc_page();
+ addr = agp_bridge->driver->agp_alloc_page(AGPGART_DEFAULT_NODE);
if (addr == NULL)
return NULL;
diff -u linux-2.6.6.orig/drivers/char/agp/intel-mch-agp.c
linux-2.6.6/drivers/char/agp/intel-mch-agp.c
--- linux-2.6.6.orig/drivers/char/agp/intel-mch-agp.c Sun May 9
19:32:00 2004
+++ linux-2.6.6/drivers/char/agp/intel-mch-agp.c Wed May 12
11:16:02 2004
@@ -43,7 +43,7 @@
if (pg_count != 1)
return NULL;
- addr = agp_bridge->driver->agp_alloc_page();
+ addr = agp_bridge->driver->agp_alloc_page(AGPGART_DEFAULT_NODE);
if (addr == NULL)
return NULL;
next reply other threads:[~2004-05-12 20:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-12 18:47 Mike Werner [this message]
2004-05-12 20:26 ` [RFC/PATCH]Allow agp memory allocations to use node information Christoph Hellwig
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=40A2714B.2F27EA35@sgi.com \
--to=werner@sgi.com \
--cc=davej@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.