From: Oleg Nesterov <oleg@redhat.com>
To: David Howells <dhowells@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] change current_is_single_threaded() to use for_each_thread()
Date: Wed, 7 Oct 2015 13:54:04 +0200 [thread overview]
Message-ID: <20151007115404.GA20428@redhat.com> (raw)
In-Reply-To: <7744.1444210762@warthog.procyon.org.uk>
On 10/07, David Howells wrote:
>
> Oleg Nesterov <oleg@redhat.com> wrote:
>
> > Change current_is_single_threaded() to use for_each_thread() rather
> > than deprecated while_each_thread().
>
> Wouldn't the old way be more efficient, given there's always going to be at
> least one thread?
Yes, unfortunately. Before this change (in the likely case) we never
do next_thread(), after this patch we always do list_first_entry().
> Granted, it's not much of an efficiency boost...
Yes, and while_each_thread() is buggy. See the changelog in 0c740d0afc
"introduce for_each_thread() to replace the buggy while_each_thread().
Yes, the race is almost purely theoretical, but still.
To clarify, we had some "real" bugs fixed by s/while_each_thread/
for_each_thread/, but only because while_each_thread() was used wrongly.
for_each_thread() is more safe, it only needs the stable task_struct.
Oleg.
next prev parent reply other threads:[~2015-10-07 11:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-05 12:00 Oleg Nesterov
2015-10-07 9:39 ` David Howells
2015-10-07 11:54 ` Oleg Nesterov [this message]
2015-10-07 13:50 ` David Howells
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=20151007115404.GA20428@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome