### 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
return Math.min(machineMemory - jvmSize - OS_OVERHEAD, machineMemory * 9 / 10);
        }
        
        return machineMemory * maxMemoryPercent / 100;
    }
    public static long allowedBytesForMl(long machineMemory, int maxMemoryPercent, boolean useAuto) {
        return allowedBytesForMl(
            machineMemory,
            useAuto ? dynamicallyCalculateJvmSizeFromNodeSize(machineMemory) : Math.min(machineMemory / 2, STATIC_JVM_UPPER_THRESHOLD),
            maxMemoryPercent,
            useAuto
        );
    }
    public static long dynamicallyCalculateJvmSizeFromNodeSize(long nodeSize) {
        
        
        if (nodeSize <= JVM_SIZE_KNOT_POINT) {
            return ((long) (nodeSize * 0.4) / BYTES_IN_4MB) * BYTES_IN_4MB;
        }
        return Math.min(
            ((long) (JVM_SIZE_KNOT_POINT * 0.4 + (nodeSize - JVM_SIZE_KNOT_POINT) * 0.1) / BYTES_IN_4MB) * BYTES_IN_4MB,
            STATIC_JVM_UPPER_THRESHOLD
        );
    }
    public static long dynamicallyCalculateJvmSizeFromMlNativeMemorySize(long nativeMachineMemory) {