diff mbox series

[v1,11/11] fs: aio: add explicit check for large folio in aio_migrate_folio()

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

Commit Message

Kefeng Wang March 21, 2024, 3:27 a.m. UTC
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(+)

Comments

Matthew Wilcox March 21, 2024, 3:35 a.m. UTC | #1
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.
Kefeng Wang March 21, 2024, 5:40 a.m. UTC | #2
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 mbox series

Patch

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;