Received: by 10.213.65.68 with SMTP id h4csp3366049imn; Tue, 3 Apr 2018 03:45:28 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+WWApHNV8vot4ZZLjuuOvY9v0gx82UgHGp9qw4nDHLEgoua/L0slljh2ao4mbluH9T5lUl X-Received: by 10.99.4.3 with SMTP id 3mr8749547pge.147.1522752328378; Tue, 03 Apr 2018 03:45:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522752328; cv=none; d=google.com; s=arc-20160816; b=E/tIrfdbgEQvG7wR1gsnWv2ZDm8cv+f44yZya8OKRmLZwDj6KDKis2zpkz2aqzKAPq wchY+4GNNdcQq6U43ckBHIb7JAwLYWVWVtUFxzdiER3zuDqJriwKx2SkMJDcuEUVoRjg VWIlvj88RYE6gy0r2UCuI/dE9Cmei97QyMuXxB4Af5TAYUsM9ofD/MZe9q4vwp2PrT17 yZ3GMj5mvhqw2krjpJcFBE0C186Jc2o/0u6uBtyLuDq8hYnrpSXM8FzHMrkeOGekl5m3 LOzaEo5oS6DMNL5UIuVRw3rq35NH3vHDqEzDA/tvL8314jLU883wcpKbGqeOqXdTfIlx lyMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id:date :subject:cc:to:from:arc-authentication-results; bh=/1uphIUgbqrIrZmKmM1iDupSnW6QzkDOhu35e+cExWg=; b=L7SgYBd7QsECzwor/XFeEzK1+EPmDlbbewNz+Zva7vVNDXTPuYBKwEcco5c25Q3+fm k2ViwkOui62py3w5zbGOSZLERSgQY1KRDYQI7D1zFQGHAkQHecShvUfaWtVZzpo3PA10 D16c50haEGy/WHY86Enog8zqcayCciAOP+kbYFf0hO+JEUrHOrANdNe44ztRUbySIihG n/rLD8PXTe5KHwwhNwJWljwkqD4173iY5C1c7ydi6okcBDRtnrDR0hJ0DGUED9mq1Tfh wWmercRtHjadBSdPpAQ00LQKUZnVUu5aiDDuIgCxcT7sRFn4jftVwiaSOuOnB4ZsQLAs T2Cg== ARC-Authentication-Results: i=1; mx.google.com; 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 d128si1752119pgc.445.2018.04.03.03.45.14; Tue, 03 Apr 2018 03:45:28 -0700 (PDT) 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; 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 S1755172AbeDCKoG (ORCPT + 99 others); Tue, 3 Apr 2018 06:44:06 -0400 Received: from listserv2.niif.hu ([193.225.14.155]:50620 "EHLO listserv2.niif.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752789AbeDCKoF (ORCPT ); Tue, 3 Apr 2018 06:44:05 -0400 X-Greylist: delayed 1172 seconds by postgrey-1.27 at vger.kernel.org; Tue, 03 Apr 2018 06:44:05 EDT Received: from business-188-142-225-206.business.broadband.hu ([188.142.225.206] helo=lant.ki.iif.hu) by listserv2.niif.hu with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1f3J79-0003Nt-7q; Tue, 03 Apr 2018 12:24:31 +0200 Received: from wferi by lant.ki.iif.hu with local (Exim 4.89) (envelope-from ) id 1f3J73-00044D-Q7; Tue, 03 Apr 2018 12:24:25 +0200 From: wferi@niif.hu (Ferenc =?utf-8?Q?W=C3=A1gner?=) To: linux-kernel@vger.kernel.org Cc: wferi@niif.hu Subject: What's the priority of the idle task? Date: Tue, 03 Apr 2018 12:24:25 +0200 Message-ID: <87muykk2p2.fsf@lant.ki.iif.hu> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, (Please let me ask my Stackexchange question [1] here as well in the hope of getting an answer from this board of dedicated experts.) As explained by several (if somewhat old) articles [2,3,4], the Linux idle task (PID=0, one per CPU) is run when there are no other tasks to run. To get the scheduler do this, the idle task must have the lowest priority reserved for it. That old Documentation/ftrace.txt in the linked LWN article explicitly says that > The prio "140" is reserved for the idle task which is the lowest > priority thread (pid 0). This makes sense, but under Linux 4.9 # perf record -e sched:sched_switch sleep 1 # perf script sleep 6526 [000] 362661.310842: sched:sched_switch: sleep:6526 [120] S ==> swapper/0:0 [120] reports a priority of 120 for swapper/0 (in the closing bracket), contradicting the above. How does the Linux scheduler handle the idle task nowadays? The commits removing the quoted text from ftrace.txt (87d80de28, 294ae4011) didn't help. Please Cc me on answers/comments. Thanks, Feri. [1] https://unix.stackexchange.com/questions/435089/whats-the-priority-of-the-idle-task [2] https://superuser.com/a/972581/462180 [3] https://lwn.net/Articles/290277/ [4] https://unix.stackexchange.com/questions/361245/what-does-an-idle-cpu-process-do