mbox series

[0/2] fix likely hint of sched_info_on()

Message ID 1562240775-16086-1-git-send-email-wang.yi59@zte.com.cn (mailing list archive)
Headers show
Series fix likely hint of sched_info_on() | expand

Message

Yi Wang July 4, 2019, 11:46 a.m. UTC
When make defconfig, CONFIG_SCHEDSTATS is set to be y, so
sched_info_on() is 'likely' to be true. However, some functions
invoke this function with unlikely hint or use no hint. Let's
fix this.

Yi Wang (2):
  kvm: x86: add likely to sched_info_on()
  sched: fix unlikely use of sched_info_on()

 arch/x86/kvm/cpuid.c | 2 +-
 kernel/sched/stats.h | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Peter Zijlstra July 4, 2019, 12:17 p.m. UTC | #1
On Thu, Jul 04, 2019 at 07:46:13PM +0800, Yi Wang wrote:
> When make defconfig, CONFIG_SCHEDSTATS is set to be y, so
> sched_info_on() is 'likely' to be true. However, some functions
> invoke this function with unlikely hint or use no hint. Let's
> fix this.

How about remove the hint entirely? likely(1) is as rediculous as
unlikely(1), a constant is a constant and no amount of hinting should
make the compiler do anything else.

And if you want to retain the hint for the TASK_DELAY_ACCT nonsense,
stick it there.

Also, fix the lack of { } while you're there.