Skip to content

Commit 4907c68

Browse files
Peter ZijlstraKAGA-KOKO
authored andcommitted
x86/tsc: Force inlining of cyc2ns bits
Looking at the asm for native_sched_clock() I noticed we don't inline enough. Mostly caused by sharing code with cyc2ns_read_begin(), which we didn't used to do. So mark all that __force_inline to make it DTRT. Fixes: 59eaef7 ("x86/tsc: Remodel cyc2ns to use seqcount_latch()") Reported-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: hpa@zytor.com Cc: eric.dumazet@gmail.com Cc: bp@alien8.de Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20181011104019.695196158@infradead.org
1 parent 3a27203 commit 4907c68

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/x86/kernel/tsc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ struct cyc2ns {
5858

5959
static DEFINE_PER_CPU_ALIGNED(struct cyc2ns, cyc2ns);
6060

61-
void cyc2ns_read_begin(struct cyc2ns_data *data)
61+
void __always_inline cyc2ns_read_begin(struct cyc2ns_data *data)
6262
{
6363
int seq, idx;
6464

@@ -75,7 +75,7 @@ void cyc2ns_read_begin(struct cyc2ns_data *data)
7575
} while (unlikely(seq != this_cpu_read(cyc2ns.seq.sequence)));
7676
}
7777

78-
void cyc2ns_read_end(void)
78+
void __always_inline cyc2ns_read_end(void)
7979
{
8080
preempt_enable_notrace();
8181
}
@@ -104,7 +104,7 @@ void cyc2ns_read_end(void)
104104
* -johnstul@us.ibm.com "math is hard, lets go shopping!"
105105
*/
106106

107-
static inline unsigned long long cycles_2_ns(unsigned long long cyc)
107+
static __always_inline unsigned long long cycles_2_ns(unsigned long long cyc)
108108
{
109109
struct cyc2ns_data data;
110110
unsigned long long ns;

0 commit comments

Comments
 (0)