From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754542AbdKMTAr (ORCPT ); Mon, 13 Nov 2017 14:00:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37542 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754474AbdKMTAq (ORCPT ); Mon, 13 Nov 2017 14:00:46 -0500 Date: Mon, 13 Nov 2017 14:00:45 -0500 (EST) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org Subject: [PATCH] schedule: use unlikely() Message-ID: User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 13 Nov 2017 19:00:46 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A small patch for schedule(), so that the code goes straght in the common case. Signed-off-by: Mikulas Patocka --- 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,