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

{bp-15159} fs/shm/shmfs_alloc.c: Allocate zero-initialized memory in flat build #15172

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

jerpelea
Copy link
Contributor

Summary

POSIX requires that the shm objects are zero-initialized. This has been broken in some earlier commits (starting from 9af5fc5)

Also fix the flat build memory allocation to allocate both object data and payload in the same chunk (as the comment also suggests). This saves allocations and memory in a system with lots of shm objects.

This PR fixes errors in applications, which run in "CONFIG_BUILD_FLAT", and assume that newly allocated shared memory is zero-initialized.

This also reduces memory consumption in smaller devices, when each shared memory object is allocated in a single chunk as originally.

The errors were introduced earlier when the SHM allocations were cache-line aligned.

NOTE
included
#15167

Impact

RELEASE

Testing

CI

jlaitine and others added 2 commits December 13, 2024 09:07
POSIX requires that the shm objects are zero-initialized. This has been broken
in some earlier commits (starting from 9af5fc5)

Also fix the flat build memory allocation to allocate both object data and payload
in the same chunk (as the comment also suggests). This saves allocations and memory
in a system with lots of shm objects.

Signed-off-by: Jukka Laitinen <[email protected]>
…uring mounting when fat is corrupted

Check fs_fatsecperclus' value when read from eMMC device. Return an error if it is zero.

Signed-off-by: Yinzhe Wu <[email protected]>
Reviewed-by: Jacky Cao <[email protected]>
Tested-by: Yinzhe Wu <[email protected]>
@github-actions github-actions bot added Area: File System File System issues Size: S The size of the change in this PR is small labels Dec 13, 2024
@nuttxpr
Copy link

nuttxpr commented Dec 13, 2024

[Experimental Bot, please feedback here]

Yes, this PR appears to meet the NuttX requirements. It clearly outlines the problem (POSIX violation and inefficient memory usage), the solution (zero-initialization and consolidated memory allocation), and the impact (fixes application errors, reduces memory consumption). The testing section, while brief, indicates CI testing was performed, which is acceptable if the CI system is robust. The explicit mention of "RELEASE" under Impact suggests this is a significant change potentially affecting users, so more detailed testing information might be beneficial if available. Referencing the related PR is also helpful for context.

@xiaoxiang781216 xiaoxiang781216 merged commit 90870ae into apache:releases/12.8 Dec 13, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: File System File System issues Size: S The size of the change in this PR is small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants