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

vm: test uses thread-unsafe _page_free() #1080

Closed
niewim19 opened this issue May 20, 2024 · 0 comments · Fixed by phoenix-rtos/phoenix-rtos-kernel#550
Closed

vm: test uses thread-unsafe _page_free() #1080

niewim19 opened this issue May 20, 2024 · 0 comments · Fixed by phoenix-rtos/phoenix-rtos-kernel#550
Labels

Comments

@niewim19
Copy link
Contributor

niewim19 commented May 20, 2024

Inside the following test:phoenix-rtos-kernel/test/vm.c:test_vm_alloc() unlocked version of page deallocation function _page_free() is used.
Here: https://github.com/phoenix-rtos/phoenix-rtos-kernel/blob/509945e05ee1da4c22bde4ec1833007c17711306/test/vm.c#L53

Inside this test's body, page was allocated using locked allocation function. Is it then necessary to deallocate it using unlocked one? This is the only usage of _page_free() outside of phoenix-rtos-kernel/vm/page.c which seems as the only reason _page_free() is not made static. And as there already is locked version of page deallocation phoenix-rtos-kernel/vm/page.c:vm_pageFree() (https://github.com/phoenix-rtos/phoenix-rtos-kernel/blob/509945e05ee1da4c22bde4ec1833007c17711306/vm/page.c#L153C28-L159) it would seem reasonable to:

  • use locked page deallocation function in test body
  • made phoenix-rtos-kernel/vm/page.c:_page_free() static
  • adhere to naming convention with the following change: _page_free() -> _pageFree()

Note: this issue is also mirrored in nommu version of page module: phoenix-rtos-kernel/vm/page-nommu.c

astalke added a commit to phoenix-rtos/phoenix-rtos-kernel that referenced this issue May 21, 2024
- Remove unreachable function `vm_pageFreeAt`
- Merge `_page_free` and `vm_pageFree`

Fixes: phoenix-rtos/phoenix-rtos-project#1080
Fixes: phoenix-rtos/phoenix-rtos-project#1082

JIRA: RTOS-836
astalke added a commit to phoenix-rtos/phoenix-rtos-kernel that referenced this issue May 24, 2024
- Remove unreachable function `vm_pageFreeAt`
- Merge `_page_free` and `vm_pageFree`

Fixes: phoenix-rtos/phoenix-rtos-project#1080
Fixes: phoenix-rtos/phoenix-rtos-project#1082

JIRA: RTOS-836
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant