From patchwork Fri Oct 14 23:57:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 13007515 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 78D25C4332F for ; Fri, 14 Oct 2022 23:57:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DF8BA6B0075; Fri, 14 Oct 2022 19:57:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DA7EC6B0078; Fri, 14 Oct 2022 19:57:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C97566B007B; Fri, 14 Oct 2022 19:57:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id BA64F6B0075 for ; Fri, 14 Oct 2022 19:57:06 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 8FF321A0E93 for ; Fri, 14 Oct 2022 23:57:06 +0000 (UTC) X-FDA: 80021218452.27.65272BD Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by imf23.hostedemail.com (Postfix) with ESMTP id 10280140031 for ; Fri, 14 Oct 2022 23:57:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665791825; x=1697327825; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1QVmMXmTNKFM/iXiTwxmy31zTJO5VhS550m6cgY6v88=; b=bEvhbEFxWaSeD9vgae/qJh7ObisSz8sQKxaj6L0siWnlg1RlUJwbGRpG Vev7Y6Xdvophq7YTfFXAl0H3io6VSmonB2jxEKWSWyrGLJfoOFnBJIc5t yk7Adq7HUefSTHsMDKw4iajjR6lCTrOMd3/gTfuXMcyhrOmSJHUov66JE U3hGvJYYteWpjkXyI65ghtqIZH8lQQU7jXOLTbQ49IKI5JolwHsnhxGqW vjUX0l8Zg506XpoXEnObWvh8+8czNunFN5RgtLnyMEI46WIDn2A2vyqTL cIJ9beso+bT/KbNNhev5o98444IXD7nRvSIEt4wohy9JmD5IyTDxtglUd w==; X-IronPort-AV: E=McAfee;i="6500,9779,10500"; a="292861854" X-IronPort-AV: E=Sophos;i="5.95,185,1661842800"; d="scan'208";a="292861854" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2022 16:57:03 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10500"; a="658759494" X-IronPort-AV: E=Sophos;i="5.95,185,1661842800"; d="scan'208";a="658759494" Received: from uyoon-mobl.amr.corp.intel.com (HELO dwillia2-xfh.jf.intel.com) ([10.209.90.112]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2022 16:57:03 -0700 Subject: [PATCH v3 01/25] fsdax: Wait on @page not @page->_refcount From: Dan Williams To: linux-mm@kvack.org Cc: Matthew Wilcox , Jan Kara , "Darrick J. Wong" , Christoph Hellwig , John Hubbard , Jason Gunthorpe , david@fromorbit.com, nvdimm@lists.linux.dev, akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org Date: Fri, 14 Oct 2022 16:57:02 -0700 Message-ID: <166579182271.2236710.15120970389485390592.stgit@dwillia2-xfh.jf.intel.com> In-Reply-To: <166579181584.2236710.17813547487183983273.stgit@dwillia2-xfh.jf.intel.com> References: <166579181584.2236710.17813547487183983273.stgit@dwillia2-xfh.jf.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665791825; a=rsa-sha256; cv=none; b=whE/PevC1r8JzejMS3EX3TGUbkYkI6VnvhuxxoW1Erog+d//9eKyPlytOTdJGVhNK2q0SB edJlGqakSiUG6ekw1IGoYdvstb9ps23vENn1ooDACefC/WvlNjqxL5q11k4NvNOBcr2f72 68dRj5e4ufAaSn4oUazEX39B9yAB1D8= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=bEvhbEFx; spf=pass (imf23.hostedemail.com: domain of dan.j.williams@intel.com designates 134.134.136.20 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665791825; 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=KM+0eeMhdrxpX2Cxgw0JcB3bULUGDOj2MnI/iJJFYwE=; b=58p4g8i0svA/tTx8/JXEXR8+7ebDZYMRMX4ZlY+5sVFsdQck3Teu4JLwXo/ZJJwqbufvLF mCjROq3XZThyzKZNRcmcXNP/h4VNS59I+AaxtikP/jZtInDne7fpE2TF7SqJx20UW9g7fH 2DgUjoo8FOCTKSTXAKmvFFdIFOnkiuk= X-Rspam-User: X-Stat-Signature: e6ewd4eqkh65zu3jbzxqtb67nidi9x9f X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 10280140031 Authentication-Results: imf23.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=bEvhbEFx; spf=pass (imf23.hostedemail.com: domain of dan.j.williams@intel.com designates 134.134.136.20 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (policy=none) header.from=intel.com X-HE-Tag: 1665791824-813338 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: The __wait_var_event facility calculates a wait queue from a hash of the address of the variable being passed. Use the @page argument directly as it is less to type and is the object that is being waited upon. Cc: Matthew Wilcox Cc: Jan Kara Cc: "Darrick J. Wong" Cc: Christoph Hellwig Cc: John Hubbard Reviewed-by: Jason Gunthorpe Signed-off-by: Dan Williams --- fs/ext4/inode.c | 8 ++++---- fs/fuse/dax.c | 6 +++--- fs/xfs/xfs_file.c | 6 +++--- mm/memremap.c | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 601214453c3a..b028a4413bea 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3961,10 +3961,10 @@ 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 = ___wait_var_event(page, + atomic_read(&page->_refcount) == 1, + TASK_INTERRUPTIBLE, 0, 0, + ext4_wait_dax_page(inode)); } while (error == 0); return error; diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c index e23e802a8013..4e12108c68af 100644 --- a/fs/fuse/dax.c +++ b/fs/fuse/dax.c @@ -676,9 +676,9 @@ 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 ___wait_var_event(page, atomic_read(&page->_refcount) == 1, + TASK_INTERRUPTIBLE, 0, 0, + fuse_wait_dax_page(inode)); } /* dmap_end == 0 leads to unmapping of whole file */ diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index c6c80265c0b2..73e7b7ec0a4c 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -827,9 +827,9 @@ 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 ___wait_var_event(page, atomic_read(&page->_refcount) == 1, + TASK_INTERRUPTIBLE, 0, 0, + xfs_wait_dax_page(inode)); } int diff --git a/mm/memremap.c b/mm/memremap.c index 421bec3a29ee..f9287babb3ce 100644 --- a/mm/memremap.c +++ b/mm/memremap.c @@ -542,7 +542,7 @@ bool __put_devmap_managed_page_refs(struct page *page, int refs) * stable because nobody holds a reference on the page. */ if (page_ref_sub_return(page, refs) == 1) - wake_up_var(&page->_refcount); + wake_up_var(page); return true; } EXPORT_SYMBOL(__put_devmap_managed_page_refs);