From cda01491eb8712403df8edfbb4f1f7053bae6725 Mon Sep 17 00:00:00 2001 From: Adam Farley Date: Mon, 5 Feb 2024 13:03:55 +0000 Subject: [PATCH 1/8] Fix for unchecked concurrency We need to make sure we're not using so many cores that the tests are starved of memory. Signed-off-by: Adam Farley --- openjdk/openjdk.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openjdk/openjdk.mk b/openjdk/openjdk.mk index cf4323dc75..f1a396e6f5 100644 --- a/openjdk/openjdk.mk +++ b/openjdk/openjdk.mk @@ -20,7 +20,7 @@ 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 [ -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 / 1024`; if [ "$${KMEMMB}" -lt "$${CGMEMMB}" ]; then echo "$${KMEMMB}"; else echo "$${CGMEMMB}"; fi) endif ifeq ($(OS),Darwin) NPROCS:=$(shell sysctl -n hw.ncpu) From 61a56c4ff49ec64c031960b11ac717f88b6a8350 Mon Sep 17 00:00:00 2001 From: Adam Farley Date: Wed, 14 Feb 2024 11:58:20 +0000 Subject: [PATCH 2/8] Adjusting memory size math to compare bytes with bytes Instead of what it does right now, which is to compare bytes with kilobytes, and incorrectly assume that the kilobytes number is always smaller. Signed-off-by: Adam Farley --- openjdk/openjdk.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openjdk/openjdk.mk b/openjdk/openjdk.mk index f1a396e6f5..bea8d96feb 100644 --- a/openjdk/openjdk.mk +++ b/openjdk/openjdk.mk @@ -20,7 +20,7 @@ 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 / 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 [ -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 \* 1024`; fi; CGMEMMB=`expr $${CGMEM} / 1024 / 1024`; if [ "$${KMEMMB}" -lt "$${CGMEMMB}" ]; then echo "$${KMEMMB}"; else echo "$${CGMEMMB}"; fi) endif ifeq ($(OS),Darwin) NPROCS:=$(shell sysctl -n hw.ncpu) From 54baab16e4b9a1d2c6f24e1768d2df957ee1e1cb Mon Sep 17 00:00:00 2001 From: Adam Farley Date: Wed, 14 Feb 2024 14:54:59 +0000 Subject: [PATCH 3/8] Updating memory limit check to allow cgroup V2 compatability In cgroup v1 we used memory.limit_in_bytes to store the maximum memory allocated to the container. In v2, we use memory.max. This change allows us to check for both, includes a meminfo check for non-containers, and adds a few debug comments so we can be sure this new code is working. My plan is to run tests on a diverse set of machines, and to remove the debug statements prior to merging. Signed-off-by: Adam Farley --- openjdk/openjdk.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openjdk/openjdk.mk b/openjdk/openjdk.mk index bea8d96feb..4f845695ea 100644 --- a/openjdk/openjdk.mk +++ b/openjdk/openjdk.mk @@ -20,7 +20,7 @@ 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 \* 1024`; fi; CGMEMMB=`expr $${CGMEM} / 1024 / 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 [[ -r /sys/fs/cgroup/memory.max && $(cat /sys/fs/cgroup/memory.max) =~ ^[0-9]+$ ]]; then CGMEM=`cat /sys/fs/cgroup/memory.max`; echo "DEBUG: Using memory.max to calculate concurrency."; elif [[ -r /sys/fs/cgroup/memory/memory.limit_in_bytes && $(cat /sys/fs/cgroup/memory/memory.limit_in_bytes) =~ ^[0-9]+$ ]]; then CGMEM=`cat /sys/fs/cgroup/memory/memory.limit_in_bytes`; echo "DEBUG: Using memory.limit_in_bytes to calculate concurrency."; else CGMEM=`expr $${KMEMMB} \* 1024 \* 1024`; echo "DEBUG: Using /proc/meminfo to calculate concurrency."; fi; CGMEMMB=`expr $${CGMEM} / 1024 / 1024`; if [ "$${KMEMMB}" -lt "$${CGMEMMB}" ]; then echo "$${KMEMMB}"; else echo "$${CGMEMMB}"; fi) endif ifeq ($(OS),Darwin) NPROCS:=$(shell sysctl -n hw.ncpu) From 7b6dc174baad78402b9a18c96c79bcf3acd9ef09 Mon Sep 17 00:00:00 2001 From: Adam Farley Date: Wed, 14 Feb 2024 16:50:41 +0000 Subject: [PATCH 4/8] Include docker check and cgroup version check To ensure we're looking in the correct file for the maximum memory size. Also to handle permissions issues, empty files, etc. Signed-off-by: Adam Farley --- openjdk/openjdk.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openjdk/openjdk.mk b/openjdk/openjdk.mk index 4f845695ea..6d8ec1f8ad 100644 --- a/openjdk/openjdk.mk +++ b/openjdk/openjdk.mk @@ -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.max && $(cat /sys/fs/cgroup/memory.max) =~ ^[0-9]+$ ]]; then CGMEM=`cat /sys/fs/cgroup/memory.max`; echo "DEBUG: Using memory.max to calculate concurrency."; elif [[ -r /sys/fs/cgroup/memory/memory.limit_in_bytes && $(cat /sys/fs/cgroup/memory/memory.limit_in_bytes) =~ ^[0-9]+$ ]]; then CGMEM=`cat /sys/fs/cgroup/memory/memory.limit_in_bytes`; echo "DEBUG: Using memory.limit_in_bytes to calculate concurrency."; else CGMEM=`expr $${KMEMMB} \* 1024 \* 1024`; echo "DEBUG: Using /proc/meminfo to calculate concurrency."; fi; CGMEMMB=`expr $${CGMEM} / 1024 / 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) + endif ifeq ($(OS),Darwin) NPROCS:=$(shell sysctl -n hw.ncpu) From 65ec46dd24e1d3d5e3c970912612cad712124615 Mon Sep 17 00:00:00 2001 From: Adam Farley Date: Wed, 14 Feb 2024 16:51:59 +0000 Subject: [PATCH 5/8] Exporting debug message Signed-off-by: Adam Farley --- openjdk/openjdk.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openjdk/openjdk.mk b/openjdk/openjdk.mk index 6d8ec1f8ad..1f6b8564db 100644 --- a/openjdk/openjdk.mk +++ b/openjdk/openjdk.mk @@ -23,7 +23,7 @@ ifeq ($(OS),Linux) 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) From ef689c4dd2eb398276273db9c19cee6aa1b8273c Mon Sep 17 00:00:00 2001 From: Adam Farley Date: Thu, 15 Feb 2024 15:48:49 +0000 Subject: [PATCH 6/8] Switching back to file existance checks for simplicity Makes it easier to maintain, and more resilient to failure. I've also added a commented, formatted copy of the script to help people read it in the future. Signed-off-by: Adam Farley --- openjdk/openjdk.mk | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/openjdk/openjdk.mk b/openjdk/openjdk.mk index 1f6b8564db..ac585d6d46 100644 --- a/openjdk/openjdk.mk +++ b/openjdk/openjdk.mk @@ -20,10 +20,37 @@ ARCH:=$(shell uname -m) ifeq ($(OS),Linux) NPROCS:=$(shell nproc) - 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)) + // This is the MEMORY_SIZE script below, with formatting for readability. + // + // // The number of megabytes of memory this machine has. + // KMEMMB=`awk '/^MemTotal:/{print int($$2/1024)}' /proc/meminfo`; + // + // // If this machine/container uses cgroups to limit the amount of + // // memory available to us, we should use that as out memory size. + // if [[ -r /sys/fs/cgroup/memory.max ]]; then + // // Use this to identify memory maximum (bytes) for cgroup v2. + // CGMEM=`cat /sys/fs/cgroup/memory.max 2>1`; + // else + // // Else use this file for memory maximum (bytes) on cgroup v1. + // CGMEM=`cat /sys/fs/cgroup/memory/memory.limit_in_bytes 2>1`; + // fi; + // + // // If those files were empty, or didn't exist, or had non-numbers + // // in them, then use /proc/meminfo (converted to bytes). + // if [[ ! $$(CGMEM) =~ ^[0-9]+$$ ]]; then + // CGMEM=`expr $${KMEMMB} \* 1024 \* 1024`; + // fi; + // + // CGMEMMB=`expr $${CGMEM} / 1024 / 1024`; + // + // // Between memory limits in the cgroup and memory on the machine, + // // use the lower limit. This protects us against situations + // // where the cgroup has a value which is much bigger/smaller than + // // the limits on the machine overall. We've seen both. + // if [ "$${KMEMMB}" -lt "$${CGMEMMB}" ]; then + // echo "$${KMEMMB}"; else echo "$${CGMEMMB}"; + // fi + MEMORY_SIZE:=$(shell KMEMMB=`awk '/^MemTotal:/{print int($$2/1024)}' /proc/meminfo`; if [[ -r /sys/fs/cgroup/memory.max ]]; then CGMEM=`cat /sys/fs/cgroup/memory.max 2>1`; else CGMEM=`cat /sys/fs/cgroup/memory/memory.limit_in_bytes 2>1`; 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) endif ifeq ($(OS),Darwin) NPROCS:=$(shell sysctl -n hw.ncpu) From 2ec2b02809c5129b98265481bf0683c019c22de4 Mon Sep 17 00:00:00 2001 From: Adam Farley Date: Thu, 15 Feb 2024 15:56:06 +0000 Subject: [PATCH 7/8] Correcting comment symbol. Typo. Signed-off-by: Adam Farley --- openjdk/openjdk.mk | 60 +++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/openjdk/openjdk.mk b/openjdk/openjdk.mk index ac585d6d46..63e3210621 100644 --- a/openjdk/openjdk.mk +++ b/openjdk/openjdk.mk @@ -20,36 +20,36 @@ ARCH:=$(shell uname -m) ifeq ($(OS),Linux) NPROCS:=$(shell nproc) - // This is the MEMORY_SIZE script below, with formatting for readability. - // - // // The number of megabytes of memory this machine has. - // KMEMMB=`awk '/^MemTotal:/{print int($$2/1024)}' /proc/meminfo`; - // - // // If this machine/container uses cgroups to limit the amount of - // // memory available to us, we should use that as out memory size. - // if [[ -r /sys/fs/cgroup/memory.max ]]; then - // // Use this to identify memory maximum (bytes) for cgroup v2. - // CGMEM=`cat /sys/fs/cgroup/memory.max 2>1`; - // else - // // Else use this file for memory maximum (bytes) on cgroup v1. - // CGMEM=`cat /sys/fs/cgroup/memory/memory.limit_in_bytes 2>1`; - // fi; - // - // // If those files were empty, or didn't exist, or had non-numbers - // // in them, then use /proc/meminfo (converted to bytes). - // if [[ ! $$(CGMEM) =~ ^[0-9]+$$ ]]; then - // CGMEM=`expr $${KMEMMB} \* 1024 \* 1024`; - // fi; - // - // CGMEMMB=`expr $${CGMEM} / 1024 / 1024`; - // - // // Between memory limits in the cgroup and memory on the machine, - // // use the lower limit. This protects us against situations - // // where the cgroup has a value which is much bigger/smaller than - // // the limits on the machine overall. We've seen both. - // if [ "$${KMEMMB}" -lt "$${CGMEMMB}" ]; then - // echo "$${KMEMMB}"; else echo "$${CGMEMMB}"; - // fi + # This is the MEMORY_SIZE script below, with formatting for readability. + # + # // The number of megabytes of memory this machine has. + # KMEMMB=`awk '/^MemTotal:/{print int($$2/1024)}' /proc/meminfo`; + # + # // If this machine/container uses cgroups to limit the amount of + # // memory available to us, we should use that as out memory size. + # if [[ -r /sys/fs/cgroup/memory.max ]]; then + # // Use this to identify memory maximum (bytes) for cgroup v2. + # CGMEM=`cat /sys/fs/cgroup/memory.max 2>1`; + # else + # // Else use this file for memory maximum (bytes) on cgroup v1. + # CGMEM=`cat /sys/fs/cgroup/memory/memory.limit_in_bytes 2>1`; + # fi; + # + # // If those files were empty, or didn't exist, or had non-numbers + # // in them, then use /proc/meminfo (converted to bytes). + # if [[ ! $$(CGMEM) =~ ^[0-9]+$$ ]]; then + # CGMEM=`expr $${KMEMMB} \* 1024 \* 1024`; + # fi; + # + # CGMEMMB=`expr $${CGMEM} / 1024 / 1024`; + # + # // Between memory limits in the cgroup and memory on the machine, + # // use the lower limit. This protects us against situations + # // where the cgroup has a value which is much bigger/smaller than + # // the limits on the machine overall. We've seen both. + # if [ "$${KMEMMB}" -lt "$${CGMEMMB}" ]; then + # echo "$${KMEMMB}"; else echo "$${CGMEMMB}"; + # fi MEMORY_SIZE:=$(shell KMEMMB=`awk '/^MemTotal:/{print int($$2/1024)}' /proc/meminfo`; if [[ -r /sys/fs/cgroup/memory.max ]]; then CGMEM=`cat /sys/fs/cgroup/memory.max 2>1`; else CGMEM=`cat /sys/fs/cgroup/memory/memory.limit_in_bytes 2>1`; 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) endif ifeq ($(OS),Darwin) From 923e67e8b73c7fc191f801a1397cb1bb21165938 Mon Sep 17 00:00:00 2001 From: Adam Farley Date: Fri, 16 Feb 2024 16:17:00 +0000 Subject: [PATCH 8/8] Switching to curley braces to access variable value Signed-off-by: Adam Farley --- openjdk/openjdk.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openjdk/openjdk.mk b/openjdk/openjdk.mk index 63e3210621..499529875f 100644 --- a/openjdk/openjdk.mk +++ b/openjdk/openjdk.mk @@ -50,7 +50,7 @@ ifeq ($(OS),Linux) # if [ "$${KMEMMB}" -lt "$${CGMEMMB}" ]; then # echo "$${KMEMMB}"; else echo "$${CGMEMMB}"; # fi - MEMORY_SIZE:=$(shell KMEMMB=`awk '/^MemTotal:/{print int($$2/1024)}' /proc/meminfo`; if [[ -r /sys/fs/cgroup/memory.max ]]; then CGMEM=`cat /sys/fs/cgroup/memory.max 2>1`; else CGMEM=`cat /sys/fs/cgroup/memory/memory.limit_in_bytes 2>1`; 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) + MEMORY_SIZE:=$(shell KMEMMB=`awk '/^MemTotal:/{print int($$2/1024)}' /proc/meminfo`; if [[ -r /sys/fs/cgroup/memory.max ]]; then CGMEM=`cat /sys/fs/cgroup/memory.max 2>1`; else CGMEM=`cat /sys/fs/cgroup/memory/memory.limit_in_bytes 2>1`; 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) endif ifeq ($(OS),Darwin) NPROCS:=$(shell sysctl -n hw.ncpu)