Skip to contentSkip to conversation

memcg: mark init_section_page_cgroup() properly

PATCH Superseded Namhyung Kim 6 participants 31 messages Mar 18, 2011 – Apr 1, 2011 9 messages not in the archive Memory management

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 memcg: mark init_section_page_cgroup() properly

The commit ca371c0d7e23 ("memcg: fix page_cgroup fatal error in FLATMEM") removes call to alloc_bootmem() in the function so that it can be marked as __meminit to reduce memory usage when MEMORY_HOTPLUG=n.

Cc KAMEZAWA Hiroyuki <[email protected]>
---
 mm/page_cgroup.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
mm/page_cgroup.c +1 -2
index 5bffada7cde1..2d1a0fa01d7b 100644
@@ -105,8 +105,7 @@ struct page_cgroup *lookup_page_cgroup(struct page *page)
 	return section->page_cgroup + pfn;
 }
 
-/* __alloc_bootmem...() is protected by !slab_available() */
-static int __init_refok init_section_page_cgroup(unsigned long pfn)
+static int __meminit init_section_page_cgroup(unsigned long pfn)
 {
 	struct mem_section *section = __pfn_to_section(pfn);
 	struct page_cgroup *base, *pc;
Signature · 8 lines
1.7.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>

A message that is not in the archive (sent off-list or not yet received): 1300452855-10194-1-git-send-email-namhyung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH 2/3 memcg: fix off-by-one when calculating swap cgroup map length

It allocated one more page than necessary if @max_pages was a multiple of SC_PER_PAGE.

Cc KAMEZAWA Hiroyuki <[email protected]>
---
 mm/page_cgroup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mm/page_cgroup.c +1 -1
index 2d1a0fa01d7b..29951abc852e 100644
@@ -446,7 +446,7 @@ int swap_cgroup_swapon(int type, unsigned long max_pages)
 	if (!do_swap_account)
 		return 0;
 
-	length = ((max_pages/SC_PER_PAGE) + 1);
+	length = DIV_ROUND_UP(max_pages, SC_PER_PAGE);
 	array_size = length * sizeof(void *);
 
 	array = vmalloc(array_size);
Signature · 1 line
1.7.4
#3 lore raw

PATCH 3/3 memcg: move page-freeing code outside of lock

In reply to a message not in the archive
Cc KAMEZAWA Hiroyuki <[email protected]>
---
 mm/page_cgroup.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
mm/page_cgroup.c +13 -9
index 29951abc852e..17eb5eb95bab 100644
@@ -463,8 +463,8 @@ int swap_cgroup_swapon(int type, unsigned long max_pages)
 		/* memory shortage */
 		ctrl->map = NULL;
 		ctrl->length = 0;
-		vfree(array);
 		mutex_unlock(&swap_cgroup_mutex);
+		vfree(array);
 		goto nomem;
 	}
 	mutex_unlock(&swap_cgroup_mutex);
@@ -479,7 +479,8 @@ nomem:
 
 void swap_cgroup_swapoff(int type)
 {
-	int i;
+	struct page **map;
+	unsigned long i, length;
 	struct swap_cgroup_ctrl *ctrl;
 
 	if (!do_swap_account)
@@ -487,17 +488,20 @@ void swap_cgroup_swapoff(int type)
 
 	mutex_lock(&swap_cgroup_mutex);
 	ctrl = &swap_cgroup_ctrl[type];
-	if (ctrl->map) {
-		for (i = 0; i < ctrl->length; i++) {
-			struct page *page = ctrl->map[i];
+	map = ctrl->map;
+	length = ctrl->length;
+	ctrl->map = NULL;
+	ctrl->length = 0;
+	mutex_unlock(&swap_cgroup_mutex);
+
+	if (map) {
+		for (i = 0; i < length; i++) {
+			struct page *page = map[i];
 			if (page)
 				__free_page(page);
 		}
-		vfree(ctrl->map);
-		ctrl->map = NULL;
-		ctrl->length = 0;
+		vfree(map);
 	}
-	mutex_unlock(&swap_cgroup_mutex);
 }
 
 #endif
Signature · 1 line
1.7.4
#4 lore raw
In reply to a message not in the archive
Quoted 7 lines · On Fri, 18 Mar 2011 21:54:13 +0900 Namhyung Kim…

The commit ca371c0d7e23 ("memcg: fix page_cgroup fatal error in FLATMEM") removes call to alloc_bootmem() in the function so that it can be marked as __meminit to reduce memory usage when MEMORY_HOTPLUG=n.

Cc KAMEZAWA Hiroyuki <[email protected]>
Quoted 22 lines
---
 mm/page_cgroup.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
mm/page_cgroup.c +1 -2
index 5bffada7cde1..2d1a0fa01d7b 100644
@@ -105,8 +105,7 @@ struct page_cgroup *lookup_page_cgroup(struct page *page)
 	return section->page_cgroup + pfn;
 }
 
-/* __alloc_bootmem...() is protected by !slab_available() */
-static int __init_refok init_section_page_cgroup(unsigned long pfn)
+static int __meminit init_section_page_cgroup(unsigned long pfn)
 {
 	struct mem_section *section = __pfn_to_section(pfn);
 	struct page_cgroup *base, *pc;
Signature · 1 line
1.7.4
#5 lore raw
In reply to a message not in the archive

2011-03-18 (금), 21:54 +0900, Namhyung Kim:

Quoted 16 lines

The commit ca371c0d7e23 ("memcg: fix page_cgroup fatal error in FLATMEM") removes call to alloc_bootmem() in the function so that it can be marked as __meminit to reduce memory usage when MEMORY_HOTPLUG=n.

Cc KAMEZAWA Hiroyuki <[email protected]>
---
 mm/page_cgroup.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
mm/page_cgroup.c +0 -0
index 5bffada7cde1..2d1a0fa01d7b 100644

mm/page_cgroup.c struct page_cgroup *lookup_page_cgroup(struct page *page) · line 111

Quoted 9 lines
mm/page_cgroup.c +1 -2
@@ -105,8 +105,7 @@ struct page_cgroup *lookup_page_cgroup(struct page *page)
 	return section->page_cgroup + pfn;
 }
 
-/* __alloc_bootmem...() is protected by !slab_available() */
-static int __init_refok init_section_page_cgroup(unsigned long pfn)
+static int __meminit init_section_page_cgroup(unsigned long pfn)
 {
 	struct mem_section *section = __pfn_to_section(pfn);
 	struct page_cgroup *base, *pc;

Andrew, could you please have a look these patches too and consider applying them in your tree? I can resend them (with given Acked-by lines) if you want.

Thanks.

Signature · 8 lines
Regards,
Namhyung Kim


_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers
#6 lore raw

PATCH 2/3 memcg: fix off-by-one when calculating swap cgroup map length

In reply to Namhyung Kim

It allocated one more page than necessary if @max_pages was a multiple of SC_PER_PAGE.

Cc KAMEZAWA Hiroyuki <[email protected]>
---
 mm/page_cgroup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mm/page_cgroup.c +1 -1
index 2d1a0fa01d7b..29951abc852e 100644
@@ -446,7 +446,7 @@ int swap_cgroup_swapon(int type, unsigned long max_pages)
 	if (!do_swap_account)
 		return 0;
 
-	length = ((max_pages/SC_PER_PAGE) + 1);
+	length = DIV_ROUND_UP(max_pages, SC_PER_PAGE);
 	array_size = length * sizeof(void *);
 
 	array = vmalloc(array_size);
Signature · 8 lines
1.7.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>

A message that is not in the archive (sent off-list or not yet received): 1300452855-10194-2-git-send-email-namhyung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

Acked-by on v1 2/3
#9 lore raw

Re: [PATCH 2/3] memcg: fix off-by-one when calculating swap cgroup map length

In reply to Namhyung Kim
Quoted 5 lines · On Fri, 18 Mar 2011 21:54:14 +0900 Namhyung Kim <[email protected]> wrote:

It allocated one more page than necessary if @max_pages was a multiple of SC_PER_PAGE.

Cc KAMEZAWA Hiroyuki <[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>

A message that is not in the archive (sent off-list or not yet received): 20110322085844.31041d40.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org

Acked-by
#11 lore raw

Re: [PATCH 2/3] memcg: fix off-by-one when calculating swap cgroup map length

Quoted 10 lines · KAMEZAWA Hiroyuki
Quoted 5 lines · On Fri, 18 Mar 2011 21:54:14 +0900 Namhyung Kim…

It allocated one more page than necessary if @max_pages was a multiple of SC_PER_PAGE.

Cc KAMEZAWA Hiroyuki <[email protected]>
Acked-by
#12 lore raw

Re: [PATCH 2/3] memcg: fix off-by-one when calculating swap cgroup map length

In reply to KAMEZAWA Hiroyuki
Quoted 10 lines · KAMEZAWA Hiroyuki
Quoted 5 lines · On Fri, 18 Mar 2011 21:54:14 +0900 Namhyung Kim <[email protected]> wrote:

It allocated one more page than necessary if @max_pages was a multiple of SC_PER_PAGE.

Cc KAMEZAWA Hiroyuki <[email protected]>
#13 lore raw

PATCH 3/3 memcg: move page-freeing code outside of lock

In reply to Namhyung Kim
Cc KAMEZAWA Hiroyuki <[email protected]>
---
 mm/page_cgroup.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
mm/page_cgroup.c +13 -9
index 29951abc852e..17eb5eb95bab 100644
@@ -463,8 +463,8 @@ int swap_cgroup_swapon(int type, unsigned long max_pages)
 		/* memory shortage */
 		ctrl->map = NULL;
 		ctrl->length = 0;
-		vfree(array);
 		mutex_unlock(&swap_cgroup_mutex);
+		vfree(array);
 		goto nomem;
 	}
 	mutex_unlock(&swap_cgroup_mutex);
@@ -479,7 +479,8 @@ nomem:
 
 void swap_cgroup_swapoff(int type)
 {
-	int i;
+	struct page **map;
+	unsigned long i, length;
 	struct swap_cgroup_ctrl *ctrl;
 
 	if (!do_swap_account)
@@ -487,17 +488,20 @@ void swap_cgroup_swapoff(int type)
 
 	mutex_lock(&swap_cgroup_mutex);
 	ctrl = &swap_cgroup_ctrl[type];
-	if (ctrl->map) {
-		for (i = 0; i < ctrl->length; i++) {
-			struct page *page = ctrl->map[i];
+	map = ctrl->map;
+	length = ctrl->length;
+	ctrl->map = NULL;
+	ctrl->length = 0;
+	mutex_unlock(&swap_cgroup_mutex);
+
+	if (map) {
+		for (i = 0; i < length; i++) {
+			struct page *page = map[i];
 			if (page)
 				__free_page(page);
 		}
-		vfree(ctrl->map);
-		ctrl->map = NULL;
-		ctrl->length = 0;
+		vfree(map);
 	}
-	mutex_unlock(&swap_cgroup_mutex);
 }
 
 #endif
Signature · 8 lines
1.7.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>

A message that is not in the archive (sent off-list or not yet received): 1300452855-10194-3-git-send-email-namhyung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#16 lore raw

Re: [PATCH 3/3] memcg: move page-freeing code outside of lock

In reply to Namhyung Kim
Quoted 2 lines · On Fri, 18 Mar 2011 21:54:15 +0900 Namhyung Kim <[email protected]> wrote:
Cc KAMEZAWA Hiroyuki <[email protected]>

What is the benefit of this patch ?

-Kame

--
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>

A message that is not in the archive (sent off-list or not yet received): 20110322085938.0691f7f4.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org

#18 lore raw

Re: [PATCH 3/3] memcg: move page-freeing code outside of lock

2011-03-22 (화), 08:59 +0900, KAMEZAWA Hiroyuki:

Quoted 10 lines
Quoted 2 lines · On Fri, 18 Mar 2011 21:54:15 +0900 Namhyung Kim <[email protected]> wrote:
Cc KAMEZAWA Hiroyuki <[email protected]>

What is the benefit of this patch ?

-Kame

Oh, I just thought generally it'd better call such a (potentially) costly function outside of locks and it could reduce few of theoretical contentions between swapons and/or offs. If it doesn't help any realistic cases I don't mind discarding it.

Thanks.

Signature · 8 lines
Regards,
Namhyung Kim


_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers
#19 lore raw

Re: [PATCH 3/3] memcg: move page-freeing code outside of lock

In reply to KAMEZAWA Hiroyuki

2011-03-22 (i??), 08:59 +0900, KAMEZAWA Hiroyuki:

Quoted 10 lines
Quoted 2 lines · On Fri, 18 Mar 2011 21:54:15 +0900 Namhyung Kim <[email protected]> wrote:
Cc KAMEZAWA Hiroyuki <[email protected]>

What is the benefit of this patch ?

-Kame

Oh, I just thought generally it'd better call such a (potentially) costly function outside of locks and it could reduce few of theoretical contentions between swapons and/or offs. If it doesn't help any realistic cases I don't mind discarding it.

Thanks.

Signature · 10 lines
Regards,
Namhyung Kim


--
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>
#20 lore raw

Re: [PATCH 3/3] memcg: move page-freeing code outside of lock

Quoted 10 lines · Namhyung Kim

2011-03-22 (화), 08:59 +0900, KAMEZAWA Hiroyuki:

Quoted 8 lines
Quoted 2 lines · On Fri, 18 Mar 2011 21:54:15 +0900 Namhyung Kim <[email protected]> wrote:
Cc KAMEZAWA Hiroyuki <[email protected]>

What is the benefit of this patch ?

Quoted 7 lines
Quoted 2 lines

-Kame

Oh, I just thought generally it'd better call such a (potentially) costly function outside of locks and it could reduce few of theoretical contentions between swapons and/or offs. If it doesn't help any realistic cases I don't mind discarding it.

swapoff is a rare path, I would not worry about it too much at all.

Balbir
_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers

#21 lore raw

Re: [PATCH 3/3] memcg: move page-freeing code outside of lock

In reply to Namhyung Kim
Quoted 10 lines · Namhyung Kim

2011-03-22 (화), 08:59 +0900, KAMEZAWA Hiroyuki:

Quoted 8 lines
Quoted 2 lines · On Fri, 18 Mar 2011 21:54:15 +0900 Namhyung Kim <[email protected]> wrote:
Cc KAMEZAWA Hiroyuki <[email protected]>

What is the benefit of this patch ?

Quoted 7 lines
Quoted 2 lines

-Kame

Oh, I just thought generally it'd better call such a (potentially) costly function outside of locks and it could reduce few of theoretical contentions between swapons and/or offs. If it doesn't help any realistic cases I don't mind discarding it.

swapoff is a rare path, I would not worry about it too much at all.

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>

#22 lore raw

Re: [PATCH 3/3] memcg: move page-freeing code outside of lock

In reply to Namhyung Kim
Quoted 9 lines · On Tue, 22 Mar 2011 12:04:39 +0900 Namhyung Kim <[email protected]> wrote:

2011-03-22 (화), 08:59 +0900, KAMEZAWA Hiroyuki:

Quoted 8 lines
Quoted 2 lines · On Fri, 18 Mar 2011 21:54:15 +0900 Namhyung Kim <[email protected]> wrote:
Cc KAMEZAWA Hiroyuki <[email protected]>

What is the benefit of this patch ?

Quoted 8 lines
Quoted 2 lines

-Kame

Oh, I just thought generally it'd better call such a (potentially) costly function outside of locks and it could reduce few of theoretical contentions between swapons and/or offs. If it doesn't help any realistic cases I don't mind discarding it.

My point is, please write patch description which shows for what this patc is. All cleanup are okay to me if it reasonable. But without patch description as "this is just a cleanup, no functional change, and the reason is...." we cannot maintain patches.

Thanks,
-Kame

_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers

#23 lore raw

Re: [PATCH 3/3] memcg: move page-freeing code outside of lock

In reply to Namhyung Kim
Quoted 9 lines · On Tue, 22 Mar 2011 12:04:39 +0900 Namhyung Kim <[email protected]> wrote:

2011-03-22 (i??), 08:59 +0900, KAMEZAWA Hiroyuki:

Quoted 8 lines
Quoted 2 lines · On Fri, 18 Mar 2011 21:54:15 +0900 Namhyung Kim <[email protected]> wrote:
Cc KAMEZAWA Hiroyuki <[email protected]>

What is the benefit of this patch ?

Quoted 8 lines
Quoted 2 lines

-Kame

Oh, I just thought generally it'd better call such a (potentially) costly function outside of locks and it could reduce few of theoretical contentions between swapons and/or offs. If it doesn't help any realistic cases I don't mind discarding it.

My point is, please write patch description which shows for what this patc is. All cleanup are okay to me if it reasonable. But without patch description as "this is just a cleanup, no functional change, and the reason is...." we cannot maintain patches.

Thanks,
-Kame

--
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>

A message that is not in the archive (sent off-list or not yet received): 20110322135619.90593f5d.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org

#25 lore raw

Re: [PATCH 3/3] memcg: move page-freeing code outside of lock

2011-03-22 (화), 13:56 +0900, KAMEZAWA Hiroyuki:

Quoted 21 lines
Quoted 9 lines · On Tue, 22 Mar 2011 12:04:39 +0900 Namhyung Kim <[email protected]> wrote:

2011-03-22 (화), 08:59 +0900, KAMEZAWA Hiroyuki:

Quoted 8 lines
Quoted 2 lines · On Fri, 18 Mar 2011 21:54:15 +0900 Namhyung Kim <[email protected]> wrote:
Cc KAMEZAWA Hiroyuki <[email protected]>

What is the benefit of this patch ?

Quoted 8 lines
Quoted 2 lines

-Kame

Oh, I just thought generally it'd better call such a (potentially) costly function outside of locks and it could reduce few of theoretical contentions between swapons and/or offs. If it doesn't help any realistic cases I don't mind discarding it.

Quoted 8 lines

My point is, please write patch description which shows for what this patc is. All cleanup are okay to me if it reasonable. But without patch description as "this is just a cleanup, no functional change, and the reason is...." we cannot maintain patches.

Thanks,
-Kame

OK, I will do that in the future. Anyway, do you want me to resend the patch with new description?

Thanks.

Signature · 8 lines
Regards,
Namhyung Kim


_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers
#26 lore raw

Re: [PATCH 3/3] memcg: move page-freeing code outside of lock

In reply to KAMEZAWA Hiroyuki

2011-03-22 (i??), 13:56 +0900, KAMEZAWA Hiroyuki:

Quoted 21 lines
Quoted 9 lines · On Tue, 22 Mar 2011 12:04:39 +0900 Namhyung Kim <[email protected]> wrote:

2011-03-22 (i??), 08:59 +0900, KAMEZAWA Hiroyuki:

Quoted 8 lines
Quoted 2 lines · On Fri, 18 Mar 2011 21:54:15 +0900 Namhyung Kim <[email protected]> wrote:
Cc KAMEZAWA Hiroyuki <[email protected]>

What is the benefit of this patch ?

Quoted 8 lines
Quoted 2 lines

-Kame

Oh, I just thought generally it'd better call such a (potentially) costly function outside of locks and it could reduce few of theoretical contentions between swapons and/or offs. If it doesn't help any realistic cases I don't mind discarding it.

Quoted 8 lines

My point is, please write patch description which shows for what this patc is. All cleanup are okay to me if it reasonable. But without patch description as "this is just a cleanup, no functional change, and the reason is...." we cannot maintain patches.

Thanks,
-Kame

OK, I will do that in the future. Anyway, do you want me to resend the patch with new description?

Thanks.

Signature · 10 lines
Regards,
Namhyung Kim


--
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>
#27 lore raw

Re: [PATCH 3/3] memcg: move page-freeing code outside of lock

Quoted 27 lines · On Tue, 22 Mar 2011 19:06:57 +0900 Namhyung Kim <[email protected]> wrote:

2011-03-22 (화), 13:56 +0900, KAMEZAWA Hiroyuki:

Quoted 26 lines
Quoted 9 lines · On Tue, 22 Mar 2011 12:04:39 +0900 Namhyung Kim <[email protected]> wrote:

2011-03-22 (화), 08:59 +0900, KAMEZAWA Hiroyuki:

Quoted 8 lines
Quoted 2 lines · On Fri, 18 Mar 2011 21:54:15 +0900 Namhyung Kim <[email protected]> wrote:
Cc KAMEZAWA Hiroyuki <[email protected]>

What is the benefit of this patch ?

Quoted 8 lines
Quoted 2 lines

-Kame

Oh, I just thought generally it'd better call such a (potentially) costly function outside of locks and it could reduce few of theoretical contentions between swapons and/or offs. If it doesn't help any realistic cases I don't mind discarding it.

My point is, please write patch description which shows for what this patc is. All cleanup are okay to me if it reasonable. But without patch description as "this is just a cleanup, no functional change, and the reason is...." we cannot maintain patches.

Quoted 7 lines
Quoted 3 lines

Thanks,
-Kame

OK, I will do that in the future. Anyway, do you want me to resend the patch with new description?

please. I'll never ack a patch without description.

Thanks,
-Kame

_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers

#28 lore raw

Re: [PATCH 3/3] memcg: move page-freeing code outside of lock

In reply to Namhyung Kim
Quoted 27 lines · On Tue, 22 Mar 2011 19:06:57 +0900 Namhyung Kim <[email protected]> wrote:

2011-03-22 (화), 13:56 +0900, KAMEZAWA Hiroyuki:

Quoted 26 lines
Quoted 9 lines · On Tue, 22 Mar 2011 12:04:39 +0900 Namhyung Kim <[email protected]> wrote:

2011-03-22 (화), 08:59 +0900, KAMEZAWA Hiroyuki:

Quoted 8 lines
Quoted 2 lines · On Fri, 18 Mar 2011 21:54:15 +0900 Namhyung Kim <[email protected]> wrote:
Cc KAMEZAWA Hiroyuki <[email protected]>

What is the benefit of this patch ?

Quoted 8 lines
Quoted 2 lines

-Kame

Oh, I just thought generally it'd better call such a (potentially) costly function outside of locks and it could reduce few of theoretical contentions between swapons and/or offs. If it doesn't help any realistic cases I don't mind discarding it.

My point is, please write patch description which shows for what this patc is. All cleanup are okay to me if it reasonable. But without patch description as "this is just a cleanup, no functional change, and the reason is...." we cannot maintain patches.

Quoted 7 lines
Quoted 3 lines

Thanks,
-Kame

OK, I will do that in the future. Anyway, do you want me to resend the patch with new description?

please. I'll never ack a patch without description.

Thanks,
-Kame

A message that is not in the archive (sent off-list or not yet received): 20110323133614.95553de8.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org

#30 lore raw

PATCH 1/1 memcg: move page-freeing code out of lock

Move page-freeing code out of swap_cgroup_mutex in the hope that it could reduce few of theoretical contentions between swapons and/or swapoffs.

This is just a cleanup, no functional changes.

Cc Paul Menage <[email protected]>
Cc Li Zefan <[email protected]>
Cc containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
---
 mm/page_cgroup.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
mm/page_cgroup.c +13 -9
index 29951abc852e..17eb5eb95bab 100644
@@ -463,8 +463,8 @@ int swap_cgroup_swapon(int type, unsigned long max_pages)
 		/* memory shortage */
 		ctrl->map = NULL;
 		ctrl->length = 0;
-		vfree(array);
 		mutex_unlock(&swap_cgroup_mutex);
+		vfree(array);
 		goto nomem;
 	}
 	mutex_unlock(&swap_cgroup_mutex);
@@ -479,7 +479,8 @@ nomem:
 
 void swap_cgroup_swapoff(int type)
 {
-	int i;
+	struct page **map;
+	unsigned long i, length;
 	struct swap_cgroup_ctrl *ctrl;
 
 	if (!do_swap_account)
@@ -487,17 +488,20 @@ void swap_cgroup_swapoff(int type)
 
 	mutex_lock(&swap_cgroup_mutex);
 	ctrl = &swap_cgroup_ctrl[type];
-	if (ctrl->map) {
-		for (i = 0; i < ctrl->length; i++) {
-			struct page *page = ctrl->map[i];
+	map = ctrl->map;
+	length = ctrl->length;
+	ctrl->map = NULL;
+	ctrl->length = 0;
+	mutex_unlock(&swap_cgroup_mutex);
+
+	if (map) {
+		for (i = 0; i < length; i++) {
+			struct page *page = map[i];
 			if (page)
 				__free_page(page);
 		}
-		vfree(ctrl->map);
-		ctrl->map = NULL;
-		ctrl->length = 0;
+		vfree(map);
 	}
-	mutex_unlock(&swap_cgroup_mutex);
 }
 
 #endif
Signature · 1 line
1.7.4
#31 lore raw

PATCH 1/1 memcg: move page-freeing code out of lock

In reply to KAMEZAWA Hiroyuki

Move page-freeing code out of swap_cgroup_mutex in the hope that it could reduce few of theoretical contentions between swapons and/or swapoffs.

This is just a cleanup, no functional changes.

---
 mm/page_cgroup.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
mm/page_cgroup.c +13 -9
index 29951abc852e..17eb5eb95bab 100644
@@ -463,8 +463,8 @@ int swap_cgroup_swapon(int type, unsigned long max_pages)
 		/* memory shortage */
 		ctrl->map = NULL;
 		ctrl->length = 0;
-		vfree(array);
 		mutex_unlock(&swap_cgroup_mutex);
+		vfree(array);
 		goto nomem;
 	}
 	mutex_unlock(&swap_cgroup_mutex);
@@ -479,7 +479,8 @@ nomem:
 
 void swap_cgroup_swapoff(int type)
 {
-	int i;
+	struct page **map;
+	unsigned long i, length;
 	struct swap_cgroup_ctrl *ctrl;
 
 	if (!do_swap_account)
@@ -487,17 +488,20 @@ void swap_cgroup_swapoff(int type)
 
 	mutex_lock(&swap_cgroup_mutex);
 	ctrl = &swap_cgroup_ctrl[type];
-	if (ctrl->map) {
-		for (i = 0; i < ctrl->length; i++) {
-			struct page *page = ctrl->map[i];
+	map = ctrl->map;
+	length = ctrl->length;
+	ctrl->map = NULL;
+	ctrl->length = 0;
+	mutex_unlock(&swap_cgroup_mutex);
+
+	if (map) {
+		for (i = 0; i < length; i++) {
+			struct page *page = map[i];
 			if (page)
 				__free_page(page);
 		}
-		vfree(ctrl->map);
-		ctrl->map = NULL;
-		ctrl->length = 0;
+		vfree(map);
 	}
-	mutex_unlock(&swap_cgroup_mutex);
 }
 
 #endif
Signature · 1 line
1.7.4

A message that is not in the archive (sent off-list or not yet received): 1300881558-13523-1-git-send-email-namhyung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#33 lore raw

Re: [PATCH] memcg: move page-freeing code out of lock

Quoted 10 lines · On Wed, 23 Mar 2011 20:59:18 +0900 Namhyung Kim…

Move page-freeing code out of swap_cgroup_mutex in the hope that it could reduce few of theoretical contentions between swapons and/or swapoffs.

This is just a cleanup, no functional changes.

Cc Paul Menage <[email protected]>
Cc Li Zefan <[email protected]>
Cc containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Acked-by on v1 1/1
#34 lore raw

Re: [PATCH] memcg: move page-freeing code out of lock

In reply to Namhyung Kim
Quoted 10 lines · On Wed, 23 Mar 2011 20:59:18 +0900 Namhyung Kim <[email protected]> wrote:

Move page-freeing code out of swap_cgroup_mutex in the hope that it could reduce few of theoretical contentions between swapons and/or swapoffs.

This is just a cleanup, no functional changes.

--
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 1/3
#35 lore raw
In reply to Namhyung Kim
Quoted 7 lines · On Fri, 18 Mar 2011 21:54:13 +0900 Namhyung Kim <[email protected]> wrote:

The commit ca371c0d7e23 ("memcg: fix page_cgroup fatal error in FLATMEM") removes call to alloc_bootmem() in the function so that it can be marked as __meminit to reduce memory usage when MEMORY_HOTPLUG=n.

Cc KAMEZAWA Hiroyuki <[email protected]>
Quoted 22 lines
---
 mm/page_cgroup.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
mm/page_cgroup.c +1 -2
index 5bffada7cde1..2d1a0fa01d7b 100644
@@ -105,8 +105,7 @@ struct page_cgroup *lookup_page_cgroup(struct page *page)
 	return section->page_cgroup + pfn;
 }
 
-/* __alloc_bootmem...() is protected by !slab_available() */
-static int __init_refok init_section_page_cgroup(unsigned long pfn)
+static int __meminit init_section_page_cgroup(unsigned long pfn)
 {
 	struct mem_section *section = __pfn_to_section(pfn);
 	struct page_cgroup *base, *pc;
Signature · 1 line
1.7.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>

A message that is not in the archive (sent off-list or not yet received): 20110322085755.c4193fc1.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org

Acked-by
#37 lore raw
Quoted 11 lines · KAMEZAWA Hiroyuki
Quoted 7 lines · On Fri, 18 Mar 2011 21:54:13 +0900 Namhyung Kim…

The commit ca371c0d7e23 ("memcg: fix page_cgroup fatal error in FLATMEM") removes call to alloc_bootmem() in the function so that it can be marked as __meminit to reduce memory usage when MEMORY_HOTPLUG=n.

Cc KAMEZAWA Hiroyuki <[email protected]>
Acked-by
#38 lore raw
In reply to KAMEZAWA Hiroyuki
Quoted 11 lines · KAMEZAWA Hiroyuki
Quoted 7 lines · On Fri, 18 Mar 2011 21:54:13 +0900 Namhyung Kim <[email protected]> wrote:

The commit ca371c0d7e23 ("memcg: fix page_cgroup fatal error in FLATMEM") removes call to alloc_bootmem() in the function so that it can be marked as __meminit to reduce memory usage when MEMORY_HOTPLUG=n.

Cc KAMEZAWA Hiroyuki <[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>

#39 lore raw
In reply to Namhyung Kim

2011-03-18 (e,?), 21:54 +0900, Namhyung Kim:

Quoted 16 lines

The commit ca371c0d7e23 ("memcg: fix page_cgroup fatal error in FLATMEM") removes call to alloc_bootmem() in the function so that it can be marked as __meminit to reduce memory usage when MEMORY_HOTPLUG=n.

Cc KAMEZAWA Hiroyuki <[email protected]>
---
 mm/page_cgroup.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
mm/page_cgroup.c +0 -0
index 5bffada7cde1..2d1a0fa01d7b 100644

mm/page_cgroup.c struct page_cgroup *lookup_page_cgroup(struct page *page) · line 111

Quoted 9 lines
mm/page_cgroup.c +1 -2
@@ -105,8 +105,7 @@ struct page_cgroup *lookup_page_cgroup(struct page *page)
 	return section->page_cgroup + pfn;
 }
 
-/* __alloc_bootmem...() is protected by !slab_available() */
-static int __init_refok init_section_page_cgroup(unsigned long pfn)
+static int __meminit init_section_page_cgroup(unsigned long pfn)
 {
 	struct mem_section *section = __pfn_to_section(pfn);
 	struct page_cgroup *base, *pc;

Andrew, could you please have a look these patches too and consider applying them in your tree? I can resend them (with given Acked-by lines) if you want.

Thanks.

Signature · 10 lines
Regards,
Namhyung Kim


--
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>