private void discardBlocksBruteForce(
      int freeListIx, int startArenaIx, int arenaCount, DiscardContext ctx) {
    // We are going to use this counter as a pseudo-random number for the start of the search.
    // This is to avoid churning at the beginning of the arena all the time.
    long counter = defragCounters[freeListIx].incrementAndGet();
    // How many blocks of this size comprise an arena.
    int positionsPerArena = 1 << (arenaSizeLog2 - (minAllocLog2 + freeListIx));
    // Compute the pseudo-random position from the above, then derive the actual header.
    int startHeaderIx = ((int) (counter % positionsPerArena)) << freeListIx;

    // Try to allocate using brute force approach from each arena.
    int arenaIx = startArenaIx;
    do {
      Arena arena = arenas[arenaIx];
      // Reserve blocks in this arena that would empty the sections of requisite size.
      arena.reserveDiscardBruteForce(freeListIx, ctx, startHeaderIx);
      // Discard the blocks.
      discardFromCtxBruteForce(arena, ctx, freeListIx);

      if (ctx.remainingToFind == 0) return; // Reserved as much as we needed.
      ctx.resetBetweenArenas();
      arenaIx = getNextIx(arenaIx, arenaCount, 1);
    } while (arenaIx != startArenaIx);
  }
The headers from abandoned moved attempts that cannot yet be returned to the
free lists, or unlocked due to some lock being held and deadlock potential.
llap-server/src/java/org/apache/hadoop/hive/llap/cache/BuddyAllocator.java