From patchwork Thu Jun 20 17:31:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13705998 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 E5F7CC27C79 for ; Thu, 20 Jun 2024 17:34:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D7E88D00CF; Thu, 20 Jun 2024 13:34:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 685AF8D00AF; Thu, 20 Jun 2024 13:34:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FF7B8D00CF; Thu, 20 Jun 2024 13:34:07 -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 2B8348D00AF for ; Thu, 20 Jun 2024 13:34:07 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E254B1A0444 for ; Thu, 20 Jun 2024 17:34:06 +0000 (UTC) X-FDA: 82251965292.01.2B07417 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf07.hostedemail.com (Postfix) with ESMTP id 35A0140014 for ; Thu, 20 Jun 2024 17:34:05 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=e1uhkUpz; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf07.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718904838; a=rsa-sha256; cv=none; b=FcwQkoHvD26khLltV/UoVNJKIAX28JJcZMiVpzezGVLdyNoBCUbs8AjUkUUXJ2TtYkru9P Mj5jmmSKrGUznnbdoo/9dpH8mpatNsl08oqg8zNmZby2dZbZpLTE8/34YMV4PxxfbZAiFS stF/mm25c0Dq5DreF0xmWtOp92mbQ90= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=e1uhkUpz; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf07.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1718904838; 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=7J+ND91DIy6R8RutNEFDJdVKNaqoSjuHl187qVuWY5y970m9skeNjF+SAY0mbnzBNjLcRm FAP7Jjaf7odRDZyiw8Un7bVRbti73q6XjezHMgdErmPCdd8u+Z+QBq+w3Jvxuzj6IfHKff rfPVr33+cVdsGY248fcOuSo9aTgZxwk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718904844; 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=e1uhkUpzqsdcm+5rJaPcoxE7KWYYsD3HjDJXmg2yu5UHaywIqwNIwkXfHVLy5L/h/VIobd Nd/9eHD4Pt+LhXdCW6XLRBkZTGTa8t1sb/0AeY7pZBXzeayEIZieF9uGD/uyW3KLrpUL99 CEOxoWrJ2x6BcDjhBaSNttVjyGVXWkI= 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-99-kf0yI3oINji29pOmCBJ72w-1; Thu, 20 Jun 2024 13:34:01 -0400 X-MC-Unique: kf0yI3oINji29pOmCBJ72w-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 8CFEC1956063; Thu, 20 Jun 2024 17:33:58 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.39.195.156]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9316B3000218; Thu, 20 Jun 2024 17:33:52 +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 16/17] afs: Make read subreqs async Date: Thu, 20 Jun 2024 18:31:34 +0100 Message-ID: <20240620173137.610345-17-dhowells@redhat.com> In-Reply-To: <20240620173137.610345-1-dhowells@redhat.com> References: <20240620173137.610345-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Rspamd-Queue-Id: 35A0140014 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: et6qz8dkwx3qc8rxt1b8ph4i6ng7j3ht X-HE-Tag: 1718904845-267934 X-HE-Meta: U2FsdGVkX19c5qvzaSMRPJjcr10EN5Lj05/jIfW3kNzAE0C+ANMDD+hZB1aVChSOMvAaGPhQu1JmbayzznZWd8RSFu9zBgZ9izkUGG4Kb+Xuh0tUseFjy9ZqCYvY7e+8yIeP0KgNi9zai5Y/lIgbbWbNM3YvnDQXJDkKfieVSOLYknwxjjxMbKZWn1vF83pcK08SxAh8gQvarmVELSUCB4YYa6yZYAJ0IVuOffJT3DI2SX3BYXUrD7MZbQQ/krqE4ygDwIDTrexjyxFGka000bXIcZnfhnWrchLvkrUXbQj2RiSqtusNOykmibIlMTlbYjlPGjq9RfH47FCWHvQV9AuOEfNSdbYVZttRfmmkpA75eKzwucZAjacTWxRSapr4jTRfCn2DAkaui9b/4Qc0jTGZ2Fef/lolps0tHk3RUZsAsmigyaiTbfcnQPYu6j8ziLZJ9BUfdXBJvpDfexf7hR5MynIdBuxxOCPP/dcjVNvWHmTtHHULb3A/mA2F8sfNoacEbEypMrvYnpOmOGCiZOTC1Lu4HRDG6UYFLDLvgEcmXkliW+LED/O7rquZxgUSPE12M8pbgfNHGUXG/alLKANFQfQAT4nrBNIeXCh/VNqmLZHqOS4VyMH/23CXfQvkcEfDNT+wMFtqznWFhpBzbuVyKKmSEgYAPLP3nhxYrcH8xc8G+UnmOx8AV/4YsBl1GO6gONMFtbhR9WUkSND15SOCSv63t5FHRHnq19lf7P6tqsze3ZCrPe7qVxPC41vmaZQDGNE9R9tq3tOQ6Nvr5c8HxZaje9iqFDC9ajYGn6Ne3mWLen84IMjl5tiJ0rR/aY9nj5i4QESLMFGZJgImmhKp3iVrk3ppBSvYnh2Q1Z7L3xmCP3jJMi9KtlS1gQVkOR/tFyrlyi96PeZIR/XWjn2lmD0q2nz6wb3x8nrPbW0QoUoswttBqPaYSSKSIcW9kO0aCUVQgJuSF/U3ws2 rHq0HI00 0/dAFqtMyclMlPQxc6Fh8MkItqRh/ueBcj7ZWslm65DCU68B+QmWZNfKoZcJRr3IW5FxoGB0ldYxXEwHWlIgt5LFORI7COYeSJqY/w03v6ZhPiBmK6tTom6LcCjN8GP27uBpb8mhLTStAsSovyzda5mcS9uMctP2xkztrAFBKTA2HVRV0Z0JgfOHuSlUWpOS9yKjh+Us2tU/NFiwJqdrNYTRGx6GxREewlxvXOxKQECopx5v4swlRgo2ENLE4IHTry5ZSyc9tYkVpA+EbthA7JR7i/IEGebtjvSL7Lv4S1muUUEq2RH7sWpgiAz7ZsOu5TACGOtnWzzd3gyH0/XwxKsUiGLhOaeFFWGTw6fFQQzxHCAOZJ+ObTYNsdQR+yCilg2F5ktpQF3cGDgmpe1EwPWJWjLa75FVx2vLRvzhlQAtRaYubqDQS4o2nQ0mhgxHxaLfxwCAPAsSHru4az7l1pcMAgB7NnbjVnRp3 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);