Skip to contentSkip to conversation

Add alloc_pages_exact_nid()

PATCH In review Andi Kleen 6 participants 10 messages May 6, 2011 – May 9, 2011

Subsystems (3)
lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/2 Add alloc_pages_exact_nid()

From: Andi Kleen <[email protected]>

Add a alloc_pages_exact_nid() that allocates on a specific node.

The naming is quite broken, but fixing that would need a larger renaming action.

---
 include/linux/gfp.h |    2 ++
 mm/page_alloc.c     |   48 ++++++++++++++++++++++++++++++++++++------------
 2 files changed, 38 insertions(+), 12 deletions(-)
include/linux/gfp.h +2 -0
index bfb8f93..56d8fc8 100644
@@ -353,6 +353,8 @@ extern unsigned long get_zeroed_page(gfp_t gfp_mask);
 
 void *alloc_pages_exact(size_t size, gfp_t gfp_mask);
 void free_pages_exact(void *virt, size_t size);
+/* This is different from alloc_pages_exact_node !!! */
+void *alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask);
 
 #define __get_free_page(gfp_mask) \
 		__get_free_pages((gfp_mask), 0)
mm/page_alloc.c +36 -12

64 lines not on this page · raw message

Signature · 8 lines
1.7.4.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#1 lore raw

PATCH 2/2 Allocate memory cgroup structures in local nodes v4

From: Andi Kleen <[email protected]>

dde79e005a769 added a regression that the memory cgroup data structures all end up in node 0 because the first attempt at allocating them would not pass in a node hint. Since the initialization runs on CPU #0 it would all end up node 0. This is a problem on large memory systems, where node 0 would lose a lot of memory.

Change the alloc_pages_exact to alloc_pages_exact_node. This will still fall back to other nodes if not enough memory is available.

[RED-PEN: right now it would fall back first before trying vmalloc_node. Probably not the best strategy ... But I left it like that for now.]

v4: Remove debugging code.
v3: Really call the correct function now. Thanks for everyone who commented.

Reported-by Doug Nelson
CC Michal Hocko <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Balbir Singh <[email protected]>
Cc Johannes Weiner <[email protected]>
---
 mm/page_cgroup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mm/page_cgroup.c +1 -1
index 9905501..2daadc3 100644
@@ -134,7 +134,7 @@ static void *__init_refok alloc_page_cgroup(size_t size, int nid)
 {
 	void *addr = NULL;
 
-	addr = alloc_pages_exact(size, GFP_KERNEL | __GFP_NOWARN);
+	addr = alloc_pages_exact_nid(nid, size, GFP_KERNEL | __GFP_NOWARN);
 	if (addr)
 		return addr;
 
Signature · 8 lines
1.7.4.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] Allocate memory cgroup structures in local nodes v4

Quoted 17 lines · Andi Kleen

From: Andi Kleen <[email protected]>

dde79e005a769 added a regression that the memory cgroup data structures all end up in node 0 because the first attempt at allocating them would not pass in a node hint. Since the initialization runs on CPU #0 it would all end up node 0. This is a problem on large memory systems, where node 0 would lose a lot of memory.

Change the alloc_pages_exact to alloc_pages_exact_node. This will still fall back to other nodes if not enough memory is available.

[RED-PEN: right now it would fall back first before trying vmalloc_node. Probably not the best strategy ... But I left it like that for now.]

v4: Remove debugging code.
v3: Really call the correct function now. Thanks for everyone who commented.

Quoted 7 lines
Reported-by Doug Nelson
CC Michal Hocko <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Balbir Singh <[email protected]>
Cc Johannes Weiner <[email protected]>

Looks good

Thanks

Quoted 20 lines
---
 mm/page_cgroup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mm/page_cgroup.c +1 -1
index 9905501..2daadc3 100644
@@ -134,7 +134,7 @@ static void *__init_refok alloc_page_cgroup(size_t size, int nid)
 {
 	void *addr = NULL;
 
-	addr = alloc_pages_exact(size, GFP_KERNEL | __GFP_NOWARN);
+	addr = alloc_pages_exact_nid(nid, size, GFP_KERNEL | __GFP_NOWARN);
 	if (addr)
 		return addr;
 
Signature · 1 line
1.7.4.4
Signature · 13 lines
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] Allocate memory cgroup structures in local nodes v4

In reply to Andi Kleen
Quoted 9 lines · Andi Kleen

From: Andi Kleen <[email protected]>

dde79e005a769 added a regression that the memory cgroup data structures all end up in node 0 because the first attempt at allocating them would not pass in a node hint. Since the initialization runs on CPU #0 it would all end up node 0. This is a problem on large memory systems, where node 0 would lose a lot of memory.

Change the alloc_pages_exact to alloc_pages_exact_node. This will

^ should be nid

Quoted 8 lines

still fall back to other nodes if not enough memory is available.

[RED-PEN: right now it would fall back first before trying vmalloc_node. Probably not the best strategy ... But I left it like that for now.]

v4: Remove debugging code.
v3: Really call the correct function now. Thanks for everyone who commented.

Quoted 7 lines
Reported-by Doug Nelson
CC Michal Hocko <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Balbir Singh <[email protected]>
Cc Johannes Weiner <[email protected]>
Signature · 9 lines
	Three Cheers,
	Balbir

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] Allocate memory cgroup structures in local nodes v4

In reply to Andi Kleen
Quoted 33 lines

From: Andi Kleen <[email protected]>

dde79e005a769 added a regression that the memory cgroup data structures all end up in node 0 because the first attempt at allocating them would not pass in a node hint. Since the initialization runs on CPU #0 it would all end up node 0. This is a problem on large memory systems, where node 0 would lose a lot of memory.

Change the alloc_pages_exact to alloc_pages_exact_node. This will still fall back to other nodes if not enough memory is available.

[RED-PEN: right now it would fall back first before trying vmalloc_node. Probably not the best strategy ... But I left it like that for now.]

v4: Remove debugging code.
v3: Really call the correct function now. Thanks for everyone who commented.

Reported-by Doug Nelson
CC Michal Hocko <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Balbir Singh <[email protected]>
Cc Johannes Weiner <[email protected]>
---
 mm/page_cgroup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mm/page_cgroup.c +0 -0
index 9905501..2daadc3 100644

mm/page_cgroup.c static void *__init_refok alloc_page_cgroup(size_t size, int nid) · line 139

Quoted 7 lines
mm/page_cgroup.c +1 -1
@@ -134,7 +134,7 @@ static void *__init_refok alloc_page_cgroup(size_t size, int nid)
 {
 	void *addr = NULL;
 
-	addr = alloc_pages_exact(size, GFP_KERNEL | __GFP_NOWARN);
+	addr = alloc_pages_exact_nid(nid, size, GFP_KERNEL | __GFP_NOWARN);
 	if (addr)
 		return addr;

I guess every developers dislike dis quirk name. but I have no idea another naming.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

reviewer Acked-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] Allocate memory cgroup structures in local nodes v4

In reply to Andi Kleen
Quoted 17 lines · Andi Kleen

From: Andi Kleen <[email protected]>

dde79e005a769 added a regression that the memory cgroup data structures all end up in node 0 because the first attempt at allocating them would not pass in a node hint. Since the initialization runs on CPU #0 it would all end up node 0. This is a problem on large memory systems, where node 0 would lose a lot of memory.

Change the alloc_pages_exact to alloc_pages_exact_node. This will still fall back to other nodes if not enough memory is available.

[RED-PEN: right now it would fall back first before trying vmalloc_node. Probably not the best strategy ... But I left it like that for now.]

v4: Remove debugging code.
v3: Really call the correct function now. Thanks for everyone who commented.

Quoted 7 lines
Reported-by Doug Nelson
CC Michal Hocko <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Balbir Singh <[email protected]>
Cc Johannes Weiner <[email protected]>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

reviewer Acked-by on v1 1/2
#6 lore raw
In reply to Andi Kleen
Quoted 8 lines · Andi Kleen

From: Andi Kleen <[email protected]>

Add a alloc_pages_exact_nid() that allocates on a specific node.

The naming is quite broken, but fixing that would need a larger renaming action.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

maintainer
#7 lore raw
In reply to Andi Kleen
Quoted 1 line · On Fri, 6 May 2011 14:17:16 -0700 Andi Kleen <[email protected]> wrote:

Add a alloc_pages_exact_nid() that allocates on a specific node.

This conflicts in, I suspect, a more-than-textual manner with Dave's
http://userweb.kernel.org/~akpm/mmotm/broken-out/mm-make-new-alloc_pages_exact.patch

Can you please take a look at that and work out what we should do?

As your [patch 2/2] fixes a regression, the answer might be "drop Dave's patch".

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#8 lore raw
Quoted 5 lines · Andrew Morton
Quoted 1 line · On Fri, 6 May 2011 14:17:16 -0700 Andi Kleen <[email protected]> wrote:

Add a alloc_pages_exact_nid() that allocates on a specific node.

Quoted 7 lines

This conflicts in, I suspect, a more-than-textual manner with Dave's
http://userweb.kernel.org/~akpm/mmotm/broken-out/mm-make-new-alloc_pages_exact.patch

Can you please take a look at that and work out what we should do?

As your [patch 2/2] fixes a regression, the answer might be "drop Dave's patch".

It should be relatively simple to rebase Dave's patch on top of mine.

I think that's the right order: first regression fix, then cleanup. Sorry Dave for the additional work.
(I agree the cleanup is very valuable in itself)

-Andi

Signature · 8 lines
[email protected] -- Speaking for myself only.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
maintainer
#9 lore raw
Quoted 11 lines · On Tue, 10 May 2011 01:04:46 +0200 Andi Kleen <[email protected]> wrote:
Quoted 10 lines · Andrew Morton
Quoted 1 line · On Fri, 6 May 2011 14:17:16 -0700 Andi Kleen <[email protected]> wrote:

Add a alloc_pages_exact_nid() that allocates on a specific node.

This conflicts in, I suspect, a more-than-textual manner with Dave's
http://userweb.kernel.org/~akpm/mmotm/broken-out/mm-make-new-alloc_pages_exact.patch

Can you please take a look at that and work out what we should do?

Quoted 9 lines
Quoted 2 lines

As your [patch 2/2] fixes a regression, the answer might be "drop Dave's patch".

It should be relatively simple to rebase Dave's patch on top of mine.

I think that's the right order: first regression fix, then cleanup. Sorry Dave for the additional work.
(I agree the cleanup is very valuable in itself)

I started repairing Dave's stuff but then things got complex. Probably we should rename your new alloc_pages_exact_nid() to get_free_pages_exact_nid().

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>