On Tue, Aug 01, 2023 at 02:01:59AM +0100, Matthew Wilcox wrote: > On Mon, Jul 31, 2023 at 06:49:45PM -0600, Jens Axboe wrote: > > On 7/31/23 6:47?PM, Matthew Wilcox wrote: > > > On Mon, Jul 31, 2023 at 06:28:02PM -0600, Jens Axboe wrote: > > >> It's also not an absolute thing, like memory allocations are. It's > > >> perfectly fine to grab a mutex under NOWAIT issue. What you should not > > >> do is grab a mutex that someone else can grab while waiting on IO. This > > >> kind of extra context is only available in the code in question, not > > >> generically for eg mutex locking. > > > > > > Is that information documented somewhere? I didn't know that was the > > > rule, and I wouldn't be surprised if that's news to several of the other > > > people on this thread. > > > > I've mentioned it in various threads, but would probably be good to > > write down somewhere if that actually makes more people see it. I'm > > dubious, but since it applies to NOWAIT in general, would be a good > > thing to do regardless. And then at least I could point to that rather > > than have to write up a long description every time. > > Would be good to include whether it's OK to wait on a mutex that's held > by another thread that's allocating memory without __GFP_NOFS (since > obviously that can block on I/O) And adding a few illustrative examples would be helpful.