Received: by 10.213.65.68 with SMTP id h4csp809802imn; Wed, 4 Apr 2018 07:39:17 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/4yxkrlljld4Xva5MNsr9BMfrU+87ZwPvJhNP0/QPtFNvP3KNDyIgjAfecFaGk69/M7pnH X-Received: by 2002:a17:902:141:: with SMTP id 59-v6mr19375907plb.219.1522852757366; Wed, 04 Apr 2018 07:39:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522852757; cv=none; d=google.com; s=arc-20160816; b=f0s0WfX9hgkLZuaafZQBLAGmYb770CgLjbuRWULcO49MP2cijDcZ6EJ3BoJZbQJ+mi nGkm18EvlPypaEfDCFVhetNJHnhdIez8oBxoA/bnZRzYHkZddGIeQEDBw8vbw6kLebYc 2LaoFMcdpLNkzVn6zSBBzrhU74AtSSU7JL7vpE6ht7Xilvd10Y8z0MVbjct1BidWoyW7 fvyQjYX0USAlHTVJPQAwzNTzFPTORVn1UHUkQ4gJGe6DrcMvjOOPsJKro6eriv4APekb Mv36EgxNNG4ONU9b+maQ88uBaV1NQybeloCkwq2Od5ISO0ZJy2M9VKx25ZmI89Ge2hcV OoHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :mail-followup-to:message-id:subject:cc:to:date:from:dkim-signature :arc-authentication-results; bh=Ao1byztYM+Rr1fZ7WqIhdeuHByb70YRoiDWXwI138to=; b=iBVyArjbV/vmAiUgJwC1Aqjwks0vRUAsAdBp9smw+ynDQArzv7FYVpdAPDAGgsOfVS QQ+28iWK2Yl0IxLXG5dgfNi5BQKQKK8aRdSF3CoDqtLa1xa/awTpRJsxl8fTKbl1Mv3a zY4LtYjlN67Q3EocJAXBy3wQKV8ciNB/AUahq7H3C86rZ9mCImrz94ds2/sXO6Ne6FPW 7qP/W86rgFoPp+udPCXSnpdNA0EnoUOYxkvvG/KRMZyVHuOW6sPEuzyQqXDHngqKfKCF coYbLUfaOv9h+ipjUC19jJe7NOg3yqg9Yc+RcM2ZVVNFk6o83IuJF8DDpjpPe1cUKxRo WMHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=lWGL2r5N; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g1-v6si3235171plm.747.2018.04.04.07.39.02; Wed, 04 Apr 2018 07:39:17 -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; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=lWGL2r5N; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751363AbeDDOhk (ORCPT + 99 others); Wed, 4 Apr 2018 10:37:40 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:40555 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751244AbeDDOhi (ORCPT ); Wed, 4 Apr 2018 10:37:38 -0400 Received: by mail-wm0-f44.google.com with SMTP id x4so43114538wmh.5 for ; Wed, 04 Apr 2018 07:37:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:date:to:cc:subject:message-id:mail-followup-to:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=Ao1byztYM+Rr1fZ7WqIhdeuHByb70YRoiDWXwI138to=; b=lWGL2r5NxM1rjGMWT5pDUxePfYIg9x1CY50E7SE/ZOAzbqM9BKEuX1XyeXSO4b6AAQ hXl7QEwMUUrmIYvSfTVMcYdgF3IMPMh9ZEqASpg1AT7O8XfjpLhxyuqbAf2b84AL5G+b FwdaI0CtL0YXq79jpiSItIdoWCBv40QJebQYOT7mnVjGougf34nX1PjwZYEG6sK5Fhl+ hHsZUeFIVRhftLEIEDdNQAH+70xRT48fBBkTU2MN9SnELA1KiEZn7qKsdAWmDay1Tw1N DKT7MIJ8ZBRYR7rQTO7nIV6Glz4bk2uCE2eavlciZLCU4gxnMXH43Js0q9Cdw7a5gl+8 QdYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id :mail-followup-to:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=Ao1byztYM+Rr1fZ7WqIhdeuHByb70YRoiDWXwI138to=; b=PbA5ATOsMg9ozUV2qvtoq7co5vwG+AhIp8t4UAFjdWKkdYek1imYvIX7komEAnXulK TESV9jVbpsacfip9iXzVbvaj1ROLtBxAxhXH1AI6sXH5KnWRLrk/uWWGmwzChvAkXC2a emN5KwapVzGx2274N0hOw3OCgPKSg54F8BEE48pL4P9awa1YtjG9xl9BfYshMIo5KKiJ hVRtXCCeLxJG7PXGaHq+9BLobO4AaYI+0rvQR9QAd0ndePr0nUo/qDfCendHMvjHStRy 51dRs2G2wQu+xuAOhF5dnbjOHab41koas2RVUoR6LT6gq2YrWKS13IrNUaGRSgubNDyo 0lVw== X-Gm-Message-State: ALQs6tBgh4rqvLo190wX1luoaPp63lZv0QaR0Odq0U/YnryiZTkNciYm QL8gw50bu04nQxX3PHUGA8U= X-Received: by 10.28.173.77 with SMTP id w74mr5092781wme.60.1522852657409; Wed, 04 Apr 2018 07:37:37 -0700 (PDT) Received: from localhost ([141.76.49.26]) by smtp.googlemail.com with ESMTPSA id r126sm5865441wmb.10.2018.04.04.07.37.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Apr 2018 07:37:36 -0700 (PDT) From: Till Smejkal X-Google-Original-From: Till Smejkal Date: Wed, 4 Apr 2018 16:37:35 +0200 To: Ferenc =?iso-8859-1?Q?W=E1gner?= Cc: linux-kernel@vger.kernel.org Subject: Re: What's the priority of the idle task? Message-ID: <20180404143735.GA23925@aton> Mail-Followup-To: Ferenc =?iso-8859-1?Q?W=E1gner?= , linux-kernel@vger.kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87muykk2p2.fsf@lant.ki.iif.hu> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 03 Apr 2018, Ferenc W?gner wrote: > 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. The idle task has its own scheduling class that only handles the idle threads per CPU core. This scheduling class has the lowest priority of the scheduling classes available in the kernel. This means that it is the last one in the list of scheduling classes that are asked at a task switch whether they have a task to schedule on the CPU. Hence, the idle task is not managed by CFS and accordingly doesn't have any nice value or priority (or at least it is not important nowadays). Interesting files in the kernel source that might contain more information are kernel/sched/idle_task.c, kernel/sched/sched.h and kernel/sched/core.c. Regards Till