From: David Howells <dhowells@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: David Howells <dhowells@redhat.com>,
Trond Myklebust <trond.myklebust@fys.uio.no>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rxrpc: use kthread_ API
Date: Tue, 14 Feb 2006 20:04:04 +0000 [thread overview]
Message-ID: <8623.1139947444@warthog.cambridge.redhat.com> (raw)
In-Reply-To: <20060214195130.GA21442@lst.de>
Christoph Hellwig <hch@lst.de> wrote:
> > > + krxiod_thread = kthread_run(rxrpc_krxiod, NULL, "krxiod");
> > > + if (IS_ERR(krxiod_thread))
> > > + return PTR_ERR(krxiod_thread);
> > > + return 0;
> >
> > Don't assign an error to (rxrpc_)krxiod_thread.
>
> Well, kthread_run can returns errors. If you want to avoid that for
> some reasons we'd need a local varibale
So what? There's an implicit local variable anyway. The compiler doesn't pass
the address of rxrpc_krxiod_thread to kthread_run() so that the latter can
fill it in; the result is returned in a register. Sticking a local variable in
the source would just attach a label to that register. Moving the assignment
to the global variable to after the error checking if-statement would then
mean the store instruction is emitted after the branch rather than before it.
> , which would be rather silly.
No. It'd probably be faster in the error case (no write to the memory).
> Note that there's nothing it could pollute, once one of these fails
> rxrpc_initialise goes to the error path, unwinds and returns a failure,
> so the rxrpc module never goes live.
At the moment, there's nothing it can pollute, you mean. Although you're
probably correct, it costs very little to program defensively in this case,
and in fact it's probably cheaper in execution time, even if it's a little
more expensive in terms of source code and work for you.
David
next prev parent reply other threads:[~2006-02-14 20:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-14 17:52 [PATCH] rxrpc: use kthread_ API Christoph Hellwig
2006-02-14 18:20 ` David Howells
2006-02-14 19:51 ` Christoph Hellwig
2006-02-14 20:04 ` David Howells [this message]
2006-02-14 20:14 ` Christoph Hellwig
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=8623.1139947444@warthog.cambridge.redhat.com \
--to=dhowells@redhat.com \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=trond.myklebust@fys.uio.no \
/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