Hi Mikulas, Thanks for reviewing this.
I initially interpreted the goto retry path as being reachable after bio_alloc_lock was acquired. After rechecking mempool_alloc() in v6.1.66, I found that it returns NULL only without __GFP_DIRECT_RECLAIM. With that flag set, it waits and retries when the pool is empty. The first allocation failure happens before bio_alloc_lock is acquired, while the later allocation is performed with the mutex held and does not take the NULL retry path in normal process context. Therefore, I cannot justify the suspected double acquisition, and the refactoring provides no functional benefit. I will drop this patch. Regards, Runyu

