nuttx/fs
yinshengkai f44a31c337 procfs: add memory pressure notification support
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>
2024-08-25 23:09:28 +08:00
..
aio fs/inode: remove all unnecessary check for filep/inode 2023-08-29 09:47:11 +08:00
binfs nuttx: fix multiple 'FAR', 'CODE' and style issues 2024-08-25 19:22:15 +08:00
cromfs nuttx: fix multiple 'FAR', 'CODE' and style issues 2024-08-25 19:22:15 +08:00
driver nuttx: fix multiple 'FAR', 'CODE' and style issues 2024-08-25 19:22:15 +08:00
fat nuttx: fix multiple 'FAR', 'CODE' and style issues 2024-08-25 19:22:15 +08:00
hostfs nuttx: fix multiple 'FAR', 'CODE' and style issues 2024-08-25 19:22:15 +08:00
inode nuttx: fix multiple 'FAR', 'CODE' and style issues 2024-08-25 19:22:15 +08:00
littlefs littlefs/Make.defs:Add get path temp patch 2024-02-21 06:15:39 -08:00
mmap fs/mmap: Fix build warning with [-Wmaybe-uninitialized]. 2024-08-19 16:40:58 +08:00
mnemofs nuttx: fix multiple 'FAR', 'CODE' and style issues 2024-08-25 19:22:15 +08:00
mount nuttx: fix multiple 'FAR', 'CODE' and style issues 2024-08-25 19:22:15 +08:00
mqueue fs:notify add support for inotify 2024-08-22 01:50:37 +08:00
nfs nuttx: fix multiple 'FAR', 'CODE' and style issues 2024-08-25 19:22:15 +08:00
notify inotify:fix memory alloc/free not match 2024-08-22 20:25:30 +08:00
nxffs stm32h7/linum-stm32h753bi: Add support to littlefs and nxffs with flash mem. via quadspi 2024-04-15 13:24:55 +08:00
partition fs: partition: fs_mbr: fix for MBR block count calculation. 2024-01-14 01:29:24 -08:00
procfs procfs: add memory pressure notification support 2024-08-25 23:09:28 +08:00
romfs fs/romfs: Move rn_child/rn_count before rn_namesize 2024-01-20 09:27:50 -03:00
rpmsgfs rpmsgfs: fix out of bounds access caused by data transmission farmat 2024-08-22 20:25:49 +08:00
semaphore fs:notify add support for inotify 2024-08-22 01:50:37 +08:00
shm fs: add fs_heap, support shm/tmpfs/pseudofile with indepent heap 2024-08-25 22:12:37 +08:00
smartfs nuttx: fix multiple 'FAR', 'CODE' and style issues 2024-08-25 19:22:15 +08:00
socket build: add initial cmake build system 2023-07-08 13:50:48 +08:00
spiffs nuttx: fix multiple 'FAR', 'CODE' and style issues 2024-08-25 19:22:15 +08:00
tmpfs fs: add fs_heap, support shm/tmpfs/pseudofile with indepent heap 2024-08-25 22:12:37 +08:00
unionfs nuttx: fix multiple 'FAR', 'CODE' and style issues 2024-08-25 19:22:15 +08:00
userfs fs: procfs add poll support 2023-12-26 19:23:13 -08:00
v9fs v9fs/client.c:fix in x86 qemu crash 2024-08-19 11:05:40 -03:00
vfs fs: add fs_heap, support shm/tmpfs/pseudofile with indepent heap 2024-08-25 22:12:37 +08:00
zipfs fs: procfs add poll support 2023-12-26 19:23:13 -08:00
CMakeLists.txt fs: add fs_heap, support shm/tmpfs/pseudofile with indepent heap 2024-08-25 22:12:37 +08:00
fs_heap.c fs: add fs_heap, support shm/tmpfs/pseudofile with indepent heap 2024-08-25 22:12:37 +08:00
fs_heap.h fs: add fs_heap, support shm/tmpfs/pseudofile with indepent heap 2024-08-25 22:12:37 +08:00
fs_initialize.c fs: add fs_heap, support shm/tmpfs/pseudofile with indepent heap 2024-08-25 22:12:37 +08:00
Kconfig fs: add fs_heap, support shm/tmpfs/pseudofile with indepent heap 2024-08-25 22:12:37 +08:00
Makefile fs: add fs_heap, support shm/tmpfs/pseudofile with indepent heap 2024-08-25 22:12:37 +08:00