After the number of threads exceeds the array size, it will not be displayed.
Any number of threads can be displayed using dynamic adaptation
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This is a memory monitoring interface implemented with reference to Linux's PSI (Pressure Stall Information),
which can send notifications when the system's remaining memory is below the threshold.
The following example code sets two different thresholds.
When the system memory is below 10MB, a notification is triggered.
When the system memory is below 20 MB, a notification (POLLPRI event) is triggered every 1s.
```
int main(int argc, FAR char *argv[])
{
struct pollfd fds[2];
int ret;
if (argc == 2)
{
char *ptr = malloc(1024*1024*atoi(argv[1]));
printf("Allocating %d MB\n", atoi(argv[1]));
ptr[0] = 0;
return 0;
}
fds[0].fd = open("/proc/pressure/memory", O_RDWR);
fds[1].fd = open("/proc/pressure/memory", O_RDWR);
fds[0].events = POLLPRI;
fds[1].events = POLLPRI;
dprintf(fds[0].fd, "%llu -1", 1024LLU*1024 * 10);
dprintf(fds[1].fd, "%llu 1000000", 1024LLU*1024 * 20);
while (1)
{
ret = poll(fds, 2, -1);
if (ret > 0)
{
printf("Memory pressure: POLLPRI, %d\n", ret);
}
}
return 0;
}
```
https://docs.kernel.org/accounting/psi.html
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This triggers `mm_free_delaylist()` before dumping status in PROTECTED
build, otherwise the `free` command still shows delaylist as `used`.
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
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>
Change the type of task group member to single list chain to
avoid accessing the memory allocator to improve the performance
Signed-off-by: chao an <anchao@lixiang.com>
Currently at runtime it is hard to know the exact build config of
the current NuttX instance. Thus it is inconvenient when there are
multiple configs for the same board. This patch attempts to solve
the issue by adding build config to /proc/version.
Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
These variables will trigger variable 'ret' set but not used warnings due to different configurations.
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Usage:
1. CONFIG_FS_PROCFS_MAX_STACK_RECORD > 0, such as 32,
2. add '-finstrument-functions' to CFLAGS for What you want to check
stack.
3. mount porcfs
4. cat /proc/<pid>/stack will print backtace & size
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This moves task / thread cancel point logic from the NuttX kernel into
libc, while the data needed by the cancel point logic is moved to TLS.
The change is an enabler to move user-space APIs to libc as well, for
a coherent user/kernel separation.
VELAPLATFO-12536
This provides the initial hooks for Flattened Device Tree support
with QEMU RV. It also provides a new procfs file that exposes the
fdt to userspace much like the /sys/firmware/fdt endpoint in Linux.
See https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-firmware-ofw
Nodes in the fdt are not yet usable by the OS.
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
Signed-off-by: liaoao <liaoao@xiaomi.com>
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>
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)
------------------
How to test
From within nuttx/. Configure:
cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja
(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja
This uses ninja generator (install with sudo apt install ninja-build). To build:
$ cmake --build build
menuconfig:
$ cmake --build build -t menuconfig
--------------------------
2. cmake/build: reformat the cmake style by cmake-format
https://github.com/cheshirekow/cmake_format
$ pip install cmakelang
$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done
Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>