Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp525985pxa; Wed, 19 Aug 2020 07:58:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMXzT2rkAjeVJfUIjfe4v+QOKyCIaOL2GC9FuDNrRb/fBjHdsUlujQ76YtVQoTKyKuQz49 X-Received: by 2002:a17:906:ecf9:: with SMTP id qt25mr26288217ejb.478.1597849088291; Wed, 19 Aug 2020 07:58:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597849088; cv=none; d=google.com; s=arc-20160816; b=s81xUnbrMN+s77qQQFlY0k79UjKEP7Q7WKEIizg3f9q3Ei0fXVlUbIf2RBS+c1CgBy nNFUhfFzXdnYkZMtuTx6VyNo4+hHDX6SGI5SUjZIpLUWJCe+xST6OX7IAV8xK/MhGCt8 WaVn9DbrSTRszBQiWR69rSGK3af0S39UOVE3bcaFelcMDUmsT1YK5Ds0Kx2WwiIGs82g udwwhfNv2uJK5nTsYfUxAk6xIKA2dH4RmFFhGcXw0odiyY+c3jf5TvxEFyJk/Ua6gdVX 3JqcR07+93vSysVuF+0zPpeeB4cJI34slWu7vfFBrKdppzcC6K64k1eCLGwpK38vS25I t1Fg== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=uWkXP70/enYrVZlkW0JQ8VwOBRfdj++9BTLJCNJzUCM=; b=B0PfXvUMmZe++6B77PNs58mgtMBO+zbBuoMgFULsBtFM77/kTHwVhxBh2T9h3eOTdG Fu/Kh0Qusmj7rOtO5xBb9Tt5hjAJqaT360EKmuYnIxDPPi4fNlOJVqD8ad6OBlFoA5mL quC6+CnvvUlDrRxKZtlF2ulo4nuT82GW3zHzoxCy1Jn4t0J6LpuH1sbAC0hbRgjo65zT sk05EzzsdE8J3Z58J045wu0QC6PZQ7p2IjLuRtQXX2TQh9s+0KVDliAbY0hEmcixdMYu 7c01aP3i+AFv2sg0FfjqDCpUDiNoRuI+NzqZNXeLfQiabQHJsh5DXRgDVyehYHtGqjeB ejMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k6EQHRAX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z1si15898452eja.41.2020.08.19.07.57.43; Wed, 19 Aug 2020 07:58:08 -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; dkim=pass header.i=@linaro.org header.s=google header.b=k6EQHRAX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728725AbgHSO4K (ORCPT + 99 others); Wed, 19 Aug 2020 10:56:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728585AbgHSO4F (ORCPT ); Wed, 19 Aug 2020 10:56:05 -0400 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A09ABC061757 for ; Wed, 19 Aug 2020 07:56:03 -0700 (PDT) Received: by mail-lf1-x144.google.com with SMTP id x24so12198192lfe.11 for ; Wed, 19 Aug 2020 07:56:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=uWkXP70/enYrVZlkW0JQ8VwOBRfdj++9BTLJCNJzUCM=; b=k6EQHRAXD0q+WpwgpztejJjDo+4OodhkqN/mJnGdAc7qLS7CzvbyeJb92wfPF031g8 F6T2jd28WDZ0xxOr4FRjt/iuAMR62tPTtVgiSdeQZ4BFzmrIe2GhuSXTi66HX1NMs4z6 8oTp1E3Pur9a6SNDdDIC1ZrJQnfxHnEBw/F45dnKnV4SyOGDwvmVSA4xvit4t6id57ju PbfFySSHEDgol5E7u+0kSR0BoWq+o/qElg20xfGF9O1Ksl5c8ZvYqCrmOr/3zKkl7xOC ttD0F5eeuX4dmCqVwjWd/zKg40GT1ZCOBaapDAKMQHQM5qPiygF6qiTn6EFIbWio1vTz ji9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=uWkXP70/enYrVZlkW0JQ8VwOBRfdj++9BTLJCNJzUCM=; b=HXqwvAp/RX57pe9RKEuwwnxm67ju/7jomVvtaMCz41B4QEbZjO4/tSVnyUEclzVnba juyE6nA477RQ3mNtiH9FsV8n9dUMyRdHAzlpIia7SSd1DS/79InWwzzcQNLr0PTUQtV6 Z7YHIBQUL0xJi35aw3IMygOYHqKHA9J0xEaOEJUWXsjUNafZxAinCNnKZ70TmGTy+CBw 1OeR3wX+zp/YzM8YgzL7zYp3kmg3/Q3+yzN2jejZ1KDvQCV+vl2eVGoIdMiCUCTZdoo7 1eClZQcK3lB6NnQ4UmMFX66sTmCqkAFZhxRSOP5HrqnaRLax+RazV6+/3HxpV7gtrkzB ErKg== X-Gm-Message-State: AOAM531crF5nxEatKDD8AnUr8LLwDvpzTKdxFviJhgDlWMSGICfWWO4Y oX2ve1rjvlQiKSqOLVu2vmjpfe00As8Oc1JdgBIS5Q== X-Received: by 2002:a19:c68b:: with SMTP id w133mr12319418lff.189.1597848962026; Wed, 19 Aug 2020 07:56:02 -0700 (PDT) MIME-Version: 1.0 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> <3a1047fc-a86a-014a-b17a-eae71f669da1@arm.com> <643B0ECE-D758-4D08-8B1B-C70F34DD9943@tencent.com> <55f04582-69d6-aeb4-85be-3e46a3b15beb@arm.com> <755BFAD0-9072-4D73-9CD7-AF4F74A79D21@tencent.com> <729675a2-b083-4211-62c0-f7ed7f483ae2@arm.com> In-Reply-To: From: Vincent Guittot Date: Wed, 19 Aug 2020 16:55:49 +0200 Message-ID: Subject: Re: [PATCH] sched/fair: reduce preemption with IDLE tasks runable(Internet mail) To: =?UTF-8?B?YmVuYmppYW5nKOiSi+W9qik=?= Cc: Dietmar Eggemann , Jiang Biao , "mingo@redhat.com" , "peterz@infradead.org" , "juri.lelli@redhat.com" , "rostedt@goodmis.org" , "bsegall@google.com" , "mgorman@suse.de" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 19 Aug 2020 at 16:27, benbjiang(=E8=92=8B=E5=BD=AA) wrote: > > > > > On Aug 19, 2020, at 7:55 PM, Dietmar Eggemann wrote: > > > > On 19/08/2020 13:05, Vincent Guittot wrote: > >> On Wed, 19 Aug 2020 at 12:46, Dietmar Eggemann wrote: > >>> > >>> On 17/08/2020 14:05, benbjiang(=E8=92=8B=E5=BD=AA) wrote: > >>>> > >>>> > >>>>> On Aug 17, 2020, at 4:57 PM, Dietmar Eggemann wrote: > >>>>> > >>>>> On 14/08/2020 01:55, benbjiang(=E8=92=8B=E5=BD=AA) wrote: > >>>>>> Hi, > >>>>>> > >>>>>>> On Aug 13, 2020, at 2:39 AM, Dietmar Eggemann wrote: > >>>>>>> > >>>>>>> On 12/08/2020 05:19, benbjiang(=E8=92=8B=E5=BD=AA) wrote: > >>>>>>>> Hi, > >>>>>>>> > >>>>>>>>> On Aug 11, 2020, at 11:54 PM, Dietmar Eggemann wrote: > >>>>>>>>> > >>>>>>>>> On 11/08/2020 02:41, benbjiang(=E8=92=8B=E5=BD=AA) wrote: > >>>>>>>>>> Hi, > >>>>>>>>>> > >>>>>>>>>>> On Aug 10, 2020, at 9:24 PM, Dietmar Eggemann wrote: > >>>>>>>>>>> > >>>>>>>>>>> On 06/08/2020 17:52, benbjiang(=E8=92=8B=E5=BD=AA) wrote: > >>>>>>>>>>>> Hi, > >>>>>>>>>>>> > >>>>>>>>>>>>> On Aug 6, 2020, at 9:29 PM, Dietmar Eggemann wrote: > >>>>>>>>>>>>> > >>>>>>>>>>>>> On 03/08/2020 13:26, benbjiang(=E8=92=8B=E5=BD=AA) wrote: > >>>>>>>>>>>>>> > >>>>>>>>>>>>>> > >>>>>>>>>>>>>>> On Aug 3, 2020, at 4:16 PM, Dietmar Eggemann wrote: > >>>>>>>>>>>>>>> > >>>>>>>>>>>>>>> On 01/08/2020 04:32, Jiang Biao wrote: > >>>>>>>>>>>>>>>> From: Jiang Biao > >>> > >>> [...] > >>> > >>>>> Are you sure about this? > >>>> Yes. :) > >>>>> > >>>>> The math is telling me for the: > >>>>> > >>>>> idle task: (3 / (1024 + 1024 + 3))^(-1) * 4ms =3D 2735ms > >>>>> > >>>>> normal task: (1024 / (1024 + 1024 + 3))^(-1) * 4ms =3D 8ms > >>>>> > >>>>> (4ms - 250 Hz) > >>>> My tick is 1ms - 1000HZ, which seems reasonable for 600ms? :) > >>> > >>> OK, I see. > >>> > >>> But here the different sched slices (check_preempt_tick()-> > >>> sched_slice()) between normal tasks and the idle task play a role to. > >>> > >>> Normal tasks get ~3ms whereas the idle task gets <0.01ms. > >> > >> In fact that depends on the number of CPUs on the system > >> :sysctl_sched_latency =3D 6ms * (1 + ilog(ncpus)) . On a 8 cores syste= m, > >> normal task will run around 12ms in one shoot and the idle task still > >> one tick period > > > > True. This is on a single CPU. > Agree. :) > > > > >> Also, you can increase even more the period between 2 runs of idle > >> task by using cgroups and min shares value : 2 > > > > Ah yes, maybe this is what Jiang wants to do then? If his runtime does > > not have other requirements preventing this. > That could work for increasing the period between 2 runs. But could not > reduce the single runtime of idle task I guess, which means normal task > could have 1-tick schedule latency because of idle task. Yes. An idle task will preempt an always running task during 1 tick every 680ms. But also you should keep in mind that a waking normal task will preempt the idle task immediately which means that it will not add scheduling latency to a normal task but "steal" 0.14% of normal task throughput (1/680) at most > OTOH, cgroups(shares) could introduce extra complexity. :) > > I wonder if there=E2=80=99s any possibility to make SCHED_IDLEs=E2=80=99 = priorities absolutely > lower than SCHED_NORMAL(OTHER), which means no weights/shares > for them, and they run only when no other task=E2=80=99s runnable. > I guess there may be priority inversion issue if we do that. But maybe we Exactly, that's why we must ensure a minimum running time for sched_idle ta= sk > could avoid it by load-balance more aggressively, or it(priority inversio= n) > could be ignored in some special case. > > Thx. > Regard, > Jiang > > > > > [...] >