From patchwork Thu Mar 21 03:27:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13598373 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE91EC54E68 for ; Thu, 21 Mar 2024 03:29:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5ED3F6B00A8; Wed, 20 Mar 2024 23:29:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 54D306B00AC; Wed, 20 Mar 2024 23:29:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3034A6B00A8; Wed, 20 Mar 2024 23:29:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id E08356B00A8 for ; Wed, 20 Mar 2024 23:29:02 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id BB19A141452 for ; Thu, 21 Mar 2024 03:29:02 +0000 (UTC) X-FDA: 81919614924.20.2F4A60E Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf26.hostedemail.com (Postfix) with ESMTP id 7828714000D; Thu, 21 Mar 2024 03:28:59 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710991740; a=rsa-sha256; cv=none; b=bVG0JbWZbS6ohDEjMXv8PZAoEt5f/9lAvCB+Q4RaOlNEOUSHzoUpgCTHVMPTxmQEZOhUQQ Qmy759okbQnscg3bGz+SFDL6Vwddk1z6ce/DcTdgZCXUeX7+8JB2NYh1Q5eWeDULMBSPbC 49WeWQOlT4ZI2rp7SMlGGg0A6TGGZMo= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1710991740; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oXxtMGODfvoj7ThNvhj1YnT4i8TnXm3uEl62VQwLTjM=; b=YuYGxpYtrJZsh4eVZeEJEvuU1GGIB1RUeEuC9wafDLKVR12zB8pDrgIUF4DnEmdvhNMdGL yMcmAMA+hjjfsY/Xwhcz5TKjztMU8IDN+Vnz/hE5VZhQha1x+OeXSupZW5Df7liBasWa6d QU8s6hvEJR6XmMJfaCvK/rzl5HVq9TU= Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4V0W922JF8z1xsC2; Thu, 21 Mar 2024 11:27:02 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id EA6431A0172; Thu, 21 Mar 2024 11:28:55 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 21 Mar 2024 11:28:55 +0800 From: Kefeng Wang To: Andrew Morton , CC: Tony Luck , Naoya Horiguchi , Miaohe Lin , Matthew Wilcox , David Hildenbrand , Muchun Song , Benjamin LaHaise , , , , Zi Yan , Jiaqi Yan , Hugh Dickins , Kefeng Wang Subject: [PATCH v1 11/11] fs: aio: add explicit check for large folio in aio_migrate_folio() Date: Thu, 21 Mar 2024 11:27:47 +0800 Message-ID: <20240321032747.87694-12-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240321032747.87694-1-wangkefeng.wang@huawei.com> References: <20240321032747.87694-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100001.china.huawei.com (7.185.36.93) X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 7828714000D X-Stat-Signature: e5gi5t7zwh9sfng4qewjp7zwej3cmoqo X-Rspam-User: X-HE-Tag: 1710991739-401551 X-HE-Meta: U2FsdGVkX19R+Cxp4vyUCLPbrfIqqNDPbqjZhNso2jRJXQKoA5qrEEizZ1HdKrPWlWKIItVEje5EdPugpc1i+KhCJoDgrApjggN/Mavrmd2GvFHOR4l9rNAjr2iBp/ca03LmSV/tsPQ8UULf80rPmzt5yXrvDvgNygqow6ph4uoAXMt0FLKTzl4UlEbEMwN9IuK8/7NbJgTduUik6rzGmEPtk2hFT8mYD0FpEuUMynXFDRVCoy70sQBzrmnORRjQjBgaqOZAwki6oykTyYQxGaWdbyavPiePT44tkeoE3ULcJwP/8C8xVSjUOcAUGe50+Lj2Nh+aoOM8sbsniLa4RLXEOPHEAh3cifa5vidT5U/lDj0QHTyNdu9/IdoxFVlXp7C9lkpfH75ViP83e/HBMhmjyz+HutlhQY1PtwZOyZhx5V0rDFGwyGHutLUxcjruYulLQTU5tYhFvHc87RIGpbGGXM2gKGIjbnzrOEOFLjcsTcxfk8osidOr0dMrLusBqP5H5081sFQ/3tOdeFW9zHl33sNA4i49yeS76bARM/ieIgnsXuPnJ2uun6BU/FhyPHt1EDk+x8Zx4/qasKP61Qm6QjIuM9fkWMdOGOl/syiLfWckq8REWshUDckqe8PO08Zc0g9EX03VI3XV1+ntPvexvUi6V/jfnn89dXBfPkQioOEQv7kAI64PatSRBb9MqATT+jsput0e1qqRfL4pb1Nruv6DEuRJW6hSPyerY+BWrZ3cs/6lFDqs+mSA0pLTqnLNnLGsqw2yllnFkPDZqNetmqI/TYTrnkpGiFKXzH5e5tyAZRjyuW4WkM4uWjye9fRyy6QEu2wuq+B4UxC1rL0wLuMZx/nqMLM+rBXxb5xcgcmtju7rAoUSVtgks5QVv0pzaTvFbZf+qBi4Man6wG6WNbkdeK+vwoz1CUJkdL7SrTPo2HgAwShQSD78ZIHYgOGuQD4fzxrUvuU78gW z7GV/uUq bhtYUSoyxS9W43QtY4q/37aO6HhxjeemT0pSdCCAXCsYGCbIgKHrlZ+s9IcCGcEJkTsgKjTcvrBo+DZOiN2bLRKxBxVMAGw+k4AoqpSlen2edLNzdbZfbRHtQbO1DlJGD/SoAmia0wLfPtEXDSpVmHH4f0AHl46OQIcCqZv3Mvc74MxLzxz+0IV+xJroRm0Ue5stT X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 --- fs/aio.c | 4 ++++ 1 file changed, 4 insertions(+) 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;