Hello, On Wed, Mar 27, 2019 at 04:43:47PM -0300, Jason Gunthorpe wrote: > Well, at least I'm not super familiar with the block layer and > wouldn't know about this.. Yeah, conceptually it's not complex. Filesytem and IOs are needed to reclaim memory because we need to write back dirty pagecache and swap pages before reuse them for other purposes. Recursing on oneself obviously won't be great, so filesystems need to use GFP_NOFS and block layer below that needs to use GFP_NOIO. It's kinda unfortunate that network devices end up being pushed into this dependency chain but we do put them in memory reclaim path w/ nfs and block-over-network things, so it is what it is, I suppose. > But your explanation is helpful. I will be watching for WQ_MEM_RECLAIM > users that are allocating memory in their work functions. > > Would it be possible to have a lockdep-like debugging under kmalloc > similar to check_flush_dependency() that complains if a WQ_MEM_RECLAIM > work is doing inappropriate allocations? > > That would help discourage using it in WQ's it shouldn't be used on. Yeah, I was wondering whether that'd trigger warning. I don't think it does now. I fully agree it'd be great to have. Thanks. -- tejun