From patchwork Mon Jul 29 16:19:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13745301 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 11EF6C3DA61 for ; Mon, 29 Jul 2024 16:22:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9E38A6B00B2; Mon, 29 Jul 2024 12:22:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 992646B00B4; Mon, 29 Jul 2024 12:22:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8338C6B00B5; Mon, 29 Jul 2024 12:22:30 -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 612F76B00B2 for ; Mon, 29 Jul 2024 12:22:30 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2487CA0368 for ; Mon, 29 Jul 2024 16:22:30 +0000 (UTC) X-FDA: 82393308060.07.A8F9CC6 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf20.hostedemail.com (Postfix) with ESMTP id 6CFD91C0011 for ; Mon, 29 Jul 2024 16:22:28 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YCkH9WxL; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf20.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722270104; a=rsa-sha256; cv=none; b=DmPrQ49eRAzE/n5JxMVVvN91o9lEygf2qn5r2SrVQ9qEYFEhpy7sVvvcXaW5uN0EbiCOQm zpIbFzxKKKzog+Q1+3Yl+xMIVVqzfbjqu+DNEcQAJ2mBSwhPz5MHZj+23c0S7EcVGohWSD QO9fD3rkklpN20mUBA70mVu/bq18PRE= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YCkH9WxL; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf20.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722270104; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=OdyodcaxIsN9yjCj5kMWkPV/Ay0KIsoiyQ6+poCT0PE=; b=hu92hAXefZ1eZunNcL0Fr03ydxIHMZXTd3xtO6J6LrH5qb//W4lQo90Lo2FMPgyhpnhMpl FVhcx2gaplzxDk6Qeih9NADqBxxzByajYdJZuEP4YVjax3NCh2hJyb27r01rEE56Q+XT5J f2f/iaE93ra5cSQzBGwrS+kK5DPNIlk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722270147; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OdyodcaxIsN9yjCj5kMWkPV/Ay0KIsoiyQ6+poCT0PE=; b=YCkH9WxLSNeB8VhMRuUpNtJ7HrWSzbKqNLLTUJcX+gdTDGkTAres7cx55wP7Qwr7PIcezc nOqQoPpbiQ9BHM4lCqQABmMHE21wdDfNEv3KRjp6SyLe7MbPcIML8R1RNm8EPH7t5gzMHp Lyu4Oftp568tZlVsVMKow8w1VMIlEG8= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-192-3LqD4uRGPwCG4qblk50iUw-1; Mon, 29 Jul 2024 12:22:24 -0400 X-MC-Unique: 3LqD4uRGPwCG4qblk50iUw-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5165A19560AA; Mon, 29 Jul 2024 16:22:20 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.42.28.216]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id ACD471955D42; Mon, 29 Jul 2024 16:22:14 +0000 (UTC) From: David Howells To: Christian Brauner , Steve French , Matthew Wilcox Cc: David Howells , Jeff Layton , Gao Xiang , Dominique Martinet , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , netfs@lists.linux.dev, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 17/24] afs: Make read subreqs async Date: Mon, 29 Jul 2024 17:19:46 +0100 Message-ID: <20240729162002.3436763-18-dhowells@redhat.com> In-Reply-To: <20240729162002.3436763-1-dhowells@redhat.com> References: <20240729162002.3436763-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 6CFD91C0011 X-Stat-Signature: utu6wex7naas6eibqjrit1exe7sk6im8 X-Rspam-User: X-HE-Tag: 1722270148-625515 X-HE-Meta: U2FsdGVkX1/6lCa/AcPgSnurIJeA+O2o88AuMqK6HqQNpYqhuz78zi8pjakkFm+f13FU+86cekpedvtsAtsGUHxyqH4ru0Z5PaOYpAa9CeSRBXGCRBpuykwDhDjBrJW6GL3R7k2lzJijQ45AfZ9HQ/h7mNTdpe3FY3UtA7U3BCgsH7MCrhxlz5SFfOSDFzECiUbv/WrUIfWPZWQL90jxJpGgDsv6NQG/K8RrOT3sxU3ZzxU3wrtnYf0LypHNt6VSWnymV1U/PZXhmYfVkJ6U50dkbwIfdIyfpP6DTNZLDb3890fUfo96quXwxMbdYzqejPLU8rbhPwG7hI7yF7sahvGBCHPv85GX+ipL1ddQH7LZei/HQ3hKXGsq54Gj4wa3by/Sw0IwKZjHFkxylJflY9gYWXzz7puZ3qk95MRFvFN7Nr/qZ5Ul1bCcb/yIHQKkAfpL5PL3oPhR1iB9/YPZ2QLBM5Sd2hGAi6wV0xj+tYqXcLmyyzKwOlQAKvh5Y1XAThkAoqkCNgQ5HZv8aSrYJaRHI+1fin7JdL02OQ5uUrrN98S0uzQXB2rJNu8h++fMccI0xb8VBZKYRZ3mUcThF1k7BKMVkpTijgkf66Ato5A88ZuoRlJyCWRPaZAjJkgzNTLS9XWOFCuIyujmHcKCccSewxSs4ezpRLrSnH0OBWzuV+U0RXYm93W/rguGP10PVhpl7ePa/xCqIZXViLGNnQtktS2znf7/ivGRFKGNBjuxRiy2r0ocJUqiFB5e0/y19U1Qy3mU1NZiaLRWqOCiPtdCqbFzQynCEIjnfJ6tVmO/8M9mIRGUUUeYTkPZkxvrKbkQSyAiudapPZFhn08vWvk3R2VHGx0qw9i6EeOotoyClwkV0KDtC198mO++ReLU4SRh8p53cTu9FpRfkVquz+XKdSWqTLAtoIMfUTgTrp32Q3XagwjTk8l5+AOKBxle5Y3zAqfqhGmiUG+lREw bxE7JwDZ 8wMG8GdiVhTiae7GCb7FiUS7iN9NTbwHTMc/Uv3hzAsV9uG4AxNurjSlqS4u1jxxySesK+fOkBHlEoSqjsZ4zvIqJ6CSqYjiatB1rAuGyhhr5zDrcyOhMyTDolNnmtoPj2C+vdsHLz/+xx+PormqywXOuqss4/OU9viQrejszqyiyNru1HF2rEUYSkh1ZgXrgvA3mmxMgvanqp56G5In/OkJc0R/6StXHGGElHD1N6rJ+MxGbcuZHmfa6lpDvXS+zigTKWapaNPVsiggg1/gpGnrqHSKYpm4PDba2ReiHMK/kJzS89TK9HvMTg99mHICm8slL3auZDVv1BB8hNWaLQR4/WijQVI0Qxsr0T1xYDxPyKF36vnY2pLgOLKEii/o9MKrRd4rRkRFmTosWv9l4BLaP6MIS19KxJLLniRbdk0E5swl9lCUrllQWhEz1XpKBKQtkgyj9HpfdUmmSy05QiVqmVDkYbKvfR8Tk 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: Perform AFS read subrequests in a work item rather than in the calling thread. For normal buffered reads, this will allow the calling thread to copy data from the pagecache to the application at the same time as the demarshalling thread is shovelling data from skbuffs into the pagecache. This will also allow the RA mark to trigger a new read before we've finished shovelling the data from the current one. Note: This would be a bit safer if the FS.FetchData RPC ops returned the metadata (including the data version number) before returning the data. This would allow me to flush the pagecache before installing the new data. In future, it may be possible to asynchronously flush the pagecache either side of the region being read. Signed-off-by: David Howells cc: Marc Dionne cc: Jeff Layton cc: linux-afs@lists.infradead.org cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org --- fs/afs/file.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/afs/file.c b/fs/afs/file.c index c3f0c45ae9a9..addb106dba4c 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c @@ -304,8 +304,9 @@ int afs_fetch_data(struct afs_vnode *vnode, struct afs_read *req) return afs_do_sync_operation(op); } -static void afs_issue_read(struct netfs_io_subrequest *subreq) +static void afs_read_worker(struct work_struct *work) { + struct netfs_io_subrequest *subreq = container_of(work, struct netfs_io_subrequest, work); struct afs_vnode *vnode = AFS_FS_I(subreq->rreq->inode); struct afs_read *fsreq; @@ -324,6 +325,12 @@ static void afs_issue_read(struct netfs_io_subrequest *subreq) afs_put_read(fsreq); } +static void afs_issue_read(struct netfs_io_subrequest *subreq) +{ + INIT_WORK(&subreq->work, afs_read_worker); + queue_work(system_long_wq, &subreq->work); +} + static int afs_symlink_read_folio(struct file *file, struct folio *folio) { struct afs_vnode *vnode = AFS_FS_I(folio->mapping->host);