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

[smart] fixup of lwp recycling and mm varea #8206

Merged
merged 3 commits into from
Nov 2, 2023

Conversation

polarvid
Copy link
Contributor

@polarvid polarvid commented Oct 31, 2023

拉取/合并请求描述:(PR description)

[

为什么提交这份PR (why to submit this PR)

The previous implementation of lwp recycling is all done in lwp_free(),
which suspends the parent process for a long time in wait(2) until all the resources
is released, especially that lwp_free() is running on a defunct thread with
a extremely low priority.

If the parent process never wait for its children, all the resources is holding
until the parent process exits, which decreases the throughput of the system.

你的解决方案是什么 (what is your solution)

This patch includes:

  • Separate the process of lwp recycling into 2 phases
  • Codes cleanup in mm_object.c & mm_anon.c
  • Fix the data racing problem in pid/tid management

在什么测试环境下测试通过 (what is the test environment)

]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification

@polarvid polarvid force-pushed the shell/fix-pr8141-rc branch 2 times, most recently from 1666d91 to 8f9c70b Compare October 31, 2023 09:45
@polarvid polarvid marked this pull request as ready for review October 31, 2023 10:08
@polarvid polarvid requested a review from geniusgogo October 31, 2023 10:14
@BernardXiong BernardXiong added +1 Agree +1 wait_+2 wait for "+2" to confirm labels Oct 31, 2023
@polarvid polarvid force-pushed the shell/fix-pr8141-rc branch from 8f9c70b to 350a239 Compare November 2, 2023 10:49
polarvid and others added 3 commits November 2, 2023 18:49
Co-authored-by: xqyjlj <[email protected]>
Signed-off-by: shell <[email protected]>
feat: cleanup recycling routine of lwp.
The tty is not recycled on exit() currenttly. This patch add a new
layer of resource recycling including address space, fd tables, etc.
Also, the pid is allocated from parent proc, so it's much reasonable to
recycle the pid in parent process. So it's moved to waitpid() now.

fixup: trap fixup in normal context

Signed-off-by: Shell <[email protected]>
feat: moving varea pgmgr to anon.
Page manager is only a internal structure of anonymous mapping
currently. So it's moved to mm_anon.c now.
This patch also includes a bug fix of extra cleanup of varea in page
manager while doing varea_merge operations.

feat: remove restriction on page install

fixup: mm test case.
Using the assertion uassert_true(!(lwp_ref_dec(lwp) - 1)) instead of
uassert_true(!(lwp_ref_dec(lwp))) since the lwp_ref_dev returns the
previous value of the lwp reference

Signed-off-by: Shell <[email protected]>
@polarvid polarvid force-pushed the shell/fix-pr8141-rc branch from 350a239 to e2530f8 Compare November 2, 2023 10:49
@BernardXiong BernardXiong merged commit c2036e7 into RT-Thread:master Nov 2, 2023
37 checks passed
@polarvid polarvid deleted the shell/fix-pr8141-rc branch November 3, 2023 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wait_+2 wait for "+2" to confirm +1 Agree +1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants