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
guohao15
74963deceb
inotify:change log level in case of flood the screen
...
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15
a40a8e17fb
fsnotify:fix bug when path="/"
...
fix crash when queue event to root dir's parent
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15
86e00896d3
fs:notify add support for inotify
...
support API: open close read write unlink mkdir rename fchstat rmdir symlink
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 01:50:37 +08:00
guohao15
bed1845333
inode:call inode_release when close success
...
inode will be double released
in close(fd) and files_putlist(&group->tg_filelist)
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-21 13:31:25 +08:00
guohao15
c3791756b2
rpmsgfs: set fs type to rpmsgfs when mount through rpmsgfs
...
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-21 04:28:19 +08:00
buxiasen
0329407d27
procfs/mempool: fix did not remove when pool not enabled
...
will at lease lead to extra code size cost, also possible dataabort.
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-08-21 01:25:34 +08:00
chenrun1
a7f5c37a63
v9fs/client.c:fix in x86 qemu crash
...
Summary:
In the x86 environment, memory does not necessarily start at 0, so when end is 0x0, start = end + 1, and then determine the contents of start, it will cause x86 to cause a crash when accessing an illegal address.
This problem does not occur in the arm environment because arm starts at 0x0, so the content of the 0x1 address is “\0”.
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-19 11:05:40 -03:00
chenrun1
1e3e551a19
v9fs/client.h:fix array type has incomplete element type
...
Summary:
fix error:
v9fs/client.c: In function 'v9fs_client_walk':
v9fs/client.c:1462:16: error: array type has incomplete element type 'struct iovec'
1462 | struct iovec wiov[2];
| ^~~~
v9fs/client.c:1463:16: error: array type has incomplete element type 'struct iovec'
1463 | struct iovec riov[2];
| ^~~~
v9fs/client.c:1463:16: warning: unused variable 'riov' [-Wunused-variable]
v9fs/client.c:1462:16: warning: unused variable 'wiov' [-Wunused-variable]
1462 | struct iovec wiov[2];
| ^~~~
v9fs/client.c: In function 'v9fs_transport_done':
v9fs/client.c:1721:49: error: invalid use of undefined type 'struct iovec'
1721 | FAR struct v9fs_lerror_s *error = cookie->riov[0].iov_base;
| ^
v9fs/client.c:1721:52: error: invalid use of undefined type 'struct iovec'
1721 | FAR struct v9fs_lerror_s *error = cookie->riov[0].iov_base;
| ^
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-19 11:05:40 -03:00
chenrun1
fa7403db5a
v9fs:Support ioctl to get relpath
...
Summary:
1.The relpath information is stored in the fid structure
2.The relative path information is only saved in the client. When the server changes, the relpath saved in the fid will not change.
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-19 11:05:40 -03:00
chenrun1
aee9125350
v9fs:File system based on 9P2000L.
...
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-19 11:05:40 -03:00
chenrun1
af5d679e18
fs.h:Added definition CH_STAT_SIZE
...
Define a CH_STAT_SIZE in fs.h
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-19 11:05:40 -03:00
cuiziwei
17a06ce2cd
fs/mmap: Fix build warning with [-Wmaybe-uninitialized].
...
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-08-19 16:40:58 +08:00
cuiziwei
71d10bd8cf
nuttx/fs:Rename node with inode.
...
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-08-19 13:35:56 +08:00
chenrun1
d65f8bd4c1
filelock:Move filelock call to ioctl
...
Forward the implementation originally placed in fcntl to ioctl. in order
to achieve cross-core.
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-18 19:56:49 +08:00
chenrun1
a1e3444df0
rpmsgfs:Support cross-core access using file locks on the same file
...
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-18 19:56:49 +08:00
chenrun1
f7adb52c8b
hostfs_ioctl:Fixed the error:expected expression caused by not adding parentheses in switch
...
hostfs/hostfs.c:612:17: error: expected expression
FAR char *path = (FAR char *)(uintptr_t)arg;
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-18 10:17:48 +08:00
chenrun1
def05ebabb
hostfs:ioctl should return -ENOTTY when the instruction is incompatible
...
When sending FIOC_XXXLK to hostfs, hostfs will return -1 by default. For ioctl statements, incompatible instructions should be processed as -ENOTTY by default
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-18 10:17:48 +08:00
chenrun1
6e9a43c504
hostfs:add get_path
...
To perform kvdb related type testing in the simulator, ioctl support is required to obtain relpath
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-18 10:17:48 +08:00
chenrun1
e9ac1a2317
rpmsgfs_client:Fix error return exception
...
When handling errors through ioctl, the error returned by the server is always 0 on the client, because cookie.result is not assigned, the error returned should be in msg->result
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-18 10:15:18 +08:00
Saurav Pal
daa3168cfb
fs/mnemofs: Fix journal log rw issue, read size issue
...
Fixes the journal log read and write size and overlap issues, along with read return value issue.
Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
2024-08-17 09:10:04 -03:00
Xiang Xiao
7c1768c167
fs/epoll: Double array size when it is full
...
correct the sequnce of array size from:
size, size, 2*size, 4*size, 8*size...
to:
size, 2*size, 4*size, 8*size, 16*size...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-08-17 00:19:15 +02:00
Xiang Xiao
56b2e7254a
fs/poll: Compute tick from millisecond by MSEC2TICK
...
reduce duplicate code
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-08-17 00:19:15 +02:00
xuxin19
7502c9c334
cmake:bugfix add sched include search path for fs
...
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 20:58:59 +08:00