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


Groups > linux.kernel > #1560032

Re: [RFC PATCH] membarrier: handle nohz_full with expedited thread registration

From Linus Torvalds <torvalds@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: [RFC PATCH] membarrier: handle nohz_full with expedited thread registration
Date 2017-01-16 21:20 +0100
Message-ID <t0lV0-5Di-17@gated-at.bofh.it> (permalink)
References <t0lBD-5ee-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Excuse my french, but this looks like incredible shit to me.

On Mon, Jan 16, 2017 at 11:51 AM, Mathieu Desnoyers
<mathieu.desnoyers@efficios.com> wrote:
> +
> +static int membarrier_register_expedited(struct task_struct *t)
> +{
> +       struct rq *rq;
> +
> +       if (t->membarrier_expedited == UINT_MAX)
> +               return -EOVERFLOW;
> +       rq = this_rq();
> +       raw_spin_lock(&rq->lock);
> +       t->membarrier_expedited++;
> +       raw_spin_unlock(&rq->lock);
> +       return 0;
> +}

Yeah, taking the rq lock with

 (a) a random "rq" that isn't stable

 (b) without disabling interrupts

 (c) using an internal scheduler helper that isn't supposed to be used
externally

 (d) when it doesn't even make any sense in the first place for a
per-thread value that is never modified by any other threads!

 (e) .. and you expose this ABSOLUTELY SHIT as a random system call.

Oh, and the clone semantics make no sense either.

In fact, it just makes me doubt everything about the whole membarrier
concept, because it appears *so* terminally broken.

So unless I'm seriously missing something, this is just about the
worst piece of code I have seen this year.

No.

NO NO NO.

It really smells so broken that I'm wondering if I'm missing anything.
But I don't think I am. I think the code is just pure garbage.

                  Linus

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH] membarrier: handle nohz_full with expedited thread registration Mathieu Desnoyers <mathieu.desnoyers@efficios.com> - 2017-01-16 21:00 +0100
  Re: [RFC PATCH] membarrier: handle nohz_full with expedited thread registration Linus Torvalds <torvalds@linux-foundation.org> - 2017-01-16 21:20 +0100
    Re: [RFC PATCH] membarrier: handle nohz_full with expedited thread  registration Mathieu Desnoyers <mathieu.desnoyers@efficios.com> - 2017-01-17 00:10 +0100
      Re: [RFC PATCH] membarrier: handle nohz_full with expedited thread registration Linus Torvalds <torvalds@linux-foundation.org> - 2017-01-17 01:00 +0100
        Re: [RFC PATCH] membarrier: handle nohz_full with expedited thread  registration Mathieu Desnoyers <mathieu.desnoyers@efficios.com> - 2017-01-17 03:10 +0100
      Re: [RFC PATCH] membarrier: handle nohz_full with expedited thread  registration Frederic Weisbecker <fweisbec@gmail.com> - 2017-01-17 05:00 +0100
        Re: [RFC PATCH] membarrier: handle nohz_full with expedited thread  registration Mathieu Desnoyers <mathieu.desnoyers@efficios.com> - 2017-01-17 23:00 +0100
          Re: [RFC PATCH] membarrier: handle nohz_full with expedited thread  registration Steven Rostedt <rostedt@goodmis.org> - 2017-01-18 00:40 +0100
        Re: [RFC PATCH] membarrier: handle nohz_full with expedited thread  registration "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-17 23:10 +0100
          Re: [RFC PATCH] membarrier: handle nohz_full with expedited thread  registration Peter Zijlstra <peterz@infradead.org> - 2017-01-18 12:10 +0100
            Re: [RFC PATCH] membarrier: handle nohz_full with expedited thread registration Paul McKenney <paulmckrcu@gmail.com> - 2017-01-19 23:10 +0100

csiph-web