public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: mtosatti@redhat.com, mingo@redhat.com, gleb@redhat.com,
	glommer@parallels.com, tglx@linutronix.de, jeremy@goop.org,
	rostedt@goodmis.org, linux-kernel@vger.kernel.org
Subject: Re: sched: add notifier for cross-cpu migrations
Date: Wed, 10 Jul 2013 16:52:38 +0200	[thread overview]
Message-ID: <20130710145238.GW25631@dyad.programming.kicks-ass.net> (raw)
In-Reply-To: <20130710143902.GA28514@gmail.com>

On Wed, Jul 10, 2013 at 04:39:02PM +0200, Ingo Molnar wrote:
> 
> * Peter Zijlstra <peterz@infradead.org> wrote:
> 
> > Hi,
> > 
> > I just stumbled over commit 582b336ec2 and had a massive WTF moment.
> > 
> > The Changelog -- empty!
> > The Implementation -- complete crap!
> > 
> > fail^2.
> > 
> > A git grep later I find its x86_64 paravirt only.. for this we add 
> > unconditional crap to the scheduler?
> > 
> > At the _very_ least this should have been wrapped in a static_key and 
> > the changelog should have given some clue as to the what and why of this 
> > code.
> 
> My bad for letting it slip through...
> 
> Marcelo, mind implementing the suggestions from Peter?

So ideally we'd kill the entire notifier, notifiers make it far too easy for
others to use -- and I don't want silent users of stuff like this.

Ideally I'd see a direct callback:

  pvclock_migration_callback(t, new_cpu);

That compiles to 'do { } while (0);' for kernels without CONFIG_PARAVIRT.  Then
for paravirt it would use a static_key to get a real callback only if there's a
pvclock user.

Something like:

#define pvclock_migration_callback(_t, _cpu)			\
do {								\
	if (static_key_false(&pvclock_key))			\
		__pvclock_migration_callback((_t), (_cpu));	\
} while (0)

NOTE: static_key_false() doesn't test false, it assumes the default is false
and makes the function call the out-of-line jump -- horridly confusing function
name.

Your pvclock muck would do:

 static_key_slow_inc() -- for every new user and,
 static_key_slow_dec() -- for every user gone.

Its a reference count scheme, so that when there's no users there is only a 5
byte nop.

  reply	other threads:[~2013-07-10 14:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10 10:34 sched: add notifier for cross-cpu migrations Peter Zijlstra
2013-07-10 14:39 ` Ingo Molnar
2013-07-10 14:52   ` Peter Zijlstra [this message]
2013-07-11  1:21 ` [PATCH] remove sched " Marcelo Tosatti
2013-07-11  8:10   ` Gleb Natapov
2013-07-11 22:15     ` Marcelo Tosatti
2013-07-11  9:52   ` Peter Zijlstra
2013-07-14 11:16   ` Gleb Natapov
2013-08-23 10:22   ` Peter Zijlstra
2013-08-23 10:31     ` Gleb Natapov
2013-08-23 10:34       ` Peter Zijlstra

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=20130710145238.GW25631@dyad.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=gleb@redhat.com \
    --cc=glommer@parallels.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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