All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] schedule: use unlikely()
@ 2017-11-13 19:00 Mikulas Patocka
  2017-11-24  7:38 ` Ingo Molnar
  2017-11-25  8:56 ` Greg KH
  0 siblings, 2 replies; 13+ messages in thread
From: Mikulas Patocka @ 2017-11-13 19:00 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, linux-kernel

A small patch for schedule(), so that the code goes straght in the common
case.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 include/linux/blkdev.h |    2 +-
 kernel/sched/core.c    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6/include/linux/blkdev.h
===================================================================
--- linux-2.6.orig/include/linux/blkdev.h
+++ linux-2.6/include/linux/blkdev.h
@@ -1308,7 +1308,7 @@ static inline bool blk_needs_flush_plug(
 {
 	struct blk_plug *plug = tsk->plug;
 
-	return plug &&
+	return unlikely(plug != NULL) &&
 		(!list_empty(&plug->list) ||
 		 !list_empty(&plug->mq_list) ||
 		 !list_empty(&plug->cb_list));
Index: linux-2.6/kernel/sched/core.c
===================================================================
--- linux-2.6.orig/kernel/sched/core.c
+++ linux-2.6/kernel/sched/core.c
@@ -3405,7 +3405,7 @@ void __noreturn do_task_dead(void)
 
 static inline void sched_submit_work(struct task_struct *tsk)
 {
-	if (!tsk->state || tsk_is_pi_blocked(tsk))
+	if (!tsk->state || unlikely(tsk_is_pi_blocked(tsk)))
 		return;
 	/*
 	 * If we are going to sleep and we have plugged IO queued,

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-12-08 14:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-13 19:00 [PATCH] schedule: use unlikely() Mikulas Patocka
2017-11-24  7:38 ` Ingo Molnar
2017-11-24 18:47   ` Mikulas Patocka
2017-11-25  8:16     ` Ingo Molnar
2017-11-28  3:36       ` Mikulas Patocka
2017-11-25  8:56 ` Greg KH
2017-11-28  0:05   ` Mikulas Patocka
2017-11-28  7:22     ` Greg KH
2017-11-30  7:04       ` Mikulas Patocka
2017-11-30  8:07         ` Greg KH
2017-12-08 14:30           ` Pavel Machek
2017-12-08 14:56             ` Greg KH
2017-12-08 14:29       ` Pavel Machek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.