Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp718839pxa; Wed, 12 Aug 2020 11:42:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXlUndSZtQN4bWce18BxnvXP04Rv146GcbdcoyLQ1YPHhUlZOUBdFPyOoAbLqoswTJQUaD X-Received: by 2002:a17:906:228a:: with SMTP id p10mr1145626eja.23.1597257778265; Wed, 12 Aug 2020 11:42:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597257778; cv=none; d=google.com; s=arc-20160816; b=THYvubivX40UN32uussdTkwF68MwQrkZdMJ7qIqGylW9mM/QonVVtna2YNj6mVYHQQ z+crwlz+MaEd2/jg/9GKUz+AV/ZcL5SOdjFmyxZD6o42prdcoDuau/mnSo/fDiQyU84y pPLz2wrfqjkRWNT7LanJrZmEOUwoCgQlxgQGAE9WqgLviLCTR+MWxf7f06rVibjwNqLe pZ/cL9d+WGcksxqIHylWUMggz93b1f4IZJJ2/zETBqOScIRVDTSb/pYimKxu/16M9Ne2 iL5UbvRJjVST3IYEB/kUs0kHHHhdcFn2N++1b0mRoP6OA7+MzxqbksyKOapNay3odjA0 //YA== 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:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=GERNw6px4Ki0+yA4XtuPmkwxICPnhGq3mjoPVHOd0ns=; b=kGXkRlsQOe9FUeC5SNuQDO6ILSAeXYGauUmeTmGO8UTEXTn/aUJggAGyMc2Tw9czk/ 1P1lKLQEgkKq+H6OW8G9Xrk2sSi2WP+ToyVpo4Z9AHTZR41q8C6d3hDvJS62COr1i4tL GHHf2LujeyoCfggrfDak+krJVJ7+mtSL7/20lXquVIA622e9etmEUJ7Y4YS2fwf4oiyy bitmFaGGrlGIioikswBujAGPlUnJug1eOW6vST6X7C34z//7GLSMTa384Mje35WUeEyo SgO5bFODuOlgx3/BZGUpocfCLvj01k9qsQC7QZDkhyoIB9KIpRpXiON+nXQ9tVA579cT Tbfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x7si1719366ejv.609.2020.08.12.11.42.33; Wed, 12 Aug 2020 11:42:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726528AbgHLSjW (ORCPT + 99 others); Wed, 12 Aug 2020 14:39:22 -0400 Received: from foss.arm.com ([217.140.110.172]:47510 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726447AbgHLSjW (ORCPT ); Wed, 12 Aug 2020 14:39:22 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 50F3FD6E; Wed, 12 Aug 2020 11:39:21 -0700 (PDT) Received: from [192.168.178.2] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E8D703F22E; Wed, 12 Aug 2020 11:39:13 -0700 (PDT) Subject: Re: [PATCH] sched/fair: reduce preemption with IDLE tasks runable(Internet mail) To: =?UTF-8?B?YmVuYmppYW5nKOiSi+W9qik=?= Cc: Jiang Biao , "mingo@redhat.com" , "peterz@infradead.org" , "juri.lelli@redhat.com" , "vincent.guittot@linaro.org" , "rostedt@goodmis.org" , "bsegall@google.com" , "mgorman@suse.de" , "linux-kernel@vger.kernel.org" References: <20200801023248.90104-1-benbjiang@gmail.com> <5ed0fd46-3a3d-3c1a-5d75-03a74864e640@arm.com> <592F24A7-BF43-457D-AC40-DC5E35279730@tencent.com> <8bef1f94-f9bf-08a5-2ff3-3485d7796a96@arm.com> <8629CB9F-AFC8-43D6-BD14-B60A0B85ADB3@tencent.com> <5f870781-1648-b4ac-6026-557dfc347109@arm.com> <4964e359-afc5-a256-4950-853a9485eeff@arm.com> <70236E62-AA36-48C1-9382-86353649253C@tencent.com> From: Dietmar Eggemann Message-ID: <3a1047fc-a86a-014a-b17a-eae71f669da1@arm.com> Date: Wed, 12 Aug 2020 20:39:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <70236E62-AA36-48C1-9382-86353649253C@tencent.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/08/2020 05:19, benbjiang(蒋彪) wrote: > Hi, > >> On Aug 11, 2020, at 11:54 PM, Dietmar Eggemann wrote: >> >> On 11/08/2020 02:41, benbjiang(蒋彪) wrote: >>> Hi, >>> >>>> On Aug 10, 2020, at 9:24 PM, Dietmar Eggemann wrote: >>>> >>>> On 06/08/2020 17:52, benbjiang(蒋彪) wrote: >>>>> Hi, >>>>> >>>>>> On Aug 6, 2020, at 9:29 PM, Dietmar Eggemann wrote: >>>>>> >>>>>> On 03/08/2020 13:26, benbjiang(蒋彪) wrote: >>>>>>> >>>>>>> >>>>>>>> On Aug 3, 2020, at 4:16 PM, Dietmar Eggemann wrote: >>>>>>>> >>>>>>>> On 01/08/2020 04:32, Jiang Biao wrote: >>>>>>>>> From: Jiang Biao [...] >> Trace a run of 2 SCHED_OTHER (nice 0) tasks and 1 SCHED_IDLE task on a >> single CPU and trace_printk the conditions 'if (delta < 0)' and ' if >> (delta > ideal_runtime)' in check_preempt_tick(). >> >> Then do the same with 3 SCHED_OTHER (nice 0) tasks. You can also change >> the niceness of the 2 SCHED_OTHER task to 19 to see some differences in >> the kernelshark's task layout. >> >> rt-app (https://github.com/scheduler-tools/rt-app) is a nice tool to >> craft those artificial use cases. > With rt-app tool, sched_switch traced by ftrace, the result is as what I expected, I use: { "tasks" : { "task_other" : { "instance" : 2, "loop" : 200, "policy" : "SCHED_OTHER", "run" : 8000, "timer" : { "ref" : "unique1" , "period" : 16000, "mode" : "absolute" }, "priority" : 0 }, "task_idle" : { "instance" : 1, "loop" : 200, "policy" : "SCHED_IDLE", "run" : 8000, "timer" : { "ref" : "unique2" , "period" : 16000, "mode" : "absolute" } } }, "global" : { "calibration" : 243, <-- Has to be calibrated against the CPU you run on !!! "default_policy" : "SCHED_OTHER", "duration" : -1 } } to have 2 (periodic) SCHED_OTHER and 1 SCHED_IDLE task. > ** 2normal+1idle: idle preempt normal every 600+ms ** During the 3.2s the 2 SCHED_OTHER tasks run, the SCHED_IDLE task is switched in only once, after ~2.5s. > ** 3normal+idle: idle preempt normal every 1000+ms ** Ah, this was meant to be 3 SCHED_OTHER tasks only! To see the difference in behavior. > ** 2normal(nice 19)+1idle(nice 0): idle preempt normal every 30+ms ** During the 3.2s the 2 SCHED_OTHER tasks run, the SCHED_IDLE task is switched in every ~45ms. [...]