imbajin commented on code in PR #3325:
URL: https://github.com/apache/hugegraph/pull/3325#discussion_r4253760289
##########
hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh:
##########
@@ -497,22 +497,67 @@ function cgroup_free_memory() {
dir="${dir%/}"
fi
local limit usage inactive available smallest=""
+ local child child_min
local cache_key=inactive_file
- [[ "$version" != cgroup ]] || cache_key=total_inactive_file
+ local unlimited="" long_bits="" page_size=""
+ if [[ "$version" == cgroup ]]; then
+ cache_key=total_inactive_file
+ # v1 exposes PAGE_COUNTER_MAX * PAGE_SIZE instead of "max".
+ long_bits=$(getconf LONG_BIT 2>/dev/null) || true
Review Comment:
⚠️ Minor — Derive the v1 sentinel from kernel word size
Blocking: no. Summary: With a 32-bit `getconf` on a 64-bit kernel, this
chooses a cutoff of about 8 TiB (4 KiB pages). The later `limit >= cutoff`
check then also skips real finite cgroup v1 limits above that value; near such
a cap, the launcher can fall back to host sizing and choose an Xmx larger than
the remaining cgroup budget. Please derive the cutoff from kernel width or
distinguish the actual sentinel from large finite limits.
Evidence: Linux defines `PAGE_COUNTER_MAX` using kernel `BITS_PER_LONG`, so
its 64-bit v1 sentinel is about 8 EiB even under 32-bit userspace
([definition](https://github.com/torvalds/linux/blob/master/include/linux/page_counter.h#L481-L488)).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]