Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6478974ybc; Wed, 27 Nov 2019 23:51:27 -0800 (PST) X-Google-Smtp-Source: APXvYqxq5nEqsQymgAvcOLQeGySFgEZRkWSNVdZa0cJbc1abKr2mBMZwX8r4opMhhd+5w/tNgUgL X-Received: by 2002:a17:906:80d5:: with SMTP id a21mr52974690ejx.114.1574927487411; Wed, 27 Nov 2019 23:51:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574927487; cv=none; d=google.com; s=arc-20160816; b=Y+eueW7eWGvpSFQCtvqd1Cc3snW0wjWm6sjOb+8ZJ4ct0GUa6lM9WpJG6o8Yfq9HRk NsF4J3ijZSWezuZO24cII6iFVQSJthECQ5ABNYlahlPiLkSWWv/KECfkNJnvwaKECzsn NcxYEy91cx7Ur5PRFQRYBMkNclZaBmdxFVFfuEEyw8iqath+lFEpYtzH6rdlM0MwPb5K 5WTjiLEVkDBXevNUV7lLaUvxyqn9MCXSrHMbhPkgnkuaAbtdX/clAz4hlD3Uj/n3syaL GCvWcLKXMO9gtGSAqH9fSiWPZrq9WZul7cOKUhkuOXJ4OcQCuCrCbHe35Oejv0Qrx5WC KfGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:subject :from:to:dkim-signature; bh=jdx2MQkwvcftTUnPZKqg3iJvEsTP5EAA9GMYXynV6xQ=; b=Z43APoUrTOCy3RZhT4XthF1jxbekvQPnu9bWjIcHLCd/hkV+DVm7T/KrLWGLbnJVua BXwws/JLfCjouqZJ1jrqjzIpTe11u4fFMit7T6bMgGpP9f76KVsmEyNCtSStuvsc6Q20 8DNVc4vD1j51QLM0cHzMLEqmFObMSkQQ5WwlxHCJLRxoxRx/wrg2NwiuaoY+MMmLv47I JEMTbBvuT40zuJwhhKURvq8altxCJlSg/F9OTrcMB6nkctwjcq1+4HK4+R7s9gMJbI6r yFzTO0gdSSiyZQakPgSeCPftNo29tYFQ1eKTWgebn9OpMEWKllhZrT2PiOF2AlDSNHMY 1NJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=AjiQgysK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11si14097031ede.45.2019.11.27.23.51.03; Wed, 27 Nov 2019 23:51:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=AjiQgysK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727124AbfK1Hqj (ORCPT + 99 others); Thu, 28 Nov 2019 02:46:39 -0500 Received: from mail-lf1-f49.google.com ([209.85.167.49]:32968 "EHLO mail-lf1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726448AbfK1Hqj (ORCPT ); Thu, 28 Nov 2019 02:46:39 -0500 Received: by mail-lf1-f49.google.com with SMTP id d6so19299284lfc.0 for ; Wed, 27 Nov 2019 23:46:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=to:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=jdx2MQkwvcftTUnPZKqg3iJvEsTP5EAA9GMYXynV6xQ=; b=AjiQgysKXtXC/dybUet8gn6KnPqsNuMCOSKRFTHcLFeRA19rTM5+ZQF+4BlJ9HqGTw 88a1dYswJkqzye6tyQxnf5B4csb0v3fz9cEK1OEMEJmIIJv6GgkT12Y9PKWLhppWk5nQ 3F1UxNBCvX2JoVhrDwdDGLda3WNwhtyZVkyN0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=jdx2MQkwvcftTUnPZKqg3iJvEsTP5EAA9GMYXynV6xQ=; b=Rw3TBSDLYdCttZiIq5/BD9OPFEScTqcdP7QckNGcswNiFrTR7+M1M5P+QJo2WCSXvX a/IfJJVbuMmPUhK1G5vJS2Hgr/eosZ5O92J6FxREp004VHdoDQ/msvqHpytxQxph0BA6 RFlP7cVXboYkjGCR5g61Ke5Z+PtjdKOMnFsF738LReaEOtDC4SuC3z3M3Qm4kcn1cfoz kTuCXZxge8Xkj5ZYlw45SmiN0w4lumi85iZSMZGwRzvhgq1XrknYjFWVnMXXibMEy+4U znWN3iu1JDzUZhVGOAZMky7VmlOdjAiZoI8UJuYEBqus/jwJh6n7jxfwgQ5l5kQkr4+d 7KXA== X-Gm-Message-State: APjAAAWMpPETnbSmqljMwJSAj2pB88ppPMqv2EoAqJcZFZuq9VQdH0bC nkpC1wi5BfGFeQJri09gxpLdyw== X-Received: by 2002:ac2:5616:: with SMTP id v22mr21215766lfd.84.1574927196815; Wed, 27 Nov 2019 23:46:36 -0800 (PST) Received: from [172.16.11.28] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id 129sm8224582lfj.86.2019.11.27.23.46.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Nov 2019 23:46:36 -0800 (PST) To: LKML , Ingo Molnar , Peter Zijlstra From: Rasmus Villemoes Subject: Optimization in pick_next_task Message-ID: <9af14b44-81c7-cdb1-ed4f-2f684f9fdbb3@rasmusvillemoes.dk> Date: Thu, 28 Nov 2019 08:46:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In kernel/sched/core.c, we have /* * Optimization: we know that if all tasks are in the fair class we can * call that function directly, But then the code goes on to do p = fair_sched_class.pick_next_task(rq, prev, rf); ... if (unlikely(!p)) p = idle_sched_class.pick_next_task(rq, prev, rf); which still loads a function pointer and calls pick_next_task_{fair,idle} through that. Should those be made extern and used here, or am I misinterpreting what "directly" refers to? Rasmus