> As Ted mentioned, Ext4 has never guaranteed deterministic allocation. We > do attempt a predetermined goal in ext4_mb_find_by_goal(), and this part > has no trylock logic, meaning we'll always attempt to scan the target > group once—that's deterministic. > > However, if the target attempt fails, the primary goal for subsequent > allocation is to find suitable free space as quickly as possible, so > there's no need to contend with other processes for non-target groups. If you want to do it as quickly as possible then trylock is also not a good strategy. It requires moving the cache line of the lock from EXCLUSIVE (on the owning CPU) to SHARED and then later back to unlock, which all require slow communication. On a large system or with contention you will still observe considerable latencies. Better to figure out a scheme that doesn't require touching the lock at all. -Andi