From patchwork Fri Sep 16 03:35:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12978053 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 00B6CECAAD3 for ; Fri, 16 Sep 2022 03:35:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 84F388D0003; Thu, 15 Sep 2022 23:35:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D8A08D0001; Thu, 15 Sep 2022 23:35:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 652BE8D0003; Thu, 15 Sep 2022 23:35:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 54A738D0001 for ; Thu, 15 Sep 2022 23:35:18 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 35C2A120665 for ; Fri, 16 Sep 2022 03:35:18 +0000 (UTC) X-FDA: 79916533116.11.8ACE877 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by imf11.hostedemail.com (Postfix) with ESMTP id 8CE374009D for ; Fri, 16 Sep 2022 03:35:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663299317; x=1694835317; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TFsjnfnCv3qQkchX3Q8w6OPDWs44NJ34NXLtENxpehE=; b=ZiFQbuI9mjwD+DKwFQvk1lLNzypX7YGSVLaguGfnl9SwO04WTj4o+T7/ BYTEMCORWMSJNGAVKYYok9VT7tmu1V3h4jgzc7BiYV+ODYfBqgvtCZEFE 386Pcq/Wie2w79rphNikJHKOlbYAQ1A01XGYFq0Un+k7pNtc3hnne0Ear 0KPdEhmMyqY+o01ZjX151vGxB9TThessYoS5Xd3wtmyyfzSm5awthYm2U 0aeRYJRYcfsR9h7kxVGG7eiF+pcckrG77BNJAAmu2dbsdSggchMNQNnmb xaCk7NdYfsUd8T4OUfaYCjEUDKO/irkxX+37Cx1SaDhdRyJcg+xiw0dGZ A==; X-IronPort-AV: E=McAfee;i="6500,9779,10471"; a="278630714" X-IronPort-AV: E=Sophos;i="5.93,319,1654585200"; d="scan'208";a="278630714" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2022 20:35:16 -0700 X-IronPort-AV: E=Sophos;i="5.93,319,1654585200"; d="scan'208";a="679809163" Received: from colinlix-mobl.amr.corp.intel.com (HELO dwillia2-xfh.jf.intel.com) ([10.209.29.52]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2022 20:35:15 -0700 Subject: [PATCH v2 01/18] fsdax: Wait on @page not @page->_refcount From: Dan Williams To: akpm@linux-foundation.org Cc: Matthew Wilcox , Jan Kara , "Darrick J. Wong" , Jason Gunthorpe , Christoph Hellwig , John Hubbard , linux-fsdevel@vger.kernel.org, nvdimm@lists.linux.dev, linux-xfs@vger.kernel.org, linux-mm@kvack.org, linux-ext4@vger.kernel.org Date: Thu, 15 Sep 2022 20:35:15 -0700 Message-ID: <166329931529.2786261.12375427940949385300.stgit@dwillia2-xfh.jf.intel.com> In-Reply-To: <166329930818.2786261.6086109734008025807.stgit@dwillia2-xfh.jf.intel.com> References: <166329930818.2786261.6086109734008025807.stgit@dwillia2-xfh.jf.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=ZiFQbuI9; spf=pass (imf11.hostedemail.com: domain of dan.j.williams@intel.com designates 192.55.52.136 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663299317; a=rsa-sha256; cv=none; b=awXlRxvrYAumBnDHeydA94D4X1KB+o5XYRdquAFIfFI6Gpr+uPD5rUOZXzTp0HVdDPpD6j ikEBsTSFmoibfNhKYmF1YxZ2hbm5ojzw+mYsi+W8QxI2J12kwhd/eW4a6iOB1b0zb//urp ecjXqkaoZmIq+P39WxWOb2piPbkNRaQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663299317; 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=wxwqPldOGGZadzp6x+m/jxCXNhQRyLNrYwqy7ZPvlB0=; b=sjfdzvD6b8TnVSAYPavkEOSb06QdnCxkCIGa0M1TD/BuK1ge7IMbg8gNdxsOjWQ/SwQWsh guQiyb009PiyUV+rwZAmbYV+mNFXMSVQgzNE8lTIn40/mzVNr81qkBIU1fRC2ImNeg2n+n Sqo8Mb0OrFjpeqU5rfTrK1BBZGvgZ6c= X-Rspam-User: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 8CE374009D Authentication-Results: imf11.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=ZiFQbuI9; spf=pass (imf11.hostedemail.com: domain of dan.j.williams@intel.com designates 192.55.52.136 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Stat-Signature: 8xwyu98r1cq67ddqbo6hczdeag89fc9z X-HE-Tag: 1663299317-393094 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: Jason Gunthorpe Cc: Christoph Hellwig Cc: John Hubbard Signed-off-by: Dan Williams Reviewed-by: Jason Gunthorpe --- 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 58b20c3c300b..95f6ffe9cb0f 100644 --- a/mm/memremap.c +++ b/mm/memremap.c @@ -520,7 +520,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);