Re: [RFC] RDMA/umem: pin_user_pages*() can temporarily fail due to migration glitches

From: Matthew Wilcox
Date: Thu May 02 2024 - 14:45:23 EST


On Thu, May 02, 2024 at 03:34:08PM -0300, Jason Gunthorpe wrote:
> IMHO pin_user_pages() should sleep and spin in an interruptable sleep

killable, not interruptible. Otherwise SIGWINCH and SIGALRM can
result an early return.

> until we get all the migrations done. Not sure how hard it would be to
> add some kind of proper waiting event sleep?

ummmmm. We have a "has waiters" bit in the folio. So on every call to
folio_put(), we could check that bit and wake up any waiters. I need to
think about that; right now, we only use it for unlock and end_writeback.
Making folio_put() heavier is, well, quite a lot of call-sites.