zhanxiaoqi
975968db1b
mm/mempool: fix the entry condition for semaphore during mempool allocation
...
When the mempool uses the waitsem semaphore for memory allocation,
the flowing two conditions must be satisfied simultaneously:
its wait variable is set to true, and the expandsize variable is set to 0
Signed-off-by: zhanxiaoqi <zhanxiaoqi@bytedance.com >
2026-02-28 00:24:54 +08:00
anjiahao
ee052a4570
mempool:fix bug, Misjudged the condition of interrupt memory release
...
We don't need to subtract the block size; we only need to determine if it's within the interrupt memory range.
Signed-off-by: anjiahao <anjiahao@xiaomi.com >
2025-12-22 15:14:26 +08:00
anjiahao
92f26a98dd
mm:use Kconfig to control sequence number to save memory
...
One memory block can save sizeof(size_t) size.
Signed-off-by: anjiahao <anjiahao@xiaomi.com >
2025-12-20 09:47:22 -03:00
wangmingrong1
9af2f0ee82
mempool: Support mempool address and size alignment by setting CONFIG_MM_NODE_GUARDSIZE
...
Setting a reasonable CONFIG_MM_NODE_GUARDSIZE can ensure absolute alignment of usersize
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com >
2025-06-26 20:33:29 +08:00
wangmingrong1
e6f77d7f14
mempool: Use the same magic with mmheap
...
mmheap magic: #define MM_INIT_MAGIC 0xcc #define MM_ALLOC_MAGIC 0xaa #define MM_FREE_MAGIC 0x55
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com >
2025-06-26 20:33:29 +08:00
wangmingrong1
aa0aecbd80
mempool: addbacktrace should be before kasan_unpoison
...
If thread 1 is executing kasan_unpoison but a scheduling occurs and the block is trampled upon, the displayed backtracking may still be from the previously allocated backtracking
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com >
2025-01-12 01:29:14 +08:00
hujun5
34e79f9618
spinlock: use spin_lock_init replace spin_initialize
...
reason:
1: spin_lock_init and spin_initialize have similar functionalities.
2: spin_lock and spin_unlock should be called in matching pairs.
Signed-off-by: hujun5 <hujun5@xiaomi.com >
2024-11-26 00:02:44 +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
yinshengkai
5aa48061c9
mm: fix mempool default recording backtrace
...
Need to initialize procfs.backtrace to false if it's disabled.
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com >
2024-10-17 09:05:11 +08:00
Neo Xu
9c6c56c255
mempool: use backtrace_format
...
There's no need to manually format the backtrace any more.
Signed-off-by: Neo Xu <neo.xu1990@gmail.com >
2024-10-17 09:05:11 +08:00
xuxingliang
a8b7d26db5
Use BACKTRACE_BUFFER_SIZE to declare backtrace buffer
...
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com >
2024-10-15 01:07:21 +08:00
Bowen Wang
313d6df787
include/nuttx.h: replace all the align macros to nuttx version
...
1. add IS_ALIGNED() definitions for NuttX;
2. replace all the ALIGN_UP() and ALIGN_DOWN() to use common
align implementation;
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com >
2024-10-11 16:55:43 +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
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
fangpeina
dbdeaa2ada
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-08-21 18:01:24 +08:00
anjiahao
8f92695ee1
mempool:need unposion memory when deinit
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com >
2024-08-21 18:01:24 +08:00
anjiahao
8c52317a45
mempool:fix mempool memdump address incorrect printing
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com >
2024-08-21 18:01:24 +08:00
anjiahao
7c34ece5d6
mempool:fix memdump leak will hang on spinlock
...
root cuase is getpid use spinlock
can read mempool nodes without needing spinlock protection.
Signed-off-by: anjiahao <anjiahao@xiaomi.com >
2024-08-21 18:01:24 +08:00
anjiahao
73f506b65f
mempool: safe memdump for smp, if syslog will switch context
...
remove alist, switch to a convenient way to traverse
the physical address directly.
At the same time, we can use `gurad` to mark whether
it is free or alloc or out of bounds check
Signed-off-by: anjiahao <anjiahao@xiaomi.com >
2024-08-21 18:01:24 +08:00
yinshengkai
659f3b5ff6
mm: remove mempool_sq_count
...
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com >
2024-08-21 18:01:24 +08:00
anjiahao
0687466223
mempool:alloc for sq head, free to sq last useful debug
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com >
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com >
2024-08-21 18:01:24 +08:00
guoshichao
61cd8c379e
mm/mempool: rename the mempool_alloc and mempool_free function
...
the mempool_alloc and mempool_free function are duplicate with the
mempool method that provided in optee_os, in order to port optee_os, so
we rename the mempool related functions in nuttx
Signed-off-by: guoshichao <guoshichao@xiaomi.com >
2024-08-18 19:46:54 +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
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
Nathan Hartman
3ed629274e
mm: Fix some typos
2023-11-24 09:57:10 -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
Petro Karashchenko
440be65010
spinlock: use spinlock API instead of direct asignment/compare
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com >
2023-09-16 14:17:47 +08:00
dongjiuzhu1
36e3d32740
mm/heap: add coloration after free to detect use after free issue
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com >
2023-09-11 15:28:34 -04:00
anjiahao
e053dcc9f4
mempool:add check for double free check for mempool free
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com >
2023-08-19 01:22:58 +08:00
wangbowen6
b0ab41beee
memdump: support dump the leak memory (malloced but task exit)
...
1. command "memdump leak" can dump the leacked memory node;
2. fix the leak memory stat bug in memory manager;
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com >
2023-07-31 05:48:33 -07:00
wangbowen6
2dedaa449b
mm: use shced_backtrace and skip the first numbers in mm backatrace
...
beacause the first numbers backtrace in mm node is same, skip them to
show more useful backtrace.
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com >
2023-07-31 05:46:37 -07:00
anjiahao
79c0fafc06
mm:Fix the problem that the memdump statistics of blkcont are inconsistent
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com >
2023-06-25 18:17:30 +08:00
Xiang Xiao
a8e0a5faa4
sched: Remove the unnecessary cast from pid_t to int
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2023-06-19 11:37:34 +03:00
Xiang Xiao
07b0cd1cba
mm: Simplify memdump_handler logic a little bit
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2023-06-19 11:37:34 +03:00
Xiang Xiao
313f79d55e
mm/mempool: Count the expend block overhead in mempool_info
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2023-06-19 11:37:34 +03:00
Xiang Xiao
0572bc4d03
mm/mempool: Count the backtrace overhead in mempool_[dump|info[_task]]
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2023-06-19 11:37:34 +03:00
Xiang Xiao
9b6cd96671
mm: Rename PID_MM_INVALID to PID_MM_LEAK
...
to express the intent more clear
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2023-06-18 14:26:07 +03:00
Xiang Xiao
f01deff80f
mm: Rename MM_BACKTRACE_XXX_PID to PID_MM_XXX
...
and move the definition to malloc.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2023-06-18 09:12:14 +03:00
Xiang Xiao
ddbe9eb6ab
mm: Rename mm_memdump_s to malltask
...
align with the naming of mallinfo_task
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2023-06-18 09:12:14 +03:00
Xiang Xiao
1d5ca4e809
mm/mempool: Avoid the allocation number of expend block equals zero
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2023-06-17 19:11:07 -03:00
Xiang Xiao
9f4da58c67
mm: Remove mempoolinfo_task macro and use mallinfo_task directly
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2023-06-11 19:37:04 +03:00
Xiang Xiao
e98a153cb2
mm/mempool: Remove nexpend and totalsize from mempool_s
...
forget in the commit(https://github.com/apache/nuttx/pull/9052 ):
commit 781a34da94
Author: anjiahao <anjiahao@xiaomi.com >
Date: Tue Apr 18 11:18:43 2023 +0800
memepool:fix memory consumption double counting issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2023-06-04 11:47:51 -03:00
anjiahao
e6506619ac
mempool:Fix seqnumber statistics error in memdump
...
The judgment of seqmin and seqmax is ignored
Signed-off-by: anjiahao <anjiahao@xiaomi.com >
2023-05-31 23:00:16 +08:00
ligd
1a927a6cf3
mm: add invalid pid dump when malloc failed
...
We can dump the memory that has exited but
has not been released
Signed-off-by: ligd <liguiding1@xiaomi.com >
2023-05-30 02:19:59 +08:00
anjiahao
c60dd72a2a
Support memdump to realize incremental dump function
...
Add a new field to record the global on the basis of mm_backtrace.
When using alloc, the field is incremented by 1,
so that the memory usage can be dumped within the range
Signed-off-by: anjiahao <anjiahao@xiaomi.com >
2023-05-22 12:31:32 +08:00
Xiang Xiao
6f6fce95a2
Replace all sprintf with snprintf
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com >
2023-05-08 09:57:01 +02:00
anjiahao
df2925cf13
mempool:fix bug, use incorrect free in mempool init
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com >
2023-04-27 00:28:09 +08:00
anjiahao
781a34da94
memepool:fix memory consumption double counting issue
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com >
2023-04-23 23:28:32 +08:00