Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG REPORT] 进程页表未能完全释放? #1044

Open
fslongjin opened this issue Nov 12, 2024 · 3 comments
Open

[BUG REPORT] 进程页表未能完全释放? #1044

fslongjin opened this issue Nov 12, 2024 · 3 comments
Assignees
Labels
A-mm Area: 内存管理子系统 bug-report 这是一个bug报告(如果确认是一个bug,请管理人员添加`bug` label) needs-triage 这个问题可能需要分类处理。如果已经完成分类,请移除它。

Comments

@fslongjin
Copy link
Member

fslongjin commented Nov 12, 2024

描述错误
用户程序的地址空间结构体AddressSpace在Drop的时候,貌似没有释放顶层页表。导致每个进程退出后,系统内存使用量会增加4K。(注意看used字段)

root@DragonOS:/$ free
        total           used            free            shared          cache_used      cache_free      available
Mem:    506480          51968           454512          0               0               0               0
root@DragonOS:/$ free
        total           used            free            shared          cache_used      cache_free      available
Mem:    506480          51972           454508          0               0               0               0
root@DragonOS:/$ free
        total           used            free            shared          cache_used      cache_free      available
Mem:    506480          51976           454504          0               0               0               0
root@DragonOS:/$ 

请填写您的电脑的信息:

重现步骤
重现行为的步骤:

  1. 多次运行free命令
  2. 看到结果。

期望行为
进程退出后,内存应该被释放完全。

@fslongjin fslongjin added A-mm Area: 内存管理子系统 bug-report 这是一个bug报告(如果确认是一个bug,请管理人员添加`bug` label) labels Nov 12, 2024
@dragonosbot dragonosbot added the needs-triage 这个问题可能需要分类处理。如果已经完成分类,请移除它。 label Nov 12, 2024
@MemoryShore
Copy link
Collaborator

MemoryShore commented Nov 18, 2024

free在novashell中属于内置命令,不会开启新进程,而且顶层页表是会被释放的:

deallocate_page_frames(

所以内存增加应该是别的原因导致的
@fslongjin

@MemoryShore
Copy link
Collaborator

我发现释放顶层页表前似乎没有释放下层页表?

@fslongjin
Copy link
Member Author

free在novashell中属于内置命令,不会开启新进程,而且顶层页表是会被释放的:

deallocate_page_frames(

所以内存增加应该是别的原因导致的
@fslongjin

哦哦,不过这个问题应该对于别的命令也存在的。比如ls命令。

root@DragonOS:/$ ls
[ WARN ] (src/syscall/mod.rs:869)        SYS_RT_SIGPROCMASK has not yet been implemented
[ WARN ] (src/syscall/mod.rs:869)        SYS_RT_SIGPROCMASK has not yet been implemented
[ WARN ] (src/syscall/mod.rs:869)        SYS_RT_SIGPROCMASK has not yet been implemented
[ WARN ] (src/syscall/mod.rs:869)        SYS_RT_SIGPROCMASK has not yet been implemented
[ WARN ] (src/syscall/mod.rs:869)        SYS_RT_SIGPROCMASK has not yet been implemented
[ WARN ] (src/syscall/mod.rs:869)        SYS_RT_SIGPROCMASK has not yet been implemented
bin   etc                   home     lib64      proc   sys  xxx.txt
boot  held.log              include  libexec    sbin   usr  xxx.txt.heldbak
dev   history_commands.txt  lib      miniature  share  var
[ WARN ] (src/syscall/mod.rs:884)        SYS_EXIT_GROUP has not yet been implemented
root@DragonOS:/$ free
        total           used            free            shared          cache_used      cache_free      available
Mem:    507332          51596           455736          0               0               0               0
root@DragonOS:/$ ls  
[ WARN ] (src/syscall/mod.rs:869)        SYS_RT_SIGPROCMASK has not yet been implemented
[ WARN ] (src/syscall/mod.rs:869)        SYS_RT_SIGPROCMASK has not yet been implemented
[ WARN ] (src/syscall/mod.rs:869)        SYS_RT_SIGPROCMASK has not yet been implemented
[ WARN ] (src/syscall/mod.rs:869)        SYS_RT_SIGPROCMASK has not yet been implemented
[ WARN ] (src/syscall/mod.rs:869)        SYS_RT_SIGPROCMASK has not yet been implemented
[ WARN ] (src/syscall/mod.rs:869)        SYS_RT_SIGPROCMASK has not yet been implemented
bin   etc                   home     lib64      proc   sys  xxx.txt
boot  held.log              include  libexec    sbin   usr  xxx.txt.heldbak
dev   history_commands.txt  lib      miniature  share  var
[ WARN ] (src/syscall/mod.rs:884)        SYS_EXIT_GROUP has not yet been implemented
root@DragonOS:/$ free
        total           used            free            shared          cache_used      cache_free      available
Mem:    507332          51744           455588          0               0               0               0
root@DragonOS:/$ ls  
[ WARN ] (src/syscall/mod.rs:869)        SYS_RT_SIGPROCMASK has not yet been implemented
[ WARN ] (src/syscall/mod.rs:869)        SYS_RT_SIGPROCMASK has not yet been implemented
[ WARN ] (src/syscall/mod.rs:869)        SYS_RT_SIGPROCMASK has not yet been implemented
[ WARN ] (src/syscall/mod.rs:869)        SYS_RT_SIGPROCMASK has not yet been implemented
[ WARN ] (src/syscall/mod.rs:869)        SYS_RT_SIGPROCMASK has not yet been implemented
[ WARN ] (src/syscall/mod.rs:869)        SYS_RT_SIGPROCMASK has not yet been implemented
bin   etc                   home     lib64      proc   sys  xxx.txt
boot  held.log              include  libexec    sbin   usr  xxx.txt.heldbak
dev   history_commands.txt  lib      miniature  share  var
[ WARN ] (src/syscall/mod.rs:884)        SYS_EXIT_GROUP has not yet been implemented
root@DragonOS:/$ free
        total           used            free            shared          cache_used      cache_free      available
Mem:    507332          51884           455448          0               0               0               0
root@DragonOS:/$ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mm Area: 内存管理子系统 bug-report 这是一个bug报告(如果确认是一个bug,请管理人员添加`bug` label) needs-triage 这个问题可能需要分类处理。如果已经完成分类,请移除它。
Projects
None yet
Development

No branches or pull requests

4 participants