Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1910271pxp; Sun, 13 Mar 2022 03:59:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTOW6bxLbo6//h/mbJfRxiMQHN0Eu/hR52diO5LfVBcxPsJBLQuobLEgutvVWqdoiWxzTQ X-Received: by 2002:a50:cccf:0:b0:410:ba4e:65fd with SMTP id b15-20020a50cccf000000b00410ba4e65fdmr16190846edj.31.1647169156269; Sun, 13 Mar 2022 03:59:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647169156; cv=none; d=google.com; s=arc-20160816; b=B903UjeirvOFwG/edQQIH79zuLkcqLo1rTxJYkrtpsbiJF0Avef2UT1Ma81O8yjtdG IYTka4Y9YlxSMZbPtImd+xf+B7S/5hlCUHWFwfOXRtXqeE60CQr1mqcUCwE2uq3qlPp/ cfE4ViV4DHEvyiCUki+Cq2X0HtQyyfoAq1HwbptSskC7l1hQrlCivatd+Iz9IyzkOVpg gWV0sduy12eraeK9wHL7aliSXljwEAtHBAY9cGv0VIk9Ve0UfVJC4+W/5CRj2Sklpf7C cvrSWqEP6hW1yynTHe8u54UkukAr6Jw4ruqwcMhjvI2QsY6G5Vxeg5ADSck6xM4SvYLS hsZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=7qpUz8ye2ArhpAi8guP0rB56tWXiT9C88VgIHLYyMps=; b=n6+9r82tXiPMIrbn3Ved0obVQT+Ku5M4sSFgTrZ7BKTdwMAWGaNbOUnTS1RpaDsOot 6qkdF9A0tSB+mkxAGvhOna+ysUWBz8ME9gUdpDVoo1gVnxsC7eWoKgy3280OKRVJEhGm tF+Ovn5IS4fGiDcW+gVxKzqUXGAEnJw366wOFgc0/zmC0OX0G4Nk8vyh6R0SVS3SV+ms CoUNnowJ7Wc6cZmBhVreJdEok3blzHrcRavEmR26cg/mVIvf/bhho8q3y6+JLNmZOPBs vJ+IUnSXH04yFHJqwD6yGLesSou80WtXEy6SzPtIWsjqpq8pxoxsfPQGNP4PyEZ9y19Y BG6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=MuYZ9axC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ka13-20020a170907990d00b006d037ef686fsi7427639ejc.770.2022.03.13.03.58.51; Sun, 13 Mar 2022 03:59:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=MuYZ9axC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233609AbiCMFjQ (ORCPT + 99 others); Sun, 13 Mar 2022 00:39:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbiCMFjP (ORCPT ); Sun, 13 Mar 2022 00:39:15 -0500 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C38139A for ; Sat, 12 Mar 2022 21:38:06 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id bx5so11635817pjb.3 for ; Sat, 12 Mar 2022 21:38:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:to:cc:references :from:in-reply-to:content-transfer-encoding; bh=7qpUz8ye2ArhpAi8guP0rB56tWXiT9C88VgIHLYyMps=; b=MuYZ9axCrl2zhwNAN6CDPMtSl0xFnKucgj5dvBDi/bI0rQS3G+ao0LfP7vxHV8DhnC aGpitno5ubZhut77wJe9s/kaJcg4AGRaAvQ85b3FqAmyLVAQ88c3+O+KZ5KiGzOQEHPk vJiQePWe9o373SHrCZtcgDpeBPAfzw8yON0B0AaMX2KscnycBjn9cg9j/HxsraXViBLm zRlzhlZcc0JbKhO4CXasDC0dZeLvQIoERmxCz2nf+lsPJVDPfp8Td9IlXOMK8IihWIpv R9TAfKbCD1VvaW532zMXF0dE/Aa7M2R+tqyZPyyOP2IbLE2qJCoa4/k9+stN+uMLp5NA wIVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :to:cc:references:from:in-reply-to:content-transfer-encoding; bh=7qpUz8ye2ArhpAi8guP0rB56tWXiT9C88VgIHLYyMps=; b=54Y/gYsRyHfKMP7cMMvefVRIKw0EioWAuFRXV9w23yh36JgjZgJsP714x5cgylYWK5 ISb+5UV6/6kBtXyGmWmhaUJMZRkPb1nVPMO9tG2Lnd+MUfn+xHzkV7Q22913jLEy7Ad7 oGA4nWDbggUmX2EPVn9KgGoQVJMVYSPS0FOCXqmE+QPrNZ0Deqt+Z24Ua2M40XrCbQIv jngz/xxrk7XXl+gHeU8MBa46nKOGsVAMs2dV3Sx1bMIJm5MI5WPFkmYYoUk/l4OIiTnu lSAEWN/+CWjEPIf/hnkhtTZN31M9Vs1C00tOxQmbW8JbpaCzdvYZYXSP/1AAUVVD/iq5 CudA== X-Gm-Message-State: AOAM531r1vjC/qYD/aKqPL5yKZnnAEDiAaNAGwszcp/vpSCwxH0EsQa1 xSHjS3uZjfvfsOAKYK0R7VOMmg== X-Received: by 2002:a17:902:ecd0:b0:151:dd64:c79b with SMTP id a16-20020a170902ecd000b00151dd64c79bmr18180355plh.79.1647149885978; Sat, 12 Mar 2022 21:38:05 -0800 (PST) Received: from [10.4.241.58] ([139.177.225.239]) by smtp.gmail.com with ESMTPSA id e13-20020a63370d000000b003810782e0cdsm6640955pga.56.2022.03.12.21.38.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 12 Mar 2022 21:38:05 -0800 (PST) Message-ID: Date: Sun, 13 Mar 2022 13:37:37 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [External] Re: Subject: [PATCH] sched/fair: prioritize normal task over sched_idle task with vruntime offset To: Peter Zijlstra Cc: mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, mgorman@suse.de, bristot@redhat.com, bsegall@google.com, linux-kernel@vger.kernel.org, duanxiongchun@bytedance.com, zhouchengming@bytedance.com, songmuchun@bytedance.com, zhengqi.arch@bytedance.com, zhoufeng.zf@bytedance.com, ligang.bdlg@bytedance.com References: <20220312120309.GB6235@worktop.programming.kicks-ass.net> From: chenying In-Reply-To: <20220312120309.GB6235@worktop.programming.kicks-ass.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2022/3/12 20:03, Peter Zijlstra 写道: > On Fri, Mar 11, 2022 at 03:58:47PM +0800, chenying wrote: >> We add a time offset to the se->vruntime when the idle sched_entity >> is enqueued, so that the idle entity will always be on the right of >> the non-idle in the runqueue. This can allow non-idle tasks to be >> selected and run before the idle. >> >> A use-case is that sched_idle for background tasks and non-idle >> for foreground. The foreground tasks are latency sensitive and do >> not want to be disturbed by the background. It is well known that >> the idle tasks can be preempted by the non-idle tasks when waking up, >> but will not distinguish between idle and non-idle when pick the next >> entity. This may cause background tasks to disturb the foreground. >> >> Test results as below: >> >> ~$ ./loop.sh & >> [1] 764 >> ~$ chrt -i 0 ./loop.sh & >> [2] 765 >> ~$ taskset -p 04 764 >> ~$ taskset -p 04 765 >> >> ~$ top -p 764 -p 765 >> top - 13:10:01 up 1 min,  2 users,  load average: 1.30, 0.38, 0.13 >> Tasks:   2 total,   2 running,   0 sleeping,   0 stopped,   0 zombie >> %Cpu(s): 12.5 us,  0.0 sy,  0.0 ni, 87.4 id,  0.0 wa,  0.0 hi, 0.0 si,  0.0 >> st >> KiB Mem : 16393492 total, 16142256 free,   111028 used,   140208 buff/cache >> KiB Swap:   385836 total,   385836 free,        0 used. 16037992 avail Mem >> >>   PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM TIME+ COMMAND >>   764 chenyin+  20   0   12888   1144   1004 R 100.0  0.0 1:05.12 loop.sh >>   765 chenyin+  20   0   12888   1224   1080 R   0.0  0.0 0:16.21 loop.sh >> >> The non-idle process (764) can run at 100% and without being disturbed by >> the idle process (765). > > Did you just do a very complicated true idle time scheduler, with all > the problems that brings? When colocating CPU-intensive jobs with latency-sensitive services can improve CPU utilization but it is difficult to meet the stringent tail-latency requirements of latency-sensitive services. We use a true idle time scheduler for CPU-intensive jobs to minimize the impact on latency-sensitive services.