From patchwork Thu Jun 27 00:54:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 13713599 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 A12D0C30653 for ; Thu, 27 Jun 2024 00:55:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 13E146B009D; Wed, 26 Jun 2024 20:55:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0CFD66B009E; Wed, 26 Jun 2024 20:55:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE6686B009F; Wed, 26 Jun 2024 20:55:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id BDF306B009D for ; Wed, 26 Jun 2024 20:55:15 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 6529A41856 for ; Thu, 27 Jun 2024 00:55:15 +0000 (UTC) X-FDA: 82274849790.22.D9738AD Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2084.outbound.protection.outlook.com [40.107.220.84]) by imf09.hostedemail.com (Postfix) with ESMTP id 92F0F140013 for ; Thu, 27 Jun 2024 00:55:12 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=VS8XlZaS; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf09.hostedemail.com: domain of apopple@nvidia.com designates 40.107.220.84 as permitted sender) smtp.mailfrom=apopple@nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1719449700; a=rsa-sha256; cv=pass; b=sw/1srMtqED4WTxoPBhPia7s2sYab0PH41cBITfSu3JBci6z+u+XrND0UFY4eUCH7Y6BAN pUmePg9GyFrBtWWADd96VqNqFfc++KkPZ6rDK0TJXTZ5rCghAtTWK0UJsJZPJF741/9S1q sezEHFUz6kZMF9YMYGOpNFvOlVMv4WM= ARC-Authentication-Results: i=2; imf09.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=VS8XlZaS; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf09.hostedemail.com: domain of apopple@nvidia.com designates 40.107.220.84 as permitted sender) smtp.mailfrom=apopple@nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719449700; 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:dkim-signature; bh=mkUV5xCCQA5m1br9rTXYMXBe6uTUnQXYw2g5A0ZnCWs=; b=VkK3c1iAuLeszW+3qDMp/JOALr2PNPMV2YICnr6Sm9KTe+Y1sHypUwjcqYVaqyRIvzzEB6 0kED2xnoDu4N0TuEffZaOd95+Dv9IzAimC5rD9gXcn/ovjoUsw3rOQzwLGeEQSg3T80gJ+ oSnCZiK253FUq38b2jUIzMxMJXeGwHI= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZPDfYzPAFZO4u5U0fZDyPG9SM0ws2UCCHvf5790JCbuCEBgWBvlAaVYcdXPiPxgH/fuZkUMtZLU7wIScmXIKMCgC/1H4wblnLmXMjLIzfG9cQqpVjulK91m85bFvwfsccw9iHNkxVf5vdqFkFIyPNq5Hg6ycV/42FSr30cMhQWzVkKp+x7TbDgSLJMWfZ71pok61y3w2rQJ1ek8bazZ4JuiRxrx+x9sxGpgZzPHk7O6zevkJBFV12RAUCiCeFJLL30CyCp5l/9EoDfyrI4wPW8HM8kvGy7XbpMPPRNiILlOZk8hcu/Y9/EqyU1p3eyILvEW2fsScphhWGlUyEsbnmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mkUV5xCCQA5m1br9rTXYMXBe6uTUnQXYw2g5A0ZnCWs=; b=UHZtML0E7xPH8r4oApQzPKP8F9JSWROAeCUk+Uze6UjBS510khjCgNL/+PDJdFekjFEZtWqpyj05+7NvTuEMD58FEEh4bTeNsV+OmJEKdd+kd41A4RXDT1hrC41pugEDoXEEM8CZCs4eNr2dBiOy0A+vkS5EjBWGov7UOM0WAvDLI+7aAqA6pn5/AJWMB/LdXeyi29QKIueg0jJzCu8+fh81XTJN05nKNF01oisptrJwk4Ej5Bavf27aFpGAJSZ6NfgR4lvdn94UCIEi9AkzzwpUkfcZCrZ0srao/iKf4IYL0jt7/ZR8lc7lFGW62egssA+UBsVW0uXXTv+BMlRYMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mkUV5xCCQA5m1br9rTXYMXBe6uTUnQXYw2g5A0ZnCWs=; b=VS8XlZaSL4vliXrE93EJBTfkYq47yLhn4gs5eXtHKXZFH1jTJTKBDlkAE4sKSRP0s1UyWD60ysH9GCHx/ieA5kRuEvObXIlS+a0+cwb0KvHe+weZptUlLRReOZ2bo0gncJGecK8mbQ56hLiy5+bS/u6STrDt26Q0ovbVsR5uCMVa/8av13DMgI/oAn7ciKpgzNGGmgq202TzW1N/sKgAs3zYRS7RC8pEIHgl+WyRfbvkEBAo0LJNu4xMfELZoiUAMciuPtGDbU4fCs9B+BkXN1ndxbNvjDfGhbLSZvNE7NUNLCvErTVXt/s1Xakvw+zgYUJNvQzuhJM7V69kPXf8rQ== Received: from DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) by MW6PR12MB7071.namprd12.prod.outlook.com (2603:10b6:303:238::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.32; Thu, 27 Jun 2024 00:54:53 +0000 Received: from DS0PR12MB7726.namprd12.prod.outlook.com ([fe80::953f:2f80:90c5:67fe]) by DS0PR12MB7726.namprd12.prod.outlook.com ([fe80::953f:2f80:90c5:67fe%6]) with mapi id 15.20.7698.025; Thu, 27 Jun 2024 00:54:50 +0000 From: Alistair Popple To: dan.j.williams@intel.com, vishal.l.verma@intel.com, dave.jiang@intel.com, logang@deltatee.com, bhelgaas@google.com, jack@suse.cz, jgg@ziepe.ca Cc: catalin.marinas@arm.com, will@kernel.org, mpe@ellerman.id.au, npiggin@gmail.com, dave.hansen@linux.intel.com, ira.weiny@intel.com, willy@infradead.org, djwong@kernel.org, tytso@mit.edu, linmiaohe@huawei.com, david@redhat.com, peterx@redhat.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, jhubbard@nvidia.com, hch@lst.de, david@fromorbit.com, Alistair Popple Subject: [PATCH 03/13] fs/dax: Refactor wait for dax idle page Date: Thu, 27 Jun 2024 10:54:18 +1000 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: X-ClientProxiedBy: SYBPR01CA0185.ausprd01.prod.outlook.com (2603:10c6:10:52::29) To DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR12MB7726:EE_|MW6PR12MB7071:EE_ X-MS-Office365-Filtering-Correlation-Id: e5359390-95cb-49cf-39eb-08dc9643bfa7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|7416014|1800799024; X-Microsoft-Antispam-Message-Info: 7cprG3ZHO/n8TBIFj+nmCoFPsYgpW525x6KFdp7aXP1Baxi5Pws2RO++/9nKjb2um6s3JuWGJ6yjhoUp8o3uKjXpT2XOoCMGjiacO1kJ+am7OqjNTNtZxRWcRAz4IMjQYioXDGuPIpUy7hzBUU5VJLb3FMoFWYEpbQWNtDGwLWdXel62gvv7AU7JbEYVIZJlw9uhJCyh4CPriRcUB6Ylgf8g782n2gsdvM13CM03EPmF4C6DTpLS5Wd5o+ooYVVOyh2idaIajD196+sP3VmQZZ8TGfAhQtyWkDqHF39ZWisguw0wiu16ejTGXicOdTQK1jzU1tSgKK/Axlagj5FbCzFY71tW+U4W58l8l3TRFpsMYe6LYzc7/+rDfC9cUgqX7tpk2lWhEThfPAN/oBTiz3AS+I+F0k5DYODNzCmXhY58+5nTbA5n288CONrKfisNewBNf/7S79i5yqTduOFs9940972pQm5yGlpcvhdfaCJxYQJ1iErQEKh1pwhg4WTmTT8DQenSPzpTiyV8+m/bKNb+wmxPrIDTKrWKjmmDyMeGfiHKhf2fB6OURnmNSpfsrIARbxQLJpf78jVEQFa4hPTrAvJaWhsZxG+yZdN/Wt3BEMSkNlQWpftwFxgD2w+UToiycWLRmJBR9vsVPgkSGglKVPtiYhunGOGEOEUn13aAiFQVt9sxpp4pYypEGYPV9MyU9cZ7RDWeUc7MWjGU7x4E3wxe9pTLZ2OOetL/Ezrdb6H+N3M2DZZhIZ61VtuhMhnKDRx89WhlCfje16SiyzEbi/hJLEiQZRa2F1r9jC5SqKyL81I7y+QC1EQlCTOVwgNQLnE90smN45Zo927Amy9PuQM//xbAH8k9zyTYqcJ3CCxbsVdATu6Sbr9ElKcN1zE3Cg82aZD0f+wjAqvQ3cWmo/o/fqHUO62yOUIFnAsrQcFXgqjGpAA8Ac/JdHtq7brg7T3EoGa5cSKfW0+uJnjUGWoTF5kCFBelLCOZ9Tm00pbOZswlk94pB+G1Ic55+nQbU+vgikwkAPoBXD8i5u/yLuN1JFGFTWXC5wFgBQIDAKq4h+7IFkvH6AkcQXCt96XkHsAbAi/cZrfPlTwqD4C38Ktvt1ZGIVUl0iqS7k2vCKC4GFAf1YA+7OBWszfQjisGvbuBcuZeYfzCBxKpm85AIVMKenkJLtZm6Z5hsQ1NxY0C7li+sJZ+TXc7WYDQ9xZzJ2qjE0Z75CfbCcFkHSdSqw8osvpb1E0ZSy9LnR7/NaxVnCizswLyVMmgv9CD8DkeRx+Y5qqu0YSW7dr29187dy/LO9eq/Y1kMBQig/wfCNlN4HbuPV3ACBnFy0Tz6w6KTo3FVL/Fl07IJBsXKA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR12MB7726.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(7416014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: F659aibZ3vZcoGSv009Kqz79YlJ4kJnGrHfjaZZ6IkUBtSE7tfdpEQ4FcecOBuNVY8r5OsLqlsEMqThN/gkUhqccxVwIUPuJQMIKkDdHAka99M+JmH0Q22mXykwPmXZyUWHOCZuvESAtvqTdqj6eJq5BN2PFtMRGsxlr0JblqRFgF3NaWUBFR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IpEbXjRFxCltpqe1zzyMFJ/5yk3SBsDHLlFtBerSXhG/85GhbmNzhfeYJT57Co9Mks3IKtliTD31WOd+5z5GHk8yQZ03Bv8ihtmwZRrwEF2kGewZ6SeaE/xob98qKTFVuhiaDrxJWJ9e1Uk+4WvUfOMAvzSJo58B58Ao/lGc2qfB+xjvI47LncMlJfKQiLeYm4z9OZAP4/hv47uZpl6UqnN7eRCHrUJcYjFoOtbtF+V1ZRYc32eIzuIyjYiHGOw/6N/og0oK8v/TZo3DdKXeHdZAu7fg3j52Qe72NLALIAXo25U43k74dKsOmPoE12DI68bkwkoQIrBy5fnXFlH2bN X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: e5359390-95cb-49cf-39eb-08dc9643bfa7 X-MS-Exchange-CrossTenant-AuthSource: DS0PR12MB7726.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2024 00:54:50.4900 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: F52wrDVx8N1dKAJsJ1pHfPmD9Tg2c1chNjqp+yzOoQI82P4JSm5DaMh/9rVfkMe2875tmXJ1obHbVT06Og9bog== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB7071 X-Rspamd-Queue-Id: 92F0F140013 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: toemdkg1kwzbxra3tfdmij41guueaeqg X-HE-Tag: 1719449712-927556 X-HE-Meta: U2FsdGVkX1/sOMArNULdYimupkT7MlUey4SrRFv4nNiEm6ij1dQtX3F0YkMNrOTvdq6R2qVGvWxa6ZJSrBnrzraVD63F29fK1NgI4odfAZP6662LwzSPi3FXx3itamhCrKIeSakdWmO002d1j+iI4GmWt2eO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VfSiCeDdwfbQzIs3YRqSX4kGFm+IygSHc= 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: A FS DAX page is considered idle when its refcount drops to one. This is currently open-coded in all file systems supporting FS DAX. Move the idle detection to a common function to make future changes easier. Signed-off-by: Alistair Popple Reviewed-by: Jan Kara Reviewed-by: Christoph Hellwig --- fs/ext4/inode.c | 5 +---- fs/fuse/dax.c | 4 +--- fs/xfs/xfs_inode.c | 4 +--- include/linux/dax.h | 8 ++++++++ 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 4bae9cc..4737450 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3844,10 +3844,7 @@ int ext4_break_layouts(struct inode *inode) if (!page) return 0; - error = ___wait_var_event(&page->_refcount, - atomic_read(&page->_refcount) == 1, - TASK_INTERRUPTIBLE, 0, 0, - ext4_wait_dax_page(inode)); + error = dax_wait_page_idle(page, ext4_wait_dax_page, inode); } while (error == 0); return error; diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c index 12ef91d..da50595 100644 --- a/fs/fuse/dax.c +++ b/fs/fuse/dax.c @@ -676,9 +676,7 @@ static int __fuse_dax_break_layouts(struct inode *inode, bool *retry, return 0; *retry = true; - return ___wait_var_event(&page->_refcount, - atomic_read(&page->_refcount) == 1, TASK_INTERRUPTIBLE, - 0, 0, fuse_wait_dax_page(inode)); + return dax_wait_page_idle(page, fuse_wait_dax_page, inode); } /* dmap_end == 0 leads to unmapping of whole file */ diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index f36091e..b5742aa 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -4243,9 +4243,7 @@ xfs_break_dax_layouts( return 0; *retry = true; - return ___wait_var_event(&page->_refcount, - atomic_read(&page->_refcount) == 1, TASK_INTERRUPTIBLE, - 0, 0, xfs_wait_dax_page(inode)); + return dax_wait_page_idle(page, xfs_wait_dax_page, inode); } int diff --git a/include/linux/dax.h b/include/linux/dax.h index 9d3e332..773dfc4 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -213,6 +213,14 @@ int dax_zero_range(struct inode *inode, loff_t pos, loff_t len, bool *did_zero, int dax_truncate_page(struct inode *inode, loff_t pos, bool *did_zero, const struct iomap_ops *ops); +static inline int dax_wait_page_idle(struct page *page, + void (cb)(struct inode *), + struct inode *inode) +{ + return ___wait_var_event(page, page_ref_count(page) == 1, + TASK_INTERRUPTIBLE, 0, 0, cb(inode)); +} + #if IS_ENABLED(CONFIG_DAX) int dax_read_lock(void); void dax_read_unlock(int id);