* [PATCH] cgroup/kmemleak: add kmemleak_free() for cgroup deallocations.
@ 2014-09-18 1:38 Wang Nan
2014-09-18 14:16 ` Johannes Weiner
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Wang Nan @ 2014-09-18 1:38 UTC (permalink / raw)
To: Johannes Weiner, Michal Hocko, Steven Rostedt
Cc: cgroups, linux-mm, linux-kernel, Li Zefan
Commit ff7ee93f4 introduces kmemleak_alloc() for alloc_page_cgroup(),
but corresponding kmemleak_free() is missing, which makes kmemleak be
wrongly disabled after memory offlining. Log is pasted at the end of
this commit message.
This patch add kmemleak_free() into free_page_cgroup(). During page
offlining, this patch removes corresponding entries in kmemleak rbtree.
After that, the freed memory can be allocated again by other subsystems
without killing kmemleak.
bash # for x in 1 2 3 4; do echo offline > /sys/devices/system/memory/memory$x/state ; sleep 1; done ; dmesg | grep leak
[ 45.537934] Offlined Pages 32768
[ 46.617892] kmemleak: Cannot insert 0xffff880016969000 into the object search tree (overlaps existing)
[ 46.617892] CPU: 0 PID: 412 Comm: sleep Not tainted 3.17.0-rc5+ #86
[ 46.617892] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 46.617892] ffff880016823d10 ffff880018bdfc38 ffffffff81725d2c ffff88001780e950
[ 46.617892] ffff880016969000 ffff880018bdfc88 ffffffff8117a9e6 ffff880018bdfc78
[ 46.617892] 0000000000000096 ffff880017812800 ffffffff81c2eda0 ffff880016969000
[ 46.617892] Call Trace:
[ 46.617892] [<ffffffff81725d2c>] dump_stack+0x46/0x58
[ 46.617892] [<ffffffff8117a9e6>] create_object+0x266/0x2c0
[ 46.617892] [<ffffffff8171d2f6>] kmemleak_alloc+0x26/0x50
[ 46.617892] [<ffffffff8116a3a3>] kmem_cache_alloc+0xd3/0x160
[ 46.617892] [<ffffffff81058e59>] __sigqueue_alloc+0x49/0xd0
[ 46.617892] [<ffffffff8105a41b>] __send_signal+0xcb/0x410
[ 46.617892] [<ffffffff8105a7a5>] send_signal+0x45/0x90
[ 46.617892] [<ffffffff8105a803>] __group_send_sig_info+0x13/0x20
[ 46.617892] [<ffffffff8105bd0b>] do_notify_parent+0x1bb/0x260
[ 46.617892] [<ffffffff81077e7a>] ? sched_move_task+0xaa/0x130
[ 46.617892] [<ffffffff81050917>] do_exit+0x767/0xa40
[ 46.617892] [<ffffffff81050c84>] do_group_exit+0x44/0xa0
[ 46.617892] [<ffffffff81050cf7>] SyS_exit_group+0x17/0x20
[ 46.617892] [<ffffffff8172cd12>] system_call_fastpath+0x16/0x1b
[ 46.617892] kmemleak: Kernel memory leak detector disabled
[ 46.617892] kmemleak: Object 0xffff880016900000 (size 524288):
[ 46.617892] kmemleak: comm "swapper/0", pid 0, jiffies 4294667296
[ 46.617892] kmemleak: min_count = 0
[ 46.617892] kmemleak: count = 0
[ 46.617892] kmemleak: flags = 0x1
[ 46.617892] kmemleak: checksum = 0
[ 46.617892] kmemleak: backtrace:
[ 46.617892] [<ffffffff81d0a7f0>] log_early+0x63/0x77
[ 46.617892] [<ffffffff8171d31b>] kmemleak_alloc+0x4b/0x50
[ 46.617892] [<ffffffff81720e4f>] init_section_page_cgroup+0x7f/0xf5
[ 46.617892] [<ffffffff81d0a6f0>] page_cgroup_init+0xc5/0xd0
[ 46.617892] [<ffffffff81ce4ed9>] start_kernel+0x333/0x408
[ 46.617892] [<ffffffff81ce45b2>] x86_64_start_reservations+0x2a/0x2c
[ 46.617892] [<ffffffff81ce46a9>] x86_64_start_kernel+0xf5/0xfc
[ 46.617892] [<ffffffffffffffff>] 0xffffffffffffffff
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
---
mm/page_cgroup.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c
index 3708264..5331c2b 100644
--- a/mm/page_cgroup.c
+++ b/mm/page_cgroup.c
@@ -171,6 +171,7 @@ static void free_page_cgroup(void *addr)
sizeof(struct page_cgroup) * PAGES_PER_SECTION;
BUG_ON(PageReserved(page));
+ kmemleak_free(addr);
free_pages_exact(addr, table_size);
}
}
--
1.8.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] cgroup/kmemleak: add kmemleak_free() for cgroup deallocations.
2014-09-18 1:38 [PATCH] cgroup/kmemleak: add kmemleak_free() for cgroup deallocations Wang Nan
@ 2014-09-18 14:16 ` Johannes Weiner
2014-09-18 15:16 ` Steven Rostedt
2014-09-22 13:48 ` Michal Hocko
2014-10-14 11:49 ` Wang Nan
2 siblings, 1 reply; 5+ messages in thread
From: Johannes Weiner @ 2014-09-18 14:16 UTC (permalink / raw)
To: Wang Nan
Cc: Michal Hocko, Steven Rostedt, cgroups, linux-mm, linux-kernel, Li Zefan
On Thu, Sep 18, 2014 at 09:38:05AM +0800, Wang Nan wrote:
> Commit ff7ee93f4 introduces kmemleak_alloc() for alloc_page_cgroup(),
> but corresponding kmemleak_free() is missing, which makes kmemleak be
> wrongly disabled after memory offlining. Log is pasted at the end of
> this commit message.
>
> This patch add kmemleak_free() into free_page_cgroup(). During page
> offlining, this patch removes corresponding entries in kmemleak rbtree.
> After that, the freed memory can be allocated again by other subsystems
> without killing kmemleak.
>
> bash # for x in 1 2 3 4; do echo offline > /sys/devices/system/memory/memory$x/state ; sleep 1; done ; dmesg | grep leak
> [ 45.537934] Offlined Pages 32768
> [ 46.617892] kmemleak: Cannot insert 0xffff880016969000 into the object search tree (overlaps existing)
> [ 46.617892] CPU: 0 PID: 412 Comm: sleep Not tainted 3.17.0-rc5+ #86
> [ 46.617892] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
> [ 46.617892] ffff880016823d10 ffff880018bdfc38 ffffffff81725d2c ffff88001780e950
> [ 46.617892] ffff880016969000 ffff880018bdfc88 ffffffff8117a9e6 ffff880018bdfc78
> [ 46.617892] 0000000000000096 ffff880017812800 ffffffff81c2eda0 ffff880016969000
> [ 46.617892] Call Trace:
> [ 46.617892] [<ffffffff81725d2c>] dump_stack+0x46/0x58
> [ 46.617892] [<ffffffff8117a9e6>] create_object+0x266/0x2c0
> [ 46.617892] [<ffffffff8171d2f6>] kmemleak_alloc+0x26/0x50
> [ 46.617892] [<ffffffff8116a3a3>] kmem_cache_alloc+0xd3/0x160
> [ 46.617892] [<ffffffff81058e59>] __sigqueue_alloc+0x49/0xd0
> [ 46.617892] [<ffffffff8105a41b>] __send_signal+0xcb/0x410
> [ 46.617892] [<ffffffff8105a7a5>] send_signal+0x45/0x90
> [ 46.617892] [<ffffffff8105a803>] __group_send_sig_info+0x13/0x20
> [ 46.617892] [<ffffffff8105bd0b>] do_notify_parent+0x1bb/0x260
> [ 46.617892] [<ffffffff81077e7a>] ? sched_move_task+0xaa/0x130
> [ 46.617892] [<ffffffff81050917>] do_exit+0x767/0xa40
> [ 46.617892] [<ffffffff81050c84>] do_group_exit+0x44/0xa0
> [ 46.617892] [<ffffffff81050cf7>] SyS_exit_group+0x17/0x20
> [ 46.617892] [<ffffffff8172cd12>] system_call_fastpath+0x16/0x1b
> [ 46.617892] kmemleak: Kernel memory leak detector disabled
> [ 46.617892] kmemleak: Object 0xffff880016900000 (size 524288):
> [ 46.617892] kmemleak: comm "swapper/0", pid 0, jiffies 4294667296
> [ 46.617892] kmemleak: min_count = 0
> [ 46.617892] kmemleak: count = 0
> [ 46.617892] kmemleak: flags = 0x1
> [ 46.617892] kmemleak: checksum = 0
> [ 46.617892] kmemleak: backtrace:
> [ 46.617892] [<ffffffff81d0a7f0>] log_early+0x63/0x77
> [ 46.617892] [<ffffffff8171d31b>] kmemleak_alloc+0x4b/0x50
> [ 46.617892] [<ffffffff81720e4f>] init_section_page_cgroup+0x7f/0xf5
> [ 46.617892] [<ffffffff81d0a6f0>] page_cgroup_init+0xc5/0xd0
> [ 46.617892] [<ffffffff81ce4ed9>] start_kernel+0x333/0x408
> [ 46.617892] [<ffffffff81ce45b2>] x86_64_start_reservations+0x2a/0x2c
> [ 46.617892] [<ffffffff81ce46a9>] x86_64_start_kernel+0xf5/0xfc
> [ 46.617892] [<ffffffffffffffff>] 0xffffffffffffffff
>
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Should this go into -stable? I'm inclined to say no, this has been
busted since Steve's other kmemleak fix since 2011, and that change
also didn't go into -stable.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cgroup/kmemleak: add kmemleak_free() for cgroup deallocations.
2014-09-18 14:16 ` Johannes Weiner
@ 2014-09-18 15:16 ` Steven Rostedt
0 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2014-09-18 15:16 UTC (permalink / raw)
To: Johannes Weiner
Cc: Wang Nan, Michal Hocko, cgroups, linux-mm, linux-kernel, Li Zefan
On Thu, 18 Sep 2014 10:16:39 -0400
Johannes Weiner <hannes@cmpxchg.org> wrote:
> Acked-by: Johannes Weiner <hannes@cmpxchg.org>
>
> Should this go into -stable? I'm inclined to say no, this has been
> busted since Steve's other kmemleak fix since 2011, and that change
> also didn't go into -stable.
It only breaks kmem tests, and since nobody noticed recently, I don't
think it needs to go into stable.
On the other hand, it's a very non intrusive fix that I highly doubt
will cause other regressions, so it may not be bad to add a stable tag
to it.
-- Steve
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cgroup/kmemleak: add kmemleak_free() for cgroup deallocations.
2014-09-18 1:38 [PATCH] cgroup/kmemleak: add kmemleak_free() for cgroup deallocations Wang Nan
2014-09-18 14:16 ` Johannes Weiner
@ 2014-09-22 13:48 ` Michal Hocko
2014-10-14 11:49 ` Wang Nan
2 siblings, 0 replies; 5+ messages in thread
From: Michal Hocko @ 2014-09-22 13:48 UTC (permalink / raw)
To: Wang Nan
Cc: Johannes Weiner, Steven Rostedt, cgroups, linux-mm, linux-kernel,
Li Zefan
On Thu 18-09-14 09:38:05, Wang Nan wrote:
> Commit ff7ee93f4 introduces kmemleak_alloc() for alloc_page_cgroup(),
> but corresponding kmemleak_free() is missing, which makes kmemleak be
> wrongly disabled after memory offlining. Log is pasted at the end of
> this commit message.
>
> This patch add kmemleak_free() into free_page_cgroup(). During page
> offlining, this patch removes corresponding entries in kmemleak rbtree.
> After that, the freed memory can be allocated again by other subsystems
> without killing kmemleak.
>
> bash # for x in 1 2 3 4; do echo offline > /sys/devices/system/memory/memory$x/state ; sleep 1; done ; dmesg | grep leak
> [ 45.537934] Offlined Pages 32768
> [ 46.617892] kmemleak: Cannot insert 0xffff880016969000 into the object search tree (overlaps existing)
> [ 46.617892] CPU: 0 PID: 412 Comm: sleep Not tainted 3.17.0-rc5+ #86
> [ 46.617892] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
> [ 46.617892] ffff880016823d10 ffff880018bdfc38 ffffffff81725d2c ffff88001780e950
> [ 46.617892] ffff880016969000 ffff880018bdfc88 ffffffff8117a9e6 ffff880018bdfc78
> [ 46.617892] 0000000000000096 ffff880017812800 ffffffff81c2eda0 ffff880016969000
> [ 46.617892] Call Trace:
> [ 46.617892] [<ffffffff81725d2c>] dump_stack+0x46/0x58
> [ 46.617892] [<ffffffff8117a9e6>] create_object+0x266/0x2c0
> [ 46.617892] [<ffffffff8171d2f6>] kmemleak_alloc+0x26/0x50
> [ 46.617892] [<ffffffff8116a3a3>] kmem_cache_alloc+0xd3/0x160
> [ 46.617892] [<ffffffff81058e59>] __sigqueue_alloc+0x49/0xd0
> [ 46.617892] [<ffffffff8105a41b>] __send_signal+0xcb/0x410
> [ 46.617892] [<ffffffff8105a7a5>] send_signal+0x45/0x90
> [ 46.617892] [<ffffffff8105a803>] __group_send_sig_info+0x13/0x20
> [ 46.617892] [<ffffffff8105bd0b>] do_notify_parent+0x1bb/0x260
> [ 46.617892] [<ffffffff81077e7a>] ? sched_move_task+0xaa/0x130
> [ 46.617892] [<ffffffff81050917>] do_exit+0x767/0xa40
> [ 46.617892] [<ffffffff81050c84>] do_group_exit+0x44/0xa0
> [ 46.617892] [<ffffffff81050cf7>] SyS_exit_group+0x17/0x20
> [ 46.617892] [<ffffffff8172cd12>] system_call_fastpath+0x16/0x1b
> [ 46.617892] kmemleak: Kernel memory leak detector disabled
> [ 46.617892] kmemleak: Object 0xffff880016900000 (size 524288):
> [ 46.617892] kmemleak: comm "swapper/0", pid 0, jiffies 4294667296
> [ 46.617892] kmemleak: min_count = 0
> [ 46.617892] kmemleak: count = 0
> [ 46.617892] kmemleak: flags = 0x1
> [ 46.617892] kmemleak: checksum = 0
> [ 46.617892] kmemleak: backtrace:
> [ 46.617892] [<ffffffff81d0a7f0>] log_early+0x63/0x77
> [ 46.617892] [<ffffffff8171d31b>] kmemleak_alloc+0x4b/0x50
> [ 46.617892] [<ffffffff81720e4f>] init_section_page_cgroup+0x7f/0xf5
> [ 46.617892] [<ffffffff81d0a6f0>] page_cgroup_init+0xc5/0xd0
> [ 46.617892] [<ffffffff81ce4ed9>] start_kernel+0x333/0x408
> [ 46.617892] [<ffffffff81ce45b2>] x86_64_start_reservations+0x2a/0x2c
> [ 46.617892] [<ffffffff81ce46a9>] x86_64_start_kernel+0xf5/0xfc
> [ 46.617892] [<ffffffffffffffff>] 0xffffffffffffffff
>
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Michal Hocko <mhocko@suse.cz>
And sorry, I should have noticed that when reviewing the original patch
which added kmemleak_alloc.
I think this is worth going into stable. The risk is marginal and
somebody might be relying on kmemleak even on older kernels when
debugging a bug during memory hotplug.
Thanks!
> ---
> mm/page_cgroup.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c
> index 3708264..5331c2b 100644
> --- a/mm/page_cgroup.c
> +++ b/mm/page_cgroup.c
> @@ -171,6 +171,7 @@ static void free_page_cgroup(void *addr)
> sizeof(struct page_cgroup) * PAGES_PER_SECTION;
>
> BUG_ON(PageReserved(page));
> + kmemleak_free(addr);
> free_pages_exact(addr, table_size);
> }
> }
> --
> 1.8.4
>
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cgroup/kmemleak: add kmemleak_free() for cgroup deallocations.
2014-09-18 1:38 [PATCH] cgroup/kmemleak: add kmemleak_free() for cgroup deallocations Wang Nan
2014-09-18 14:16 ` Johannes Weiner
2014-09-22 13:48 ` Michal Hocko
@ 2014-10-14 11:49 ` Wang Nan
2 siblings, 0 replies; 5+ messages in thread
From: Wang Nan @ 2014-10-14 11:49 UTC (permalink / raw)
To: Johannes Weiner, Michal Hocko, Steven Rostedt, cgroups, linux-mm,
linux-kernel, Li Zefan
Hi,
I can't find this patch appear in any tree, is there any problem?
As Michal Hocko's suggestion, I resent this patch with stable tag added. Please review.
Thanks.
On 2014/9/18 9:38, Wang Nan wrote:
> Commit ff7ee93f4 introduces kmemleak_alloc() for alloc_page_cgroup(),
> but corresponding kmemleak_free() is missing, which makes kmemleak be
> wrongly disabled after memory offlining. Log is pasted at the end of
> this commit message.
>
> This patch add kmemleak_free() into free_page_cgroup(). During page
> offlining, this patch removes corresponding entries in kmemleak rbtree.
> After that, the freed memory can be allocated again by other subsystems
> without killing kmemleak.
>
> bash # for x in 1 2 3 4; do echo offline > /sys/devices/system/memory/memory$x/state ; sleep 1; done ; dmesg | grep leak
> [ 45.537934] Offlined Pages 32768
> [ 46.617892] kmemleak: Cannot insert 0xffff880016969000 into the object search tree (overlaps existing)
> [ 46.617892] CPU: 0 PID: 412 Comm: sleep Not tainted 3.17.0-rc5+ #86
> [ 46.617892] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
> [ 46.617892] ffff880016823d10 ffff880018bdfc38 ffffffff81725d2c ffff88001780e950
> [ 46.617892] ffff880016969000 ffff880018bdfc88 ffffffff8117a9e6 ffff880018bdfc78
> [ 46.617892] 0000000000000096 ffff880017812800 ffffffff81c2eda0 ffff880016969000
> [ 46.617892] Call Trace:
> [ 46.617892] [<ffffffff81725d2c>] dump_stack+0x46/0x58
> [ 46.617892] [<ffffffff8117a9e6>] create_object+0x266/0x2c0
> [ 46.617892] [<ffffffff8171d2f6>] kmemleak_alloc+0x26/0x50
> [ 46.617892] [<ffffffff8116a3a3>] kmem_cache_alloc+0xd3/0x160
> [ 46.617892] [<ffffffff81058e59>] __sigqueue_alloc+0x49/0xd0
> [ 46.617892] [<ffffffff8105a41b>] __send_signal+0xcb/0x410
> [ 46.617892] [<ffffffff8105a7a5>] send_signal+0x45/0x90
> [ 46.617892] [<ffffffff8105a803>] __group_send_sig_info+0x13/0x20
> [ 46.617892] [<ffffffff8105bd0b>] do_notify_parent+0x1bb/0x260
> [ 46.617892] [<ffffffff81077e7a>] ? sched_move_task+0xaa/0x130
> [ 46.617892] [<ffffffff81050917>] do_exit+0x767/0xa40
> [ 46.617892] [<ffffffff81050c84>] do_group_exit+0x44/0xa0
> [ 46.617892] [<ffffffff81050cf7>] SyS_exit_group+0x17/0x20
> [ 46.617892] [<ffffffff8172cd12>] system_call_fastpath+0x16/0x1b
> [ 46.617892] kmemleak: Kernel memory leak detector disabled
> [ 46.617892] kmemleak: Object 0xffff880016900000 (size 524288):
> [ 46.617892] kmemleak: comm "swapper/0", pid 0, jiffies 4294667296
> [ 46.617892] kmemleak: min_count = 0
> [ 46.617892] kmemleak: count = 0
> [ 46.617892] kmemleak: flags = 0x1
> [ 46.617892] kmemleak: checksum = 0
> [ 46.617892] kmemleak: backtrace:
> [ 46.617892] [<ffffffff81d0a7f0>] log_early+0x63/0x77
> [ 46.617892] [<ffffffff8171d31b>] kmemleak_alloc+0x4b/0x50
> [ 46.617892] [<ffffffff81720e4f>] init_section_page_cgroup+0x7f/0xf5
> [ 46.617892] [<ffffffff81d0a6f0>] page_cgroup_init+0xc5/0xd0
> [ 46.617892] [<ffffffff81ce4ed9>] start_kernel+0x333/0x408
> [ 46.617892] [<ffffffff81ce45b2>] x86_64_start_reservations+0x2a/0x2c
> [ 46.617892] [<ffffffff81ce46a9>] x86_64_start_kernel+0xf5/0xfc
> [ 46.617892] [<ffffffffffffffff>] 0xffffffffffffffff
>
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> ---
> mm/page_cgroup.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c
> index 3708264..5331c2b 100644
> --- a/mm/page_cgroup.c
> +++ b/mm/page_cgroup.c
> @@ -171,6 +171,7 @@ static void free_page_cgroup(void *addr)
> sizeof(struct page_cgroup) * PAGES_PER_SECTION;
>
> BUG_ON(PageReserved(page));
> + kmemleak_free(addr);
> free_pages_exact(addr, table_size);
> }
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-10-14 11:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-18 1:38 [PATCH] cgroup/kmemleak: add kmemleak_free() for cgroup deallocations Wang Nan
2014-09-18 14:16 ` Johannes Weiner
2014-09-18 15:16 ` Steven Rostedt
2014-09-22 13:48 ` Michal Hocko
2014-10-14 11:49 ` Wang Nan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).