linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org, Paul Turner <pjt@google.com>,
	Andrew Hunter <ahh@google.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Andy Lutomirski <luto@amacapital.net>,
	Andi Kleen <andi@firstfloor.org>,
	Dave Watson <davejwatson@fb.com>, Chris Lameter <cl@linux.com>,
	Ingo Molnar <mingo@redhat.com>, Ben Maurer <bmaurer@fb.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Josh Triplett <josh@joshtriplett.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-api@vger.kernel.org
Subject: Re: [RFC PATCH 1/2] thread_local_abi system call: caching current CPU number (x86)
Date: Sun, 13 Dec 2015 19:15:27 +0100	[thread overview]
Message-ID: <20151213181527.GV15533@two.firstfloor.org> (raw)
In-Reply-To: <1449761990-23525-1-git-send-email-mathieu.desnoyers@efficios.com>

> This getcpu cache is an alternative to the sched_getcpu() vdso which has
> a few benefits:


Note the first version of getcpu() I proposed had a cache. But it was
rejected.

> - It is faster to do a memory read that to call a vDSO,
> - This cached value can be read from within an inline assembly, which
>   makes it a useful building block for restartable sequences.

On x86 we already have the de-facto ABI of using LSL with the magic
segment directly. While that is a few cycles slower than a memory load
I question the difference is big enough to justify a new system call,
and risk slow page fault in context switches.

BTW the vdso could be also optimized I think. For example glibc today
does some stupid (slow) things with it, like doing double iindirect
jumps.

-Andi

  parent reply	other threads:[~2015-12-13 18:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10 15:39 [RFC PATCH 1/2] thread_local_abi system call: caching current CPU number (x86) Mathieu Desnoyers
     [not found] ` <1449761990-23525-1-git-send-email-mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2015-12-10 15:39   ` [RFC PATCH 2/2] thread_local_abi: wire up ARM system call Mathieu Desnoyers
2015-12-10 16:27     ` Russell King - ARM Linux
     [not found]       ` <20151210162723.GN8644-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2015-12-10 16:59         ` Mathieu Desnoyers
2015-12-11 18:56 ` [RFC PATCH 1/2] thread_local_abi system call: caching current CPU number (x86) Michael Kerrisk (man-pages)
2015-12-12 12:40   ` Mathieu Desnoyers
     [not found]     ` <1734518724.233994.1449924035932.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2015-12-13  8:04       ` Michael Kerrisk (man-pages)
2015-12-13 18:15 ` Andi Kleen [this message]
     [not found]   ` <20151213181527.GV15533-1g7Xle2YJi4/4alezvVtWx2eb7JE58TQ@public.gmane.org>
2015-12-13 19:58     ` Mathieu Desnoyers
     [not found]       ` <450134747.239045.1450036728930.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
2015-12-13 20:18         ` Andi Kleen
     [not found]           ` <20151213201841.GW15533-1g7Xle2YJi4/4alezvVtWx2eb7JE58TQ@public.gmane.org>
2015-12-13 20:26             ` Andy Lutomirski

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=20151213181527.GV15533@two.firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=ahh@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=bmaurer@fb.com \
    --cc=cl@linux.com \
    --cc=davejwatson@fb.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).