[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CY4PR15MB1688286D6B1283A1C234BAE6CF4E0@CY4PR15MB1688.namprd15.prod.outlook.com>
Date: Wed, 18 Oct 2017 16:41:44 +0000
From: Ben Maurer <bmaurer@...com>
To: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Boqun Feng <boqun.feng@...il.com>,
"Peter Zijlstra" <peterz@...radead.org>,
Paul Turner <pjt@...gle.com>, Andrew Hunter <ahh@...gle.com>,
Andy Lutomirski <luto@...capital.net>,
Dave Watson <davejwatson@...com>,
Josh Triplett <josh@...htriplett.org>,
Will Deacon <will.deacon@....com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Thomas Gleixner" <tglx@...utronix.de>,
Andi Kleen <andi@...stfloor.org>,
"Chris Lameter" <cl@...ux.com>, Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
Steven Rostedt <rostedt@...dmis.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Russell King <linux@....linux.org.uk>,
Catalin Marinas <catalin.marinas@....com>,
Michael Kerrisk <mtk.manpages@...il.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
"linux-api@...r.kernel.org" <linux-api@...r.kernel.org>
Subject: Re: [RFC PATCH v9 for 4.15 01/14] Restartable sequences system call
> The layout of struct rseq_cs is as follows:
> start_ip
> Instruction pointer address of the first instruction of the
> sequence of consecutive assembly instructions.
> post_commit_ip
> Instruction pointer address after the last instruction of
> the sequence of consecutive assembly instructions.
> abort_ip
> Instruction pointer address where to move the execution
> flow in case of abort of the sequence of consecutive assem‐
> bly instructions.
Really minor performance performance thought here.
1) In the kernel at context switch time you'd need code like:
if (ip >= start_ip && ip <= post_commit_ip)
This branch would be hard to predict because most instruction pointers would be either before or after. If post_commit_ip were relative to start_ip you could do this:
if (ip - start_ip <= post_commit_offset)
which is a single branch that would be more predictable.
2) In a shared library a rseq_cs structure would have to be relocated at runtime because at compilation time the final address of the library wouldn't be known. I'm not sure if this is important enough to address, but it could be solved by making the pointers relative to the address of rseq_cs. But this would make for an uglier API.
Powered by blists - more mailing lists