From: bfields@fieldses.org (J. Bruce Fields)
To: Tejun Heo <tj@kernel.org>
Cc: "J. Bruce Fields" <bfields@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
"open list:NFS, SUNRPC, AND..." <linux-nfs@vger.kernel.org>,
Jeff Layton <jlayton@redhat.com>,
David Howells <dhowells@redhat.com>, Shaohua Li <shli@fb.com>,
Oleg Nesterov <oleg@redhat.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 0/4] allow multiple kthreadd's
Date: Tue, 5 May 2020 12:23:53 -0400 [thread overview]
Message-ID: <20200505162353.GA27966@fieldses.org> (raw)
In-Reply-To: <20200505155405.GD12217@mtj.thefacebook.com>
On Tue, May 05, 2020 at 11:54:05AM -0400, Tejun Heo wrote:
> Hello, Bruce.
>
> On Mon, May 04, 2020 at 10:15:14PM -0400, J. Bruce Fields wrote:
> > We're currently using it to pass the struct svc_rqst that a new nfsd
> > thread needs. But once the new thread has gotten that, I guess it could
> > set kthread->data to some global value that it uses to say "I'm a knfsd
> > thread"?
> >
> > I suppose that would work.
> >
> > Though now I'm feeling greedy: it would be nice to have both some kind
> > of global flag, *and* keep kthread->data pointing to svc_rqst (as that
> > would give me a simpler and quicker way to figure out which client is
> > conflicting). Could I take a flag bit in kthread->flags, maybe?
>
> Hmm... that'd be solvable if kthread->data can point to a struct which does
> both things, right?
Isn't this some sort of chicken-and-egg problem?
If you don't know whether a given kthread is an nfsd thread or not, then
it's not safe to assume that kthread->data points to some nfsd-specific
structure that might tell you whether it's an nfsd thread.
> Because it doesn't have free() callback, it's a bit
> awkward but the threadfn itself can unlink and RCU-free it before returning.
It's only ever going to be referenced from the thread itself. This is
just a way to ask "am I running as an nfsd thread?" when we're deep
inside generic filesystem code somewhere. So I don't think there's any
complicated lifetime issues here.
--b.
next prev parent reply other threads:[~2020-05-05 16:23 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-01 16:01 [PATCH 0/4] allow multiple kthreadd's J. Bruce Fields
2020-05-01 16:01 ` [PATCH 1/4] kthreads: minor kthreadd refactoring J. Bruce Fields
2020-05-01 16:01 ` [PATCH 2/4] kthreads: Simplify tsk_fork_get_node J. Bruce Fields
2020-05-01 16:01 ` [PATCH 3/4] kthreads: allow multiple kthreadd's J. Bruce Fields
2020-05-01 16:01 ` [PATCH 4/4] kthreads: allow cloning threads with different flags J. Bruce Fields
2020-05-01 17:59 ` [PATCH 0/4] allow multiple kthreadd's Linus Torvalds
2020-05-01 18:21 ` Tejun Heo
2020-05-01 18:30 ` Linus Torvalds
2020-05-01 19:02 ` J. Bruce Fields
2020-05-01 18:49 ` J. Bruce Fields
2020-05-01 19:05 ` Trond Myklebust
2020-05-01 19:20 ` tj
2020-05-01 19:22 ` J. Bruce Fields
2020-05-05 2:15 ` J. Bruce Fields
2020-05-05 15:54 ` Tejun Heo
2020-05-05 16:23 ` J. Bruce Fields [this message]
2020-05-05 21:01 ` J. Bruce Fields
2020-05-05 21:09 ` Tejun Heo
2020-05-05 21:25 ` J. Bruce Fields
2020-05-06 15:36 ` J. Bruce Fields
2020-05-06 15:39 ` Tejun Heo
2020-05-06 15:54 ` J. Bruce Fields
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=20200505162353.GA27966@fieldses.org \
--to=bfields@fieldses.org \
--cc=bfields@redhat.com \
--cc=dhowells@redhat.com \
--cc=jlayton@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=shli@fb.com \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).