Skip to content

Commit 020d91e

Browse files
Kan LiangPeter Zijlstra
authored andcommitted
perf/x86/intel/lbr: Mark the {rd,wr}lbr_{to,from} wrappers __always_inline
The {rd,wr}lbr_{to,from} wrappers are invoked in hot paths, e.g. context switch and NMI handler. They should be always inline to achieve better performance. However, the CONFIG_OPTIMIZE_INLINING allows the compiler to uninline functions marked 'inline'. Mark the {rd,wr}lbr_{to,from} wrappers as __always_inline to force inline the wrappers. Suggested-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Kan Liang <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 5624986 commit 020d91e

File tree

1 file changed

+4
-4
lines changed
  • arch/x86/events/intel

1 file changed

+4
-4
lines changed

arch/x86/events/intel/lbr.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,18 +332,18 @@ static u64 lbr_from_signext_quirk_rd(u64 val)
332332
return val;
333333
}
334334

335-
static inline void wrlbr_from(unsigned int idx, u64 val)
335+
static __always_inline void wrlbr_from(unsigned int idx, u64 val)
336336
{
337337
val = lbr_from_signext_quirk_wr(val);
338338
wrmsrl(x86_pmu.lbr_from + idx, val);
339339
}
340340

341-
static inline void wrlbr_to(unsigned int idx, u64 val)
341+
static __always_inline void wrlbr_to(unsigned int idx, u64 val)
342342
{
343343
wrmsrl(x86_pmu.lbr_to + idx, val);
344344
}
345345

346-
static inline u64 rdlbr_from(unsigned int idx)
346+
static __always_inline u64 rdlbr_from(unsigned int idx)
347347
{
348348
u64 val;
349349

@@ -352,7 +352,7 @@ static inline u64 rdlbr_from(unsigned int idx)
352352
return lbr_from_signext_quirk_rd(val);
353353
}
354354

355-
static inline u64 rdlbr_to(unsigned int idx)
355+
static __always_inline u64 rdlbr_to(unsigned int idx)
356356
{
357357
u64 val;
358358

0 commit comments

Comments
 (0)