Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1241294 > unrolled thread

Re: [PATCH] change current_is_single_threaded() to use for_each_thread()

Started byDavid Howells <dhowells@redhat.com>
First post2015-10-07 11:40 +0200
Last post2015-10-07 16:00 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] change current_is_single_threaded() to use for_each_thread() David Howells <dhowells@redhat.com> - 2015-10-07 11:40 +0200
    Re: [PATCH] change current_is_single_threaded() to use  for_each_thread() Oleg Nesterov <oleg@redhat.com> - 2015-10-07 14:00 +0200
      Re: [PATCH] change current_is_single_threaded() to use for_each_thread() David Howells <dhowells@redhat.com> - 2015-10-07 16:00 +0200

#1241294 — Re: [PATCH] change current_is_single_threaded() to use for_each_thread()

FromDavid Howells <dhowells@redhat.com>
Date2015-10-07 11:40 +0200
SubjectRe: [PATCH] change current_is_single_threaded() to use for_each_thread()
Message-ID<qgTmx-P7-15@gated-at.bofh.it>
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?  Granted, it's not much of an efficiency boost...

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1241411 — Re: [PATCH] change current_is_single_threaded() to use for_each_thread()

FromOleg Nesterov <oleg@redhat.com>
Date2015-10-07 14:00 +0200
SubjectRe: [PATCH] change current_is_single_threaded() to use for_each_thread()
Message-ID<qgVy3-3SB-21@gated-at.bofh.it>
In reply to#1241294
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.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1241522

FromDavid Howells <dhowells@redhat.com>
Date2015-10-07 16:00 +0200
Message-ID<qgXqb-6Da-27@gated-at.bofh.it>
In reply to#1241411
Oleg Nesterov <oleg@redhat.com> wrote:

> 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.

Fair enough.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web