linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Lameter <clameter@sgi.com>
To: akpm@osdl.org
Cc: linux-mm@kvack.org
Date: Wed, 9 Aug 2006 19:38:10 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0608091934180.5464@schroedinger.engr.sgi.com> (raw)

I see some strange vmalloc_node constructs in the netfilter code. Looks as 
if they were trying to bypass memory policies with vmalloc_node().
That works but they have not considered that cpusets can also
influence the allocation. With GFP_THISNODE we can give them now
what they wanted: A node local allocation regardless of what settings
the currently executing process has.

However, vmalloc() currently does not pass a gfp flag. Define a macro
that uses __vmalloc() to pass GFP_THISNODE.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.18-rc3-mm2/net/ipv4/netfilter/arp_tables.c
===================================================================
--- linux-2.6.18-rc3-mm2.orig/net/ipv4/netfilter/arp_tables.c	2006-07-29 23:15:36.000000000 -0700
+++ linux-2.6.18-rc3-mm2/net/ipv4/netfilter/arp_tables.c	2006-08-09 19:26:37.776299432 -0700
@@ -723,7 +723,7 @@ static int copy_entries_to_user(unsigned
 	 * about).
 	 */
 	countersize = sizeof(struct xt_counters) * private->number;
-	counters = vmalloc_node(countersize, numa_node_id());
+	counters = vmalloc_flags(countersize, GFP_THISNODE);
 
 	if (counters == NULL)
 		return -ENOMEM;
Index: linux-2.6.18-rc3-mm2/net/ipv4/netfilter/ip_tables.c
===================================================================
--- linux-2.6.18-rc3-mm2.orig/net/ipv4/netfilter/ip_tables.c	2006-07-29 23:15:36.000000000 -0700
+++ linux-2.6.18-rc3-mm2/net/ipv4/netfilter/ip_tables.c	2006-08-09 19:26:18.463039994 -0700
@@ -809,8 +809,7 @@ static inline struct xt_counters * alloc
 	   (other than comefrom, which userspace doesn't care
 	   about). */
 	countersize = sizeof(struct xt_counters) * private->number;
-	counters = vmalloc_node(countersize, numa_node_id());
-
+	counters = vmalloc_flags(countersize, GFP_THISNODE);
 	if (counters == NULL)
 		return ERR_PTR(-ENOMEM);
 
@@ -1365,7 +1364,7 @@ do_add_counters(void __user *user, unsig
 	if (len != size + num_counters * sizeof(struct xt_counters))
 		return -EINVAL;
 
-	paddc = vmalloc_node(len - size, numa_node_id());
+	paddc = vmalloc_flags(len - size, GFP_THISNODE);
 	if (!paddc)
 		return -ENOMEM;
 
Index: linux-2.6.18-rc3-mm2/include/linux/vmalloc.h
===================================================================
--- linux-2.6.18-rc3-mm2.orig/include/linux/vmalloc.h	2006-08-07 20:21:00.586376498 -0700
+++ linux-2.6.18-rc3-mm2/include/linux/vmalloc.h	2006-08-09 19:25:24.544497518 -0700
@@ -52,7 +52,10 @@ extern void vunmap(void *addr);
 
 extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr,
 							unsigned long pgoff);
- 
+
+#define vmalloc_flags(__s, __f) \
+	__vmalloc((__s), (__f)|__GFP_HIGHMEM|GFP_KERNEL, PAGE_KERNEL)
+
 /*
  *	Lowlevel-APIs (not for driver use!)
  */

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

                 reply	other threads:[~2006-08-10  2:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=Pine.LNX.4.64.0608091934180.5464@schroedinger.engr.sgi.com \
    --to=clameter@sgi.com \
    --cc=akpm@osdl.org \
    --cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox