@@ -121,7 +121,6 @@ private static BitSet getReservedAffinity0() {
121121 reserverable .set (1 , PROCESSORS , true );
122122 reserverable .andNot (BASE_AFFINITY );
123123 if (reserverable .isEmpty () && PROCESSORS > 1 ) {
124- LoggerFactory .getLogger (AffinityLock .class ).info ("No isolated CPUs found, so assuming CPUs 1 to {} available." , (PROCESSORS - 1 ));
125124 // make all but first CPUs available
126125 reserverable .set (1 , PROCESSORS );
127126 return reserverable ;
@@ -149,6 +148,14 @@ public static AffinityLock acquireLock() {
149148 return acquireLock (true );
150149 }
151150
151+ static class Warnings {
152+ static void warmNoReservedCPUs () {
153+ if (RESERVED_AFFINITY .isEmpty () && PROCESSORS > 1 ) {
154+ LoggerFactory .getLogger (AffinityLock .class ).info ("No isolated CPUs found, so assuming CPUs 1 to {} available." , (PROCESSORS - 1 ));
155+ }
156+ }
157+ }
158+
152159 /**
153160 * Assign any free core to this thread. <p> In reality, only one cpu is assigned, the rest of
154161 * the threads for that core are reservable so they are not used.
@@ -294,6 +301,7 @@ public static AffinityLock acquireCore(boolean bind) {
294301 }
295302
296303 private static AffinityLock acquireLock (boolean bind , int cpuId , @ NotNull AffinityStrategy ... strategies ) {
304+ Warnings .warmNoReservedCPUs ();
297305 return LOCK_INVENTORY .acquireLock (bind , cpuId , strategies );
298306 }
299307
@@ -310,6 +318,7 @@ private static AffinityLock tryAcquireLock(boolean bind, int cpuId) {
310318 }
311319
312320 private static AffinityLock acquireCore (boolean bind , int cpuId , @ NotNull AffinityStrategy ... strategies ) {
321+ Warnings .warmNoReservedCPUs ();
313322 return LOCK_INVENTORY .acquireCore (bind , cpuId , strategies );
314323 }
315324
0 commit comments