From: NeilBrown <neilb@suse.de>
To: Trond Myklebust <trond.myklebust@primarydata.com>,
Chuck Lever <chuck.lever@oracle.com>
Cc: NFS <linux-nfs@vger.kernel.org>
Subject: Is there a good reason that nfs4_state_manager should use a work_queue?
Date: Tue, 8 Jul 2014 15:21:00 +1000 [thread overview]
Message-ID: <20140708152100.67cd93c7@notabene.brown> (raw)
[-- Attachment #1: Type: text/plain, Size: 1945 bytes --]
Hi,
I came a across a machine recently which has multiple threads blocked in
nfs_writedata_alloc(). They were waiting for mempool_alloc to provide an
allocation but it never did.
Memory was tight and all the pre-allocations were in use by pending requests.
These requests were queued on "NFS client" which means they were waiting for
the state manager to do something.
But there was no state manager. Presumably kthread_run failed when it tried
to allocate some memory.
I cannot see anything that would retry the attempt to start the thread, and
even if there was, we probably need to complete some NFS writes before more
memory comes available.
In this particular case the main problem was quite separate. Too many large
processes and not enough swap space, and the OOM killer missed its target.
So even if NFS had worked perfectly the machine would still have locked up.
But it does suggest that there is a weakness here.
As kthread_create used GFP_KERNEL to allocate a thread, and as writes can
block waiting for the thread to be created, there appears to be room for a
deadlock.
My thought is that this could be fixed by using a WQ_MEM_RECLAIM work queue.
The WQ_MEM_RECLAIM flag ensures there is always at least one thread running
so no allocation is needed. Before diving in and trying to implement this I
thought it would be safest to ask as there are two issues that I'm not
certain of.
1/ nfs4_run_state_manager() explicitly allows SIGKILL. Why is this?
Is there some situation where it might be appropriate to kill the manager
thread?
2/ would it be reasonable to have a single work queue for all nfs clients?
In the worst case this could serialise reclaim across all clients so we
wouldn't want any reclaim attempt to block indefinitely. Is that likely
to be a big problem do you think?
Thanks for any hints or suggestions,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next reply other threads:[~2014-07-08 5:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-08 5:21 NeilBrown [this message]
2014-07-08 6:46 ` Is there a good reason that nfs4_state_manager should use a work_queue? Christoph Hellwig
2014-07-08 6:57 ` NeilBrown
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=20140708152100.67cd93c7@notabene.brown \
--to=neilb@suse.de \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@primarydata.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox