### CI Link

https://gradle-enterprise.elastic.co/s/znzaabr7xk2nq

### Repro line
```
./gradlew ':x-pack:plugin:ml:test' --tests "org.elasticsearch.xpack.ml.utils.NativeMemoryCalculatorTests.testActualNodeSizeCalculationConsistency" -Dtests.seed=A70DC496F83A52CF
```

### Does it reproduce?

Yes

### Applicable branches

main

### Failure history

_No response_

### Failure excerpt

```java
org.elasticsearch.xpack.ml.utils.NativeMemoryCalculatorTests > testActualNodeSizeCalculationConsistency FAILED
    java.lang.AssertionError: native memory [113246208] smaller than original native memory [113669306]
    Expected: a value equal to or greater than <113669305L>
         but: <113246208L> was less than <113669305L>
        at __randomizedtesting.SeedInfo.seed([A70DC496F83A52CF:8204CD95D7187768]:0)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
        at org.junit.Assert.assertThat(Assert.java:956)
        at org.elasticsearch.xpack.ml.utils.NativeMemoryCalculatorTests.lambda$testActualNodeSizeCalculationConsistency$0(NativeMemoryCalculatorTests.java:170)
        at org.elasticsearch.xpack.ml.utils.NativeMemoryCalculatorTests.testActualNodeSizeCalculationConsistency(NativeMemoryCalculatorTests.java:207)
```

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/utils/NativeMemoryCalculator.java
long nativeAndOverhead = nativeMachineMemory + OS_OVERHEAD;
        long higherAnswer;
        if (nativeAndOverhead <= (JVM_SIZE_KNOT_POINT - dynamicallyCalculateJvmSizeFromNodeSize(JVM_SIZE_KNOT_POINT))) {
            higherAnswer = (nativeAndOverhead * 2 / 3 / BYTES_IN_4MB) * BYTES_IN_4MB;
        } else {
            double nativeAndOverheadAbove16GB = nativeAndOverhead - JVM_SIZE_KNOT_POINT * 0.6;
            higherAnswer = ((long) (JVM_SIZE_KNOT_POINT * 0.4 + nativeAndOverheadAbove16GB / 0.9 * 0.1) / BYTES_IN_4MB) * BYTES_IN_4MB;
        }
        
        
        
        
        
        
        
        if (higherAnswer > BYTES_IN_4MB) {
            long lowerAnswer = higherAnswer - BYTES_IN_4MB;
            long nodeSizeImpliedByLowerAnswer = nativeAndOverhead + lowerAnswer;
            if (dynamicallyCalculateJvmSizeFromNodeSize(nodeSizeImpliedByLowerAnswer) == lowerAnswer) {
                return Math.min(lowerAnswer, STATIC_JVM_UPPER_THRESHOLD);
            }
        }
        return Math.min(higherAnswer, STATIC_JVM_UPPER_THRESHOLD);