Skip to content

Conversation

@donettom-1
Copy link
Contributor

When a non–page-aligned value is written to memory.max, the kernel aligns it down to the nearest page boundary. On systems with a page size greater than 4K (e.g., 64K), this caused failures because the configured memory.max value was not 64K aligned.

This patch fixes the issue by explicitly aligning the memory.max value to 64K. Since 64K is also a multiple of 4K, the value is correctly aligned on both 4K and 64K page size systems.

However, this approach will still fail on systems where the hardcoded memory.max value is not aligned to the system page size.

Fixes: #4841

When a non–page-aligned value is written to memory.max, the kernel aligns it
down to the nearest page boundary. On systems with a page size greater
than 4K (e.g., 64K), this caused failures because the configured
memory.max value was not 64K aligned.

This patch fixes the issue by explicitly aligning the memory.max value
to 64K. Since 64K is also a multiple of 4K, the value is correctly
aligned on both 4K and 64K page size systems.

However, this approach will still fail on systems where the hardcoded
memory.max value is not aligned to the system page size.

Fixes: opencontainers#4841

Signed-off-by: Vishal Chourasia <vishalc@linux.ibm.com>
Signed-off-by: Donet Tom <donettom@linux.ibm.com>
@ricardobranco777
Copy link

Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kolyshkin kolyshkin added backport/1.3-todo A PR in main branch which needs to be backported to release-1.3 backport/1.4-todo A PR in main branch which needs to backported to release-1.4 labels Sep 16, 2025
Copy link
Member

@rata rata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot for fixing those tests!

@rata rata enabled auto-merge September 17, 2025 07:08
@rata rata merged commit 184024d into opencontainers:main Sep 17, 2025
35 checks passed
@rata rata added backport/1.3-done A PR in main branch which has been backported to release-1.3 backport/1.4-done A PR in main branch which has been backported to release-1.4 and removed backport/1.3-todo A PR in main branch which needs to be backported to release-1.3 backport/1.4-todo A PR in main branch which needs to backported to release-1.4 labels Sep 17, 2025
@rata
Copy link
Member

rata commented Sep 17, 2025

@donettom-1 One thing I'm not sure I follow is: on systems with 64k page size, the value is round down to a 4k aligned and that is why it fails (it is still not 64k aligned)? Or why is this failing exactly on 64k page-size systems when we write something not 64k aligned?

@donettom-1
Copy link
Contributor Author

@donettom-1 One thing I'm not sure I follow is: on systems with 64k page size, the value is round down to a 4k aligned and that is why it fails (it is still not 64k aligned)? Or why is this failing exactly on 64k page-size systems when we write something not 64k aligned?

Previously, we were setting the value 20484096 for memory.max. This value is aligned to 4K, but not to 64K. On systems with a 64K page size, the kernel automatically rounds down any non–page size aligned value to the nearest page boundary. As a result, the value 20484096 was adjusted down to 20447232.

When the test read back memory.max, it observed 20447232 instead of the originally written 20484096, causing the mismatch and resulting in the test failure.

@rata
Copy link
Member

rata commented Sep 17, 2025

Ohhh, right! Heh, I'll blame that I wasn't fully awake. Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci backport/1.3-done A PR in main branch which has been backported to release-1.3 backport/1.4-done A PR in main branch which has been backported to release-1.4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

runc cgroups test fails on ppc64le

4 participants