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

Refine concurrency logic #5063

Merged
merged 8 commits into from
Feb 16, 2024
5 changes: 4 additions & 1 deletion openjdk/openjdk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ ARCH:=$(shell uname -m)

ifeq ($(OS),Linux)
NPROCS:=$(shell nproc)
MEMORY_SIZE:=$(shell KMEMMB=`awk '/^MemTotal:/{print int($$2/1024)}' /proc/meminfo`; if [ -r /sys/fs/cgroup/memory/memory.limit_in_bytes ]; then CGMEM=`cat /sys/fs/cgroup/memory/memory.limit_in_bytes`; else CGMEM=`expr $${KMEMMB} \* 1024`; fi; CGMEMMB=`expr $${CGMEM} / 1024`; if [ "$${KMEMMB}" -lt "$${CGMEMMB}" ]; then echo "$${KMEMMB}"; else echo "$${CGMEMMB}"; fi)
MEMORY_SIZE:=$(shell KMEMMB=`awk '/^MemTotal:/{print int($$2/1024)}' /proc/meminfo`; if [[ -f "/.dockerenv" ]]; then CGRPV=`stat -f --format '%T' /sys/fs/cgroup`; if [[ "_$$CGRPV" == "_cgroup2fs" ]]; then CGMEM=`cat /sys/fs/cgroup/memory.max 2>1`; elif [[ "_$$CGRPV" == "_tmpfs" ]]; then CGMEM=`cat /sys/fs/cgroup/memory/memory.limit_in_bytes 2>1`; fi; fi; if [[ ! $$(CGMEM) =~ ^[0-9]+$$ ]]; then CGMEM=`expr $${KMEMMB} \* 1024 \* 1024`; fi; CGMEMMB=`expr $${CGMEM} / 1024 / 1024`; if [ "$${KMEMMB}" -lt "$${CGMEMMB}" ]; then echo "$${KMEMMB}"; else echo "$${CGMEMMB}"; fi)
//debug code
MEMORY_DEBUG:=$(shell KMEMMB=`awk '/^MemTotal:/{print int($$2/1024)}' /proc/meminfo`; if [[ -f "/.dockerenv" ]]; then CGRPV=`stat -f --format '%T' /sys/fs/cgroup`; echo "DEBUG10 $$(CGPRV) "; if [[ "_$$CGRPV" == "_cgroup2fs" ]]; then CGMEM=`cat /sys/fs/cgroup/memory.max 2>1`; echo "DEBUG11 $$(CGMEM) "; elif [[ "_$$CGRPV" == "_tmpfs" ]]; then CGMEM=`cat /sys/fs/cgroup/memory/memory.limit_in_bytes 2>1`; echo "DEBUG12 $$(CGMEM) "; fi; fi; if [[ ! $$(CGMEM) =~ ^[0-9]+$$ ]]; then CGMEM=`expr $${KMEMMB} \* 1024 \* 1024`; echo "DEBUG13 $$(CGMEM) "; fi; CGMEMMB=`expr $${CGMEM} / 1024 / 1024`; if [ "$${KMEMMB}" -lt "$${CGMEMMB}" ]; then echo "$${KMEMMB}"; else echo "$${CGMEMMB}"; fi)
$(warning $(MEMORY_DEBUG))
endif
ifeq ($(OS),Darwin)
NPROCS:=$(shell sysctl -n hw.ncpu)
Expand Down