Commit Graph

160 Commits

Author SHA1 Message Date
zhanghongyu b934555fd1 mm/iob: Support alloc IOB via malloc
Support the network interface card driver to receive zero copies of packets and send and receive giant frame packets, allowing drivers to initialize the DMA buffer to the iob structure, and we can apply for IOB with large memory

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-04-26 01:06:21 +08:00
zhanghongyu 00d208baf6 mm/iob: replace CONFIG_IOB_BUFSIZE to IOB_BUFSIZE(iob)
Variable length iob can be supported

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-04-26 01:06:21 +08:00
Yanfeng Liu 7523654386 mm/map.h: minor revision on comments and field defs
This patch uses "struct mm_map_entry_s" instead of the non-existing
"struct mm_map_entry" with minor revision on comments.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-04-03 10:15:48 -03:00
Yanfeng Liu f6097cfa67 mm/kmap.h: fix typo in comments
Fix typo in comments for kmm_map() function.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-03-26 07:41:57 +01: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 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
chao an 29e50ffa73 sched/group: move task group into task_tcb_s to improve performance
move task group into task_tcb_s to avoid access allocator to improve performance

for Task Termination, the time consumption will be reduced ~2us (Tricore TC397 300MHZ):
15.97(us) -> 13.55(us)

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-10 11:45:46 -03:00
Tiago Medicci Serrano fcff5d43b7 drivers/rmt: Implement an upper-half RMT character driver
The RMT (Remote Control) character driver allows to use the RMT
peripheral (usually, a one-wire peripheral dedicated to driving
IR remote control) as a character driver.

Please note that this perpiheral depends on the lower-half specific
driver implementation.
2023-12-24 16:38:06 -08:00
Ville Juven 51f8611fc0 mm/kmap: Change kmm_user_map to kmm_map_user
Naming consistency wrt kmm_map_user_page
2023-09-29 21:06:16 +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
Zhe Weng d44e19d115 mm/iob: Add support for increasing length in iob_update_pktlen
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-08-22 16:34:21 +09:00
anjiahao 4c39cdce09 mempool:Use default alignment inside of blockalign
can reduce memery usage

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-08-19 01:29:14 +08:00
fangxinyong 43b0421b2a mm/map: limit the count of memory mapping for the task
No memory map count limit that will exhaust memory and cause
the system hang. Also that fix pass LTP posix case mmap/24-1.c

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-08-02 22:57:28 -07:00
Bowen Wang 477602e657 mm_heap: mm dump and panic only valid for the heap own by OS
When other code use nuttx memory manager by call mm_xx api directly,
it better to let other code to control weather dump or panic when
malloc failed.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-08-02 06:11:59 -07: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 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 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 d920bfba10 mm: include malloc.h in mm/mm.h
to remove the forward declaration of mallinfo and mallinfo_task

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-11 19:37:04 +03:00
anjiahao 7732791cd6 mempool:Add mail_info support for multiple pools
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-06-08 23:56:40 +08:00
anjiahao 6572081e07 mempool:Allocate a chunk for multiple mempool avoid memory fragmentation
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-06-08 23:56:40 +08:00
Ville Juven a41f752ecc kmm/kmm_map: Add missing FAR qualifiers 2023-06-05 12:03:37 +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
Ville Juven 0476e30a6d mm/kmm_map: Add support to dynamically map pages into kernel virtual memory
This adds functionality to map pages dynamically into kernel virtual
memory. This allows implementing I/O remap for example, which is a useful
(future) feature.

Now, the first target is to support mapping user pages for the kernel.

Why? There are some userspace structures that might be needed when the
userspace process is not running. Semaphores are one such example. Signals
and the WDT timeout both need access to the user semaphore to work
properly. Even though for this only obtaining the kernel addressable
page pool virtual address is needed, for completeness a procedure is
provided to map several pages.
2023-06-02 10:50:26 +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 70cb62e2a3 Support when malloc failed dump mempool info
Replaced the previous implementation method to
maintain unity with the heap dump

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-05-29 15:29:31 +02: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
anjiahao 736af90370 Support when malloc failed dump mempool info
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-05-19 21:20:18 +08:00
anjiahao 9971dfd0c1 circbuf support write or read buffer direct
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-04-23 23:32:00 +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
anjiahao 49cd7a795a mm:change special pid to macro
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-04-23 23:28:32 +08:00
Ville Juven 53d4b9ed54 mm/mm_map: Give the mm_map as parameter to the mm_map functions
This way the mappings can be modified for any vm area, not only the
process that is running.

Why? This allows mapping pages to kernel dynamically, this functionality
will be presented later.
2023-04-22 00:40:37 +08:00
Petro Karashchenko ab196aebe4 include/nuttx/mm: remove FAR from non-pointer types
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-03-09 16:27:07 -03:00
Zhe Weng cd1decf4a5 mm/iob: Support neg offset in iob_clone
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-03-08 23:09:25 +02:00
anjiahao 4ced3c9642 mempool:fix bug when use MM_BACKTRACE
caculate blk address when mempool_multiple_free
have a bug. need a real blocksize to caulate the
memory address.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-02-13 15:47:17 +08:00
Zhe Weng be89bcc044 mm/iob: Support negative offset when copyin/out.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-01-31 00:39:15 +08:00
Xiang Xiao 27afd0e5e3 mm/mempool: Fix the minor style issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-22 23:23:28 +02:00
anjiahao b362f18d6a mempool:Calibration total memory statistics
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-18 09:02:33 +01:00
anjiahao d846004533 mempool:use two-dimensional array avoid competition
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-18 09:02:33 +01:00
anjiahao 632ed0d3a4 Optimize multipe mempool memory space usage
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-18 14:12:45 +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 49ffd99eaf mempool:use single queue insdie of list
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-01-18 14:12:45 +08:00
anjiahao f24fb2b10a mempool:add a private pointer to stroe private data
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-18 14:12:45 +08:00
anjiahao e7d02ffac2 mempool:remove multiple fixed api
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-18 14:12:45 +08:00
anjiahao f00d56337f mempool:remove unnecessary alignment
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 c386a1a2d9 mm/mempool: support backtrace function for mempool
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-17 16:48:30 +08:00
anjiahao af3978c1fa adjust the contents of memdump and meminfo
memdump:just dump info
meminfo:statistics mem information

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-17 16:48:30 +08:00
Gustavo Henrique Nihei a3e253b4a3 mm: Enable a dedicated kernel heap on BUILD_FLAT via MM_KERNEL_HEAP
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-01-17 10:30:00 +08:00
dongjiuzhu1 5c0a5a6627 mm/mempool: support memalign about mempool and mulitple mempool
The memalign is special to multiple mempool because multiple mempool
doesn't support split and shrink chunk operate. So When you alloc a
memory block and find an aligned address in this block, you need to
occupy 8 bytes before the address to save the address of the padding
size and pool to ensure correct use in realloc and free operations.
So we will use bit1 in the previous address of the address to represent
that it is applied by memalign.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-01-15 20:05:55 +08:00