Message ID | 20240321032747.87694-12-wangkefeng.wang@huawei.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | mm: migrate: support poison recover from migrate folio | expand |
On Thu, Mar 21, 2024 at 11:27:47AM +0800, Kefeng Wang wrote: > Since large folio copy could spend lots of time and it is involved with > a cond_resched(), the aio couldn't support migrate large folio as it takes > a spin lock when folio copy, add explicit check for large folio and return > err directly. This is unnecessary. aio only allocates order-0 folios (it uses find_or_create_page() to do it). If you want to take on converting aio to use folios instead of pages, that'd be a worthwhile project.
On 2024/3/21 11:35, Matthew Wilcox wrote: > On Thu, Mar 21, 2024 at 11:27:47AM +0800, Kefeng Wang wrote: >> Since large folio copy could spend lots of time and it is involved with >> a cond_resched(), the aio couldn't support migrate large folio as it takes >> a spin lock when folio copy, add explicit check for large folio and return >> err directly. > > This is unnecessary. aio only allocates order-0 folios (it uses > find_or_create_page() to do it). Yes, only order-0 now, I will drop it. > > If you want to take on converting aio to use folios instead of pages, > that'd be a worthwhile project. OK, will try, thanks for your review. >
diff --git a/fs/aio.c b/fs/aio.c index 9783bb5d81e7..0391ef58c564 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -411,6 +411,10 @@ static int aio_migrate_folio(struct address_space *mapping, struct folio *dst, pgoff_t idx; int rc = 0; + /* Large folios aren't supported */ + if (folio_test_large(src)) + return -EINVAL; + /* mapping->i_private_lock here protects against the kioctx teardown. */ spin_lock(&mapping->i_private_lock); ctx = mapping->i_private_data;
Since large folio copy could spend lots of time and it is involved with a cond_resched(), the aio couldn't support migrate large folio as it takes a spin lock when folio copy, add explicit check for large folio and return err directly. Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> --- fs/aio.c | 4 ++++ 1 file changed, 4 insertions(+)