xuxingliang
1f2435641d
nuttxgdb: fix memdump busyloop when nodesize is 0
...
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-12-02 13:43:52 +08:00
xuxingliang
6d2ebfdec6
mm: dump node overheadp during memdump
...
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-11-25 00:42:34 +08:00
Yanfeng Liu
f6facf7602
mm/mm_memalign: add debugging log
...
This adds debugging log support for mm_memalign to help track memory
issues via logs.
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-10-30 08:40:32 +08:00
hanqiyuan
ff4b654be0
memdump: fix warnings.
...
mm_heap/mm_malloc.c: In function 'mm_malloc':
mm_heap/mm_malloc.c:281:33: warning: excess elements in struct initializer
281 | MM_BACKTRACE_ALLOC_PID, 0, ULONG_MAX
| ^
mm_heap/mm_malloc.c:281:33: note: (near initialization for 'dump')
mm_heap/mm_malloc.c:281:36: warning: excess elements in struct initializer
281 | MM_BACKTRACE_ALLOC_PID, 0, ULONG_MAX
| ^~~~~~~~~
mm_heap/mm_malloc.c:281:36: note: (near initialization for 'dump')
Signed-off-by: hanqiyuan <hanqiyuan@xiaomi.com>
2024-10-16 10:23:10 +08:00
Xu Xingliang
3d8b504779
mm: fix kasan report error when delay free is enabled
...
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-10-16 10:23:10 +08:00
xuxingliang
bc9d6549e9
mm: call sched_note within mm lock
...
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-16 10:23:10 +08:00
liwenxiang1
7541311ac0
mm/mm_heap: Optimizing heap performance, changing the mm_size2ndx and mm-addfreechunk functions to inline functions can improve by about 7%
...
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-10-15 22:29:17 +08:00
liwenxiang1
015a45517e
mempool: add the minimum size configuration of mempool
...
The minimum size of mempool can be configured through CONFIG_MM_MPOOL_MINISIZE
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2024-10-13 02:46:57 +08:00
buxiasen
4b315b3606
mm: dump more information when failed dump detail
...
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-10-12 09:32:44 +08:00
anjiahao
c0d416584f
malloc:if malloc filed need print leak memory detatls
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-12 09:32:44 +08:00
yinshengkai
c158ed2c32
mm/heap: memory alignment before executing kasan_register
...
The unaligned address is used in kasan_register, but the aligned address is used in kasan_unregister.
The mismatch between the addr value and mm_heapstart will result in a crash due to the inability to unregister correctly.
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-10-10 23:11:37 +08:00
ligd
5258e48be6
mm/heap: fix heap crash when use KASAN SW_TAG
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-09 18:15:13 +08:00
buxiasen
8def44b65a
mm/dump: pretty the log and thin dump call
...
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-10-08 23:55:59 +08:00
buxiasen
9f2b08a91a
memdump: add dump for the orphan nodes(neighbor of free node)
...
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-10-08 23:55:59 +08:00
buxiasen
fd9a9f67cc
memdump: add biggest allocated node dump
...
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-10-08 23:55:59 +08:00
buxiasen
fd6634ecb5
mm/dump: make macro more common, fix help prompt
...
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-10-08 23:55:59 +08:00
xuxingliang
18d5ae20f5
drivers/segger: add heap data plot
...
Add heap current used to note.
Plot it in segger sysview data plot.
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
xuxingliang
eac6a8597f
sched/note: add note when mm add new region
...
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
xuxingliang
0663ac1483
sched/note: specify note event for heap instrumentation
...
1. Add NOTE_HEAP_ prefix for heap note event.
2. Use note type as heap instrumentation parameter.
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
yinshengkai
79eab8783f
note: add memory tracing event support
...
Record all memory allocation and release, save to ram, used to analyze memory allocation rate and memory usage
Its absolute value is not trustworthy because the memory will be allocated in thread A and released in thread B
netinit-5 [0] 0.105984392: tracing_mark_write: C|5|Heap Usage|96|free: heap: 0x606000000020 size:24, address: 0x603000000370
netinit-5 [0] 0.105996874: tracing_mark_write: C|5|Heap Usage|24|free: heap: 0x606000000020 size:72, address: 0x6070000008e0
nsh_main-4 [0] 3.825169408: tracing_mark_write: C|4|Heap Usage|2177665|free: heap: 0x606000000020 size:424, address: 0x614000000840
nsh_main-4 [0] 3.825228525: tracing_mark_write: C|4|Heap Usage|14977|free: heap: 0x606000000020 size:2162688, address: 0x7f80a639f800
nsh_main-4 [0] 3.825298789: tracing_mark_write: C|4|Heap Usage|15189|malloc: heap: 0x606000000020 size:20, address: 0x6030000003a0
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 17:34:59 +08:00
Xiang Xiao
6e5c81e061
mm/heap: hold heap lock before access mm_nregions
...
to remove the race condition and rename IDX to idx
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-07 04:19:27 +08:00
yinshengkai
5ee7c563a5
mm: add kasan_unregister implementaion
...
In mm_uninitialize should unregister kasan
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-19 03:15:29 +08:00
wangmingrong
ae3facda53
kasan: Implementation of Kasan based on software tags.
...
Currently, only aarch64 is supported
Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
2024-09-19 03:15:29 +08:00
Xiang Xiao
9c6bed4b00
mm: Move kasan.h from mm/kasan to include/nuttx/mm
...
so other parts of the system can use it.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-09-19 03:15:29 +08:00
Alin Jerpelea
339457dda3
mm: migrate to SPDX identifier
...
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-09-13 08:49:05 +08:00
yinshengkai
84333881d7
mm: add mm_largest api to get the current largest available memory block
...
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-25 23:09:28 +08:00
yinshengkai
49d1b4198f
mm: add memory pressure notification support
...
Add mm_heap_free interface to pass remaining memory to memory pressure
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-25 23:09:28 +08:00
Yanfeng Liu
cafee0e086
mm/mm.h: add mm_free_delaylist interface
...
This adds explicit `void mm_free_delaylist(heap)` interface so that
to force freeing the heap's delaylist.
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-08-03 01:30:04 +08:00
fangpeina
242b50f921
libc/execinfo: extract a common backtrace format function
...
Add a common method to format backtrace to buffer, so it can be used by both mm, fs and other possoble modules.
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-06-29 22:44:39 +08:00
buxiasen
756d9508bc
mm: mm_threshold perfer from init
...
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-06-26 00:20:44 +08:00
buxiasen
cf574fa466
mm: add mm_initialize_pool, make pool more flexible
...
now allow enable pool for extra heap, and disable umm/kmm pool.
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-06-25 16:42:06 +08:00
buxiasen
870d989d6c
mm: seperate mm_pool and mm_pool init
...
make possible enable pool, but disabled in system heap.
also compatible for further extra heap use/not use pool.
Now use MM_HEAP_MEMPOOL_THRESHOLD -1 to indicate pool disabled.
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-06-23 11:09:39 +08:00
buxiasen
bdcda24a68
mm: fix mm_curused calculate err
...
before fix, the maxused shown in free command is not accurate.
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-06-07 03:29:02 +08:00
Xu Xingliang
b5f8498142
mm: check double free before adding to delaylist
...
If free memory is delayed, check case of double free in the first
place.
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-06-04 17:42:28 -03:00
yinshengkai
20ebe0e64c
Replace all asserts in kernel code with ASSERT
...
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-05-17 10:18:16 -03:00
chao an
feb6ede434
sched/cpu: replace up_cpu_index() to this_cpu()
...
In SMP mode, up_cpu_index()/this_cpu() are the same, both return the index of the physical core.
In AMP mode, up_cpu_index() will return the index of the physical core, and this_cpu() will always return 0
| #ifdef CONFIG_SMP
| # define this_cpu() up_cpu_index()
| #elif defined(CONFIG_AMP)
| # define this_cpu() (0)
| #else
| # define this_cpu() (0)
| #endif
Signed-off-by: chao an <anchao@lixiang.com>
2024-03-21 18:52:35 +08:00
wangmingrong
d2fd043575
mm: Using Macros Instead of Memory to Fill Labels
...
Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
2024-03-14 22:48:19 +08:00
Yanfeng Liu
813f67f93b
mm_heap/mm.h: revising comments
...
Revising comments to be in line with code
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-03-12 19:44:48 +08:00
Yanfeng Liu
5ac401d941
mm/kconfig: fix typo in MM_DEFAULT_ALIGNMENT
...
This fixes minor typo in MM_DEFAULT_ALIGNMENT
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-03-11 13:12:34 +08:00
Masayuki Ishikawa
e67d32a5ba
Revert "fix variable set but not used"
...
This reverts commit d2d93ba58c
.
2024-02-21 21:29:48 -08:00
yinshengkai
d2d93ba58c
fix variable set but not used
...
These variables will trigger variable 'ret' set but not used warnings due to different configurations.
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-02-21 13:28:20 -03:00
Nathan Hartman
3ed629274e
mm: Fix some typos
2023-11-24 09:57:10 -08:00
Xu Xingliang
6e7115ca09
mm: free delay list when exceeding specified count
...
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2023-11-15 12:05:20 +01:00
Xiang Xiao
0fbeea64d5
mm: Remove mm_spinlock
...
since it's enough to protect per cpu delay list by disabling interrupt
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-11-12 11:27:38 +08:00
yinshengkai
bb5b5420ae
mm: record the maximum system memory usage
...
Add the usmblks field to mallinfo to record the maximum space allocated historically in the system
https://man7.org/linux/man-pages/man3/mallinfo.3.html#:~:text=mmap(2).-,usmblks,-This%20field%20is
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-11-09 09:08:49 +08:00
Xiang Xiao
0c805ca0a9
mm: Change global spinlock to per heap
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-30 11:18:34 +02:00
ligd
fe03ce5fbe
mm: both use spin_lock_irqxx() when operated delaylist
...
align with free_delaylist()
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-10-27 22:27:15 +08:00
TaiJuWu
51eaa59cc0
Replace enter_critical_section with spin_irqsave
...
Base on discusion: https://github.com/apache/nuttx/issues/10981
Signed-off-by: TaiJuWu <tjwu1217@gmail.com>
2023-10-21 11:00:07 +08:00
anjiahao
5d6f6f2d47
mm:fix warning
...
mm_heap/mm_initialize.c:69:11: warning: array subscript -1 is outside array bounds of 'void[2147483647]' [-Warray-bounds]
69 | node->pid = MM_BACKTRACE_MEMPOOL_PID;
| ^~
mm_heap/mm_initialize.c:64:9: note: at offset -16 into object of size [0, 2147483647] allocated by 'mm_memalign'
64 | ret = mm_memalign(arg, alignment, size);
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-09-26 14:12:59 +08:00
ligd
13f0051747
mm: rewrite the memdump code for more readable
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-09-24 10:39:18 +08:00