3 Commits

Author SHA1 Message Date
Miles Chen
4e7eaba886 [ALPS04789600] mm/page_owner: fix page owner count
We count every found as page owner as 1, which does not
show the correct useage. Add the hit count by (1 << order).

MTK-Commit-Id: 8444306007e5a650ec7327c3e1380640d24ca291

Change-Id: I4c7edfaa5a34a7cf6dfa0dc33a74597bc7f75f0d
CR-Id: ALPS04789600
Signed-off-by: Miles Chen <miles.chen@mediatek.com>
Feature: [Module]Kernel Memory Management
2021-01-29 00:57:51 +08:00
Miles Chen
2b5a1c9a12 [ALPS04752834] mm: print largest page user when OOM
This debug patch prints the largest page user when OOM kernel
panic occurs. It scans the stackdepot of CONFIG_PAGE_OWNER and
print the largest page user in the system.

Under OOM kernel panic, follow message shows up:
max found hit=109119
	__set_page_owner+0x38/0x6c
	get_page_from_freelist+0xc00/0xc08
	__alloc_pages_nodemask+0x160/0x1210
	new_slab+0xc4/0x478
	___slab_alloc+0x4e8/0x67c
	kmem_cache_alloc_trace+0x420/0x4b0
	meminfo_proc_show+0x24/0x28
	seq_read+0x170/0x47c

MTK-Commit-Id: c8308b454e9860b608f365b6df992957c099e57c

Feature: [Module]Kernel Memory Management
CR-Id: ALPS04752834
Change-Id: I4d29d93d73963e8a3c7a19698066266493d98fcc
Signed-off-by: Miles Chen <miles.chen@mediatek.com>
2021-01-29 00:54:16 +08:00
Alexander Potapenko
cd11016e5f mm, kasan: stackdepot implementation. Enable stackdepot for SLAB
Implement the stack depot and provide CONFIG_STACKDEPOT.  Stack depot
will allow KASAN store allocation/deallocation stack traces for memory
chunks.  The stack traces are stored in a hash table and referenced by
handles which reside in the kasan_alloc_meta and kasan_free_meta
structures in the allocated memory chunks.

IRQ stack traces are cut below the IRQ entry point to avoid unnecessary
duplication.

Right now stackdepot support is only enabled in SLAB allocator.  Once
KASAN features in SLAB are on par with those in SLUB we can switch SLUB
to stackdepot as well, thus removing the dependency on SLUB stack
bookkeeping, which wastes a lot of memory.

This patch is based on the "mm: kasan: stack depots" patch originally
prepared by Dmitry Chernenkov.

Joonsoo has said that he plans to reuse the stackdepot code for the
mm/page_owner.c debugging facility.

[akpm@linux-foundation.org: s/depot_stack_handle/depot_stack_handle_t]
[aryabinin@virtuozzo.com: comment style fixes]
Signed-off-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Andrey Konovalov <adech.fo@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Konstantin Serebryany <kcc@google.com>
Cc: Dmitry Chernenkov <dmitryc@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-03-25 16:37:42 -07:00