mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Shaohua Li <shli@fb.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Kernel-team@fb.com,
	Andy Lutomirski <luto@amacapital.net>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH v2 2/3] X86: add a generic API to let vdso code detect context switch
Date: Fri, 19 Dec 2014 02:05:50 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.11.1412190153530.17382@nanos> (raw)
In-Reply-To: <ecaea9066b4b0ff320bc03f23db56a9c2403a6b0.1418857018.git.shli@fb.com>

On Wed, 17 Dec 2014, Shaohua Li wrote:
> vdso code can't disable preempt, so it can be preempted at any time.
> This makes a challenge to implement specific features. This patch adds a
> generic API to let vdso code detect context switch.

Please change this to:

 This adds a complete trainwreck into the scheduler hotpath.
 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index b5797b7..d8e882d 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -2232,6 +2232,11 @@ static struct rq *finish_task_switch(struct task_struct *prev)
>  	struct rq *rq = this_rq();
>  	struct mm_struct *mm = rq->prev_mm;
>  	long prev_state;
> +#ifdef CONFIG_VDSO_CS_DETECT

Ever heard about header files and CONFIG dependent inline functions?

> +	int cpu = smp_processor_id();

If you think hard enough the you might find an even more expensive way
to figure out on which cpu you are running on.

> +	vdso_set_cpu_cs_timestamp(cpu);

So we hand in the cpu we are running on to update percpu data in non
preemptible context instead of handing in the really relevant data,
i.e. the timestamp which is readily available right here for free. I
bet the completely misnomed function will go through loops and hoops
to figure that out.

Thanks,

	tglx




  reply	other threads:[~2014-12-19  1:06 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-17 23:12 [PATCH v2 1/3] X86: make VDSO data support multiple pages Shaohua Li
2014-12-17 23:12 ` [PATCH v2 2/3] X86: add a generic API to let vdso code detect context switch Shaohua Li
2014-12-19  1:05   ` Thomas Gleixner [this message]
2014-12-17 23:12 ` [PATCH v2 3/3] X86: Add a thread cpu time implementation to vDSO Shaohua Li
2014-12-18 23:30   ` Andy Lutomirski
2014-12-19  0:22     ` Andy Lutomirski
2014-12-19  0:30       ` Shaohua Li
2014-12-19  0:32         ` Andy Lutomirski
2014-12-19  0:34         ` Thomas Gleixner
2014-12-19 11:23       ` Peter Zijlstra
2014-12-19 16:48         ` Andy Lutomirski
2014-12-19 17:03           ` Peter Zijlstra
2014-12-19 17:07             ` Andy Lutomirski
2014-12-19 17:27               ` Peter Zijlstra
2014-12-19 17:42                 ` Andy Lutomirski
2015-01-02  2:59             ` Shaohua Li
2015-01-02 15:31               ` David Ahern
2015-01-02 17:02                 ` Shaohua Li
2015-01-02 17:09                   ` David Ahern
2015-01-02 17:17                     ` Shaohua Li
2015-01-02 17:26                       ` David Ahern
2015-01-02 17:47               ` Andy Lutomirski
2015-01-05 23:23                 ` Shaohua Li
2015-01-06 10:18                   ` Peter Zijlstra
2015-01-06 16:59                     ` Shaohua Li
2015-01-12 19:50                     ` Shaohua Li
2014-12-19 17:42           ` Chris Mason
2014-12-19 17:53             ` Andy Lutomirski
2014-12-19 18:16               ` Shaohua Li

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=alpine.DEB.2.11.1412190153530.17382@nanos \
    --to=tglx@linutronix.de \
    --cc=Kernel-team@fb.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=shli@fb.com \
    --cc=x86@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

all inboxes | Powered by JetHome®