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
Xuxingliang
b9e59ad0a7
mm: add macro to judge if node/prenode is free
...
Signed-off-by: Xuxingliang <xuxingliang@xiaomi.com>
2023-09-12 22:09:36 +08:00
Xuxingliang
c9f33b7ee5
mm: use unified naming style for macros
...
Make all macro name starts with prefix MM_
Signed-off-by: Xuxingliang <xuxingliang@xiaomi.com>
2023-09-12 22:09:36 +08:00
wangbowen6
70083168f1
mm: support custom the mm alignment and default to be 8
...
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2023-03-06 11:10:36 +08:00
wangbowen6
b1948a1631
mm: move preceding to previous free node to reduce the overhead
...
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2023-02-01 11:14:02 +08:00
wangbowen6
723c6e52e2
mm: reorder the preceding and size and move MM_ALLOC_BIT to size
...
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2023-02-01 11:14:02 +08:00
wangbowen6
81d37d0320
mm_memalign: avoid two adjacent free nodes situation.
...
Original code assumes the previous node in physical must be
ALLOCED, but other thread may free the previous node between
mm_malloc() and mm_lock(), and the original code didn't condsider
this, which will cause two adjacent free nodes situation and this
should not be happened.
This commit will merge the previous node and node if the previous
node is free to avoid the situation discribed above.
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2023-01-30 11:47:06 +08:00
anjiahao
6b530fceae
mempool:change mempool_multiple way of initialization
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-18 14:12:45 +08:00
anjiahao
bc30b294aa
mm:add heap args to mm_malloc_size
...
use malloc_size inside of where used mm_malloc_size
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-01-17 21:57:37 +08:00
dongjiuzhu1
c82f44c4f3
mm/mm_heap: add mempool to optimize small block performance
...
There are many small memory block in NuttX system, eg: struct tcb_s,
struct inode, etc, and several disadvantages about them:
1.Their frequent allocate and free cause the system memory fragmentation.
2.Since each memory block has an overhead, the utilization of small memory
blocks is relatively low, which will cause memory waste.
So we can use mempool to alloc smallo block, to improve alloc speed
and utilization, to reduce fragmentation.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-01-16 20:32:17 +08:00
Xiang Xiao
6214f3cde7
mm/heap: Fix the minor style issue
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-08 01:25:18 +02:00
Xiang Xiao
4cc13c19c6
Revert "mm: Check the function result with suitable macro."
...
This reverts commit 460d94729a
.
2022-11-07 10:01:52 +01:00
wangbowen6
fccda0c08b
mm_heap: add debug assert to check the alignment problem
...
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@midokura.com>
2022-11-01 19:21:01 +08:00
dongjiuzhu1
579e47347e
mm/mm_heap: define MM_MASK_BIT as significant bits mask
...
using MM_MASK_BIT to expand different bits of preceding field to store the
block status.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-10-29 00:12:02 +08:00
anjiahao
d1d46335df
Replace nxsem API when used as a lock with nxmutex API
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:59:46 +09:00
xiangdong6
460d94729a
mm: Check the function result with suitable macro.
...
The return value of function mm_takesemaphore will never below
than zero, DEBUGVERIFY make no effect to check it, use DEBUGASSERT
instead.
Signed-off-by: xiangdong6 <xiangdong6@xiaomi.com>
2022-09-05 21:11:01 +08:00
chao.an
5db0ab1e6a
mm_heap/backtrace: move MM_ADD_BACKTRACE out of heap lock
...
move MM_ADD_BACKTRACE out of heap lock to improve the performance
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-08-02 01:44:48 +08:00
Jiuzhu Dong
709207b8d3
mm/memdump: dynamic turn on backtrace in heap when enable DEBUG_MM
...
default turn off.
turn on: echo on > /proc/memdump
turn off: echo off > proc/memdump
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-03-27 13:21:48 +08:00
Jiuzhu Dong
2dcc4a359d
mm/dump: add pid and backtrace for every memory node
...
usage:
echo <pid/used/free> trace > /proc/memdump
echo used > /proc/memdump //output all used memory info with backtrace
echo free > /proc/memdump //output all free memory info
echo 22 > /proc/memdump //output used memory info for task pid is 22 with backtrace
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-02-26 14:32:42 +08:00
chenwei23
39cdd99d77
mm: Support the kernel address sanitizer
...
Signed-off-by: chenwei23 <chenwei23@xiaomi.com>
2021-11-02 13:32:47 -03:00
Xiang Xiao
5fe51b923a
mm: Simplify the semaphore handling
...
1.Move all special process to mm_takesemaphore
2.Remove the support of recurive lock
3.Remove mm_trysemaphore function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie216a6294ab67c5d427f31b089beb15c532f08fe
2021-07-10 16:10:32 -03:00
Brennan Ashton
3cdc0b7332
libc: Add additional checks to malloc realloc and memalign
2021-04-04 18:58:04 -07:00
mage1
635cfadc25
mm: Move mm_heap_s related stuff to private header file
...
since it will improve the modularity and reduce the inforamtion explosion
Change-Id: I085b36adb38993a979625a1f4c252d364a15afa1
2021-03-19 09:56:39 -07:00
Alin Jerpelea
acb8ad4c7b
mm: nxstyle fixes
...
Nxstyle fixes to pass CI
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-09 01:21:53 -08:00
Alin Jerpelea
bcee9c391c
mm: Author Gregory Nutt: update licenses to Apache
...
Gregory Nutt has submitted the SGA and we can mograte the licenses
to Apache.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-09 01:21:53 -08:00
Gregory Nutt
1382ea5447
mm/: Coding style clean-up
...
Run tools/nxstyle against all C files under mm/ and correct coding standard violations.
2020-02-13 15:16:53 +01:00
Jussi Kivilinna
75b53d563b
mm/mm-heap: memalign: fix heap corruption caused by using unaligned chuck size. Unaligned nodes generated by memalign later cause heap corruptions when nodes are shrink further (for example, 24 bytes -> 8 bytes, when alignment is 16 bytes).
2017-10-24 15:35:52 -06:00
Gregory Nutt
c4493528a1
Remove some empty file section section header comments
2016-02-17 18:57:35 -06:00
Gregory Nutt
06cd5b2fcc
mm, audio, crypto, graphics: Fix various spacing/alignment issues
2015-10-08 09:10:22 -06:00
Gregory Nutt
b33c2d9cef
Move include/nuttx/mm.h to include/nuttx/mm/mm.h
2014-09-24 07:29:09 -06:00
Gregory Nutt
3464089542
Move core heap allocator logic from mm/. to mm/mm_heap/.
2014-09-22 10:53:50 -06:00