Re: [PATCH v2 1/4] mm/filemap: Add folio_lock_timeout()

Hillf Danton
2023-04-22T05:19:18Z

On 21 Apr 2023 15:12:45 -0700 Douglas Anderson <dianders@chromium.org>
> Add a variant of folio_lock() that can timeout. This is useful to
> avoid unbounded waits for the page lock in kcompactd.

Given no mutex_lock_timeout() (perhaps because timeout makes no sense for
spinlock), I suspect your fix lies in the right layer. If waiting for
page under IO causes trouble for you, another simpler option is make
IO faster (perhaps all you can do) for instance. If kcompactd is waken
up by kswapd, waiting for slow IO is the right thing to do.