memcg: mark init_section_page_cgroup() properly
PATCH RESEND 1/4 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.
Also as new helper function alloc_page_cgroup() is called only in the function, it should be marked too.
---
I kept Acked-by's because it seemed like a trivial change, no?
mm/page_cgroup.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
mm/page_cgroup.c +2 -2
@@ -130,7 +130,7 @@ struct page *lookup_cgroup_page(struct page_cgroup *pc)return page; } -static void *__init_refok alloc_page_cgroup(size_t size, int nid) +static void *__meminit alloc_page_cgroup (size_t size,int nid) {void *addr =NULL ;
@@ -162,7 +162,7 @@ static void free_page_cgroup(void *addr) }#endif -static int __init_refok init_section_page_cgroup(unsigned long pfn) +static int __meminit init_section_page_cgroup (unsigned long pfn) {struct page_cgroup *base, *pc;struct mem_section *section;
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>
PATCH RESEND 2/4 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.
--- mm/page_cgroup.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
mm/page_cgroup.c +1 -1
@@ -475,7 +475,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>
PATCH RESEND 3/4 memcg: move page-freeing code out of lock
In reply to Namhyung KimMove 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
@@ -492,8 +492,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);
@@ -508,7 +508,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)
@@ -516,17 +517,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>
PATCH RESEND 4/4 MAINTAINERS: add mm/page_cgroup.c into memcg subsystem
In reply to Namhyung KimAFAICS mm/page_cgroup.c is for memcg subsystem, but it was directed only to generic cgroup maintainers. Fix it.
--- MAINTAINERS | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
MAINTAINERS +1 -0
@@ -4121,6 +4121,7 @@ M: KAMEZAWA Hiroyuki <[email protected]> L: [email protected] S: Maintained F: mm/memcontrol.c +F: mm/page_cgroup.c MEMORY TECHNOLOGY DEVICES (MTD) M: David Woodhouse <[email protected]>
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>
Quoted 5 lines · Namhyung Kim
The commit
ca371c0d7e23("memcg: fixpage_cgroupfatal error in FLATMEM") removes call toalloc_bootmem()in the function so that it can be marked as__meminitto reduce memory usage when MEMORY_HOTPLUG=n.
Quoted 7 lines
Also as new helper function
alloc_page_cgroup()is called only in the function, it should be marked too.Signed-off-by Namhyung Kim <[email protected]>Acked-by Balbir Singh <[email protected]>Cc Michal Hocko <[email protected]>
I am not aware I would be involved in the first round, but yes this looks correct and reasonable. You can add my
if you care.
Quoted 37 lines
---
I kept Acked-by's because it seemed like a trivial change, no?mm/page_cgroup.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)mm/page_cgroup.c +2
-2@@ -130,7 +130,7 @@ struct page *lookup_cgroup_page(struct page_cgroup *pc)return page; } -static void *__init_refok alloc_page_cgroup(size_t size, int nid) +static void *__meminit alloc_page_cgroup (size_t size,int nid) {void *addr =NULL ;@@ -162,7 +162,7 @@ static void free_page_cgroup(void *addr) }#endif -static int __init_refok init_section_page_cgroup(unsigned long pfn) +static int __meminit init_section_page_cgroup (unsigned long pfn) {struct page_cgroup *base, *pc;struct mem_section *section;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>
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>