All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@kernel.org>
To: Trond Myklebust <trond.myklebust@hammerspace.com>,
	Anna Schumaker <anna.schumaker@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 2/4] NFS/localio: use GFP_NOIO and non-memreclaim workqueue in nfs_local_commit
Date: Wed,  7 Jan 2026 11:08:56 -0500	[thread overview]
Message-ID: <20260107160858.6847-3-snitzer@kernel.org> (raw)
In-Reply-To: <20260107160858.6847-1-snitzer@kernel.org>

From: Mike Snitzer <snitzer@hammerspace.com>

nfslocaliod_workqueue is a non-memreclaim workqueue (it isn't
initialized with WQ_MEM_RECLAIM), see commit b9f5dd57f4a5
("nfs/localio: use dedicated workqueues for filesystem read and
write").

Use nfslocaliod_workqueue for LOCALIO's SYNC work.

Also, set PF_LOCAL_THROTTLE | PF_MEMALLOC_NOIO in
nfs_local_fsync_work.

Fixes: b9f5dd57f4a5 ("nfs/localio: use dedicated workqueues for filesystem read and write")
Signed-off-by: Mike Snitzer <snitzer@hammerspace.com>
---
 fs/nfs/localio.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/localio.c b/fs/nfs/localio.c
index c38e7d4685e2f..9ec1652cc5369 100644
--- a/fs/nfs/localio.c
+++ b/fs/nfs/localio.c
@@ -1060,17 +1060,22 @@ nfs_local_fsync_ctx_free(struct nfs_local_fsync_ctx *ctx)
 static void
 nfs_local_fsync_work(struct work_struct *work)
 {
+	unsigned long old_flags = current->flags;
 	struct nfs_local_fsync_ctx *ctx;
 	int status;
 
 	ctx = container_of(work, struct nfs_local_fsync_ctx, work);
 
+	current->flags |= PF_LOCAL_THROTTLE | PF_MEMALLOC_NOIO;
+
 	status = nfs_local_run_commit(nfs_to->nfsd_file_file(ctx->localio),
 				      ctx->data);
 	nfs_local_commit_done(ctx->data, status);
 	if (ctx->done != NULL)
 		complete(ctx->done);
 	nfs_local_fsync_ctx_free(ctx);
+
+	current->flags = old_flags;
 }
 
 static struct nfs_local_fsync_ctx *
@@ -1094,7 +1099,7 @@ int nfs_local_commit(struct nfsd_file *localio,
 {
 	struct nfs_local_fsync_ctx *ctx;
 
-	ctx = nfs_local_fsync_ctx_alloc(data, localio, GFP_KERNEL);
+	ctx = nfs_local_fsync_ctx_alloc(data, localio, GFP_NOIO);
 	if (!ctx) {
 		nfs_local_commit_done(data, -ENOMEM);
 		nfs_local_release_commit_data(localio, data, call_ops);
@@ -1106,10 +1111,10 @@ int nfs_local_commit(struct nfsd_file *localio,
 	if (how & FLUSH_SYNC) {
 		DECLARE_COMPLETION_ONSTACK(done);
 		ctx->done = &done;
-		queue_work(nfsiod_workqueue, &ctx->work);
+		queue_work(nfslocaliod_workqueue, &ctx->work);
 		wait_for_completion(&done);
 	} else
-		queue_work(nfsiod_workqueue, &ctx->work);
+		queue_work(nfslocaliod_workqueue, &ctx->work);
 
 	return 0;
 }
-- 
2.44.0


  parent reply	other threads:[~2026-01-07 16:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-03 17:14 [PATCH 0/4] Fix misc localio issues Trond Myklebust
2026-01-03 17:14 ` [PATCH 1/4] NFS/localio: Stop further I/O upon hitting an error Trond Myklebust
2026-01-05 17:19   ` Mike Snitzer
2026-01-05 17:35     ` Trond Myklebust
2026-01-03 17:14 ` [PATCH 2/4] NFS/localio: Deal with page bases that are > PAGE_SIZE Trond Myklebust
2026-01-05 17:40   ` Mike Snitzer
2026-01-03 17:14 ` [PATCH 3/4] NFS/localio: Handle short writes by retrying Trond Myklebust
2026-01-05 18:04   ` Mike Snitzer
2026-01-05 18:09     ` Trond Myklebust
2026-01-05 18:30       ` Mike Snitzer
2026-01-03 17:15 ` [PATCH 4/4] NFS/localio: Cleanup the nfs_local_pgio_done() parameters Trond Myklebust
2026-01-05 17:24   ` Mike Snitzer
2026-01-07 16:08 ` [PATCH 0/4] NFS/localio: various improvements Mike Snitzer
2026-01-07 16:08   ` [PATCH 1/4] NFS/localio: prevent direct reclaim recursion into NFS via nfs_writepages Mike Snitzer
2026-01-07 16:08   ` Mike Snitzer [this message]
2026-01-07 16:08   ` [PATCH 3/4] NFS/localio: remove -EAGAIN handling in nfs_local_doio() Mike Snitzer
2026-01-07 16:08   ` [PATCH 4/4] NFS/localio: switch nfs_local_do_read and nfs_local_do_write to return void Mike Snitzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260107160858.6847-3-snitzer@kernel.org \
    --to=snitzer@kernel.org \
    --cc=anna.schumaker@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@hammerspace.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.