Commit Graph

2192 Commits

Author SHA1 Message Date
Masayuki Ishikawa df298c186f Revert "build depend:Revert Make.dep intermediate ddc file"
This reverts commit ddc3119c4e.
2024-09-15 19:29:47 +08:00
anjiahao 63db77628e stack record: fix ps can't show stack used
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-15 10:25:48 +08:00
anjiahao 632b13fe03 stack recored:Fixed the problem of missing the 0th data in statistics
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-15 10:25:48 +08:00
wangjianyu3 1bb0f19fd5 fs/rename: Do not send notify if the same
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-15 10:11:42 +08:00
xuxin19 ddc3119c4e build depend:Revert Make.dep intermediate ddc file
Revert "Parallelize depend file generation"
This reverts commit d5b6ec450f.

parallel depend ddc does not significantly speed up compilation,
intermediately generated .ddc files can cause problems if compilation is interrupted unexpectedly

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:01:58 +08:00
ligd fab9369093 poll: fix thread_cancel() caused poll used after free
pthread 0          pthread1
fd 0
poll_setup
wait
                   cancel(thread 0)
                   fd 0 close
                   fd 0 notify (sem used after free)
poll_teardown

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-14 20:15:12 +08:00
ouyangxiangzhen 0451ead2c5 fs/mmap: Ensure anonymous pages are initialized to zero
According to the mmap(2) specification, anonymous pages should be initialized to zero unless the MAP_UNINITIALIZED is specified.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-09-13 09:10:21 +08:00
ligd 6a2c03732f clock: Replace all ts and tick conversion functions
Using the ts/tick conversion functions provided in clock.h

Do this caused we want speed up the time calculation, so change:
clock_time2ticks, clock_ticks2time, clock_timespec_add,
clock_timespec_compare, clock_timespec_subtract... to MACRO

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-12 18:14:39 +08:00
dongjiuzhu1 00e878e848 fs/inode: add reference to protect filelist of group
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-10 15:16:19 +08:00
zhanghongyu 420648b0c6 drivers/pipes: add fcntl(F_SETPIPE_SZ/F_GETPIPE_SZ) support
allows user programs to modify pipe size, but not larger than
CONFIG_DEV_PIPE_MAXSIZE

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-09-10 11:35:15 +08:00
Alexey Matveev f56b7b8c06 smartfs procfs: fix double declare g_smartfs_operations 2024-09-10 11:32:32 +08:00
dongjiuzhu1 43d0d95f81 fs/inode: using inode reference to indicate unlink and simply code
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-09 08:42:34 +08:00
dongjiuzhu1 c6815bba3b fs/mount: move inode_lock to before bind to avoid deadlock(nsh and rptun)
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-09 08:42:34 +08:00
dongjiuzhu1 2a8c023357 fs/inode: using orig_row to ensure correct free logic
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-09 01:24:08 +08:00
dongjiuzhu1 6542806248 fs/inode: fix assert when free error address
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-09 01:24:08 +08:00
Xiang Xiao 659448a9d8 fs/hostfs: Replace strcpy with memcpy
The strcpy function is dangerous because it does not check the length of the

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-09-06 12:27:55 +08:00
hujun5 198630a809 sched: use this_task replace nxsched_self
reason:
We can reduce a function call to improve performance.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-05 09:33:50 -03:00
Saurav Pal fc31c61730 boards/sim: Defconfigs for nand and mnemofs
Adds nand and mnemofs sim configs.

Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
2024-09-05 11:02:05 +08:00
chao an 39e873f269 sched/policy: move g_policy from data to rodata
Signed-off-by: chao an <anchao@lixiang.com>
2024-09-02 18:23:57 +08:00
Yanfeng Liu 32801d3047 fs/mq_open: revising comments
This contains minor revision on comments of `file_mq_open()`.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-08-31 12:04:17 -03:00
yinshengkai 263f8955da fs/procfs: Supports any number of thread displays
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>
2024-08-28 14:01:25 +08:00
Masayuki Ishikawa ec4d31515a fs: nfs: Fix nfsmount error
Summary:
- I noticed that nfsmount does not work due to the recent
  changes on sockaddr_storage alignment.
- This commit fixes this issue.

Impact:
- None

Testing:
- Tested with sabre-6quad:netnsh_smp (QEMU)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2024-08-27 21:57:18 +08:00
pengyinjie cbc9b98075 [FS]:Fixed spacing and typo issues in code comment descriptions
[Desc]:as title

Signed-off-by: pengyinjie <pengyinjie@xiaomi.com>
2024-08-27 21:52:56 +08:00
Petro Karashchenko 1528b8dcca nuttx: resolve various 'FAR' and 'CODE' issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-26 10:21:03 +08:00
yinshengkai 2cdfda149a mm: memory pressure support returns the maximum available memory
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-25 23:09:28 +08:00
yinshengkai 49d1b4198f mm: add memory pressure notification support
Add mm_heap_free interface to pass remaining memory to memory pressure

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-25 23:09:28 +08:00
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
buxiasen 946ed96926 fs: add fs_heap, support shm/tmpfs/pseudofile with indepent heap
For some case, need large files from tmpfs or shmfs, will lead to high
pressure on memory fragments, add an optional fs_heap with independent
heap will benifit for memory fragments issue.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-08-25 22:12:37 +08:00
Petro Karashchenko d499ac9d58 nuttx: fix multiple 'FAR', 'CODE' and style issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
Petro Karashchenko d252b6229f nuttx: use sizeof instead of define or number in snprintf
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
pengyinjie 77205b353f [fs][shmfs]:Avoid an integer overflow
[Desc]:We need to check the parameter passed to the kmm_zalloc(size_t) function.
If it exceeds the limit of size_t, we need to return an error directly to avoid further errors.

Signed-off-by: pengyinjie <pengyinjie@xiaomi.com>
2024-08-24 20:33:59 +08:00
Saurav Pal 9d8b92c481 fs/mnemofs: Autoformat
Mnemofs autoformat feature

Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
2024-08-23 18:31:04 -03:00
wangzhi16 bf957348ef [BugFix]Command "critmon" error
Command "critmon" has some format errors and information errors, such as:

PRE-EMPTION CALLER            CSECTION CALLER               RUN         TIME             PID   DESCRIPTION
1.679000000                   3.704000000
                         None None             0     CPU0 IDLE
0.002000000                   0.003000000
                         None None             1     CPU1 IDLE
0.000000000                   0.000000000
                         None None             2     CPU2 IDLE
0.000000000                   0.000000000
                         None None             3     CPU3 IDLE
0.001000000                   0.001000000
                         None None             4     hpwork
0.002000000                   0.006000000
                         None None             5     nsh_main
0.000000000                   0.000000000
                         None None             6     critmon

After bug fix:

PRE-EMPTION CALLER            CSECTION CALLER               RUN              TIME             PID   DESCRIPTION
None                          None                          ---------------- ---------------- ----  CPU 0
None                          None                          ---------------- ---------------- ----  CPU 1
None                          None                          ---------------- ---------------- ----  CPU 2
None                          None                          ---------------- ---------------- ----  CPU 3
None                          None                          0.238000000      6.982000000      0     CPU0 IDLE
None                          None                          0.461000000      13.089000000     1     CPU1 IDLE
None                          None                          0.000000000      0.000000000      2     CPU2 IDLE
None                          None                          0.000000000      0.000000000      3     CPU3 IDLE
None                          None                          0.000000000      0.001000000      4     hpwork
None                          None                          0.000000000      0.010000000      5     nsh_main
None                          None                          0.000000000      0.000000000      46    critmon

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2024-08-23 08:53:15 +08:00
Yongrong Wang f55270f15b rpmsgfs: fix out of bounds access caused by data transmission farmat
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-08-22 20:25:49 +08:00
guohao15 94e9599e5c file_lock:fix memory alloc/free not match
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 20:25:30 +08:00
guohao15 76a1a5b2c4 inotify:fix memory alloc/free not match
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 20:25:30 +08:00
guohao15 43bcac952a tmpfs: old data was loaded when SEEK_SET beyond end of the file
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 20:25:03 +08:00
chenrun1 271f76590f fs_lock/pathbuffer:Optimize code structure
Summary:
  Adjust code logic

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-22 01:54:22 +08:00
chenrun1 dba77ff043 fslock:Optimize the performance overhead caused by frequent close
Summary:
  Indicate whether the file is currently locked by adding a new field locked to filep.
    0 - Unlocked
    1 - Locked
  The status of the filep at close is used to determine whether to continue with the following procedure.

  Optimizing performance:
Before
  Time taken to close the file: 33984 nsec
After
  Time taken to close the file: 23744 nsec
Improvement of about 10 msec

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-22 01:54:22 +08:00
chenrun1 c528244f19 fs_lock:Fixed the problem that in multi-threaded situations, the bucket may be deleted by other factors during the search process, resulting in assertion.
hsearch_r(item = (key = 0x61492174,data = ?),action = ?, retval = 0x6266AC44, htab = 0x6159B758) H 1tem = Ckey = 0x61492174, data= :
 · action = ?
  retval = 0x6266AC44
  htab = 0x6159B758
  haad - 0x61616300
  ie= 0×38

file_lock_find_bucket(inline)
  filepath = 0x61492174
  hretvalue = 0x6055991D
  item = (key = 0x61492174, data = 0x0)

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-22 01:54:22 +08:00
chenrun1 0bf2634631 fs_lock:Reduce stack size
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-22 01:54:22 +08:00
guohao15 a69d3d78fe inotify: add filter of notify options to reduce overload of system
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15 8731368e45 inotify: group g_inotify_xxx global variables into one struct
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15 57250a9602 inotify: use nx_stat instead of stat
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15 bf919afcbd notify:change tempbuffer structure
In rpmsgfs case the old tempbuffer will case deadlock

Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15 3df638971f notify:do not noitfy when in signal context
Some signal handler may opreate files, that will cause deadlock
when the thread holding file system lock

Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15 048415f407 notify: change inode type check out of the lock
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15 25e2d7bef2 inotify:add function filter type of inode
only mountpt/driver/pseudodir need inotify

Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15 03aca2c07e rpmsgfs:add support FIOC_FILEPATH for rpmsgfs_ioctl
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15 68a64c1a4c inotifiy:reduce stack memory used in inotify
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00