Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1398815pxa; Sun, 23 Aug 2020 01:07:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAtWonifmmb1/RyexoXqEEIPTp4hic7ndQR6vSsvw3eEnex8MtYMfD1HtlynKJHDK32j3a X-Received: by 2002:a05:6402:1593:: with SMTP id c19mr488558edv.318.1598170033164; Sun, 23 Aug 2020 01:07:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598170033; cv=none; d=google.com; s=arc-20160816; b=MQBWFPFCCh2hCUJTb7/kCtUC0BOazetZ77zq4BT2Nf5G3CfSd+wZOUb7TeoLDscwHW To6NcCT2S3WBj1Gcos3AIE3CQYdq+Bod/OOoW3Q0DMHNgKosisAwi4+kK+VP2mraSAEN wVJ9cb2RgnDF4iPbBOIWmqSfW5usCQcMFNR5qC1tzV2dQoRgOupERm0PuhVPz619QCJT CSVadDfXPF7QEIxHh6/uJcAqrUgjNbslI7RlmVyjjg4VXfbIp7gZs20CYYmA4dhkN/SA IBBl65EPUGIUnFBNaB424LVSvZ0XAqjmYMA61Gb2j+jN3aF0msbywODVSEAyQu/uQtro GLwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=xBjDd96sYjerF1OmD4oaakFsMI7Mmrw+Fd+bPpIRiHQ=; b=Z4iyZ0136NPM+hEPrGynWLjwPFRBnVU0WBqhbBaR821csQRQ/2+MKrRYGLyMTDxp5/ ScIBJOqv0jJYDR0PWfqKvr8canb0FjdZIoVfVU7KPQiFuBmoIjwVZH0tAuHn24064ToV LwWxhUAtcZNKX4B+e4JzL5iEv419ihh43IlwUHEU+qqFO/HwsyGluiGRuzgpHm1VBljT gEHSAWWWiUHTRFSGWsLBmtDBrx27ZocRgxM1mqiTiobOUNSQJzfke/wXG3EAEuulbaBc ze+odpSz7xRhk1Czc+8bcwMsqKjU4oA+vKRAPwzO9PpppcK82/EgZ0KfxutAxBESIAq6 vNXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=R7NprVWm; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w12si719081ejf.129.2020.08.23.01.06.49; Sun, 23 Aug 2020 01:07:13 -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=@gmail.com header.s=20161025 header.b=R7NprVWm; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727902AbgHWHd3 (ORCPT + 99 others); Sun, 23 Aug 2020 03:33:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726365AbgHWHd0 (ORCPT ); Sun, 23 Aug 2020 03:33:26 -0400 Received: from mail-oi1-x242.google.com (mail-oi1-x242.google.com [IPv6:2607:f8b0:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37B38C061573 for ; Sun, 23 Aug 2020 00:33:26 -0700 (PDT) Received: by mail-oi1-x242.google.com with SMTP id h3so5486630oie.11 for ; Sun, 23 Aug 2020 00:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xBjDd96sYjerF1OmD4oaakFsMI7Mmrw+Fd+bPpIRiHQ=; b=R7NprVWmYRo4EEWHLnjsbACdJkcy2N2R/+kBPj+0zoATXmigFyIsLKCnJ5TWI66J/p qHJBAF5P+Nl8ogf3iw+06lvLzD14kSdisBQCGikfWFSnvFJQI2B5Cv54sTlWtzuOMcjp VOw8p3a7fiELgehYcZxjomqoN2gCcrOdiNh7wJqnJuLShB9vHmth2wFYi7tnOzYFxI72 IND7Ck6ivbnrVyH0MFeL7f0RpjFxUORpSOwirnf2FRN5490Gy94cosMI4uVhl0LLyKq8 WTcH5xUnyGxfd8g0yITwZbZXUWZ5HFYMu1bNHhLUsaqcnqEp+xuCADb/r8nVDDTicHQV gOyQ== 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; bh=xBjDd96sYjerF1OmD4oaakFsMI7Mmrw+Fd+bPpIRiHQ=; b=LUiP+ZIbcllAcTflMzIV3RwXzDbmfHIYKtYVL0HKGWUWacldCebOTlpbVebL+BJ8DK +JFvd8V/+S652IO8Dnj2BZBS3JGpS4/j67CZm3ZKuvPjUrgj2IkWC0yGbzDgBXwOf2L5 ub2fKyXmgo2BjnoxucYsBlDJxpJvKGOMl2he7HOhUP1qpTakEJi0RPK5P9odhioBbADU H6p+7DQI5L4jBNWQFcvEraax//8FN46Jwjae9cPnoBtPBNulw2im0PTUhTuB0DLF0QEf X7fgqTEO9XJWhN69PIa+wU1FLqCGJLl+bfD3xILv/Hb4XkpgbW/FoFxQnhdLutRrYFPM TmkQ== X-Gm-Message-State: AOAM532bUgstlj4HUOm7/fJPu/LWK1TFbjChJhWS35Vr3gTbb8JrKL9h iUTb4uBOc/Rv8uj1058HGx6elESkzggemgVy5ag= X-Received: by 2002:a05:6808:64c:: with SMTP id z12mr201284oih.5.1598168004882; Sun, 23 Aug 2020 00:33:24 -0700 (PDT) MIME-Version: 1.0 References: <20200820120025.74460-1-benbjiang@tencent.com> <20200820125829.GT2674@hirez.programming.kicks-ass.net> <20200820134341.GW2674@hirez.programming.kicks-ass.net> In-Reply-To: From: Jiang Biao Date: Sun, 23 Aug 2020 15:33:13 +0800 Message-ID: Subject: Re: [PATCH] sched/fair: avoid vruntime compensation for SCHED_IDLE task To: Vincent Guittot Cc: Peter Zijlstra , Ingo Molnar , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , linux-kernel , Jiang Biao Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Vincent and Peter On Thu, 20 Aug 2020 at 22:09, Vincent Guittot wrote: > > On Thu, 20 Aug 2020 at 15:44, wrote: > > > > > That's been said, not compensating the vruntime for a sched_idle task > > > makes sense for me. Even if that will only help for others task in the > > > same cfs_rq > > > > Yeah, but it is worth the extra pointer chasing and branches? > > For that I let Jiang provides figures to show the worthful Using the following configuration for rt-app, { "tasks" : { "task_other" : { "instance" : 1, //only 1 instance to be easy to observe "cpus" : [2], "loop" : 2000, "policy" : "SCHED_OTHER", "run" : -1, //make normal task 100% running "priority" : 0, "sleep" : 0 }, "task_idle" : { "instance" : 1, "cpus" : [2], "loop" : 2000, "policy" : "SCHED_IDLE", "run" : 1, //only run 1us to avoid blocking(always waiting for running), making check_preempt_wakeup work(S->R switching) "timer" : { "ref" : "unique2" , "period" : 16000, "mode" : "absolute" } } }, "global" : { "calibration" : "CPU0", "default_policy" : "SCHED_OTHER", "duration" : -1 } } without the patch, <...>-39771 [002] d.h. 42478.177771: sched_wakeup: comm=task_idle-1 pid=39772 prio=120 target_cpu=002 <...>-39771 [002] d... 42478.190437: sched_switch: prev_comm=task_other-0 prev_pid=39771 prev_prio=120 prev_state=R ==> next_comm=task_idle-1 next_pid=39772 next_prio=120 <...>-39771 [002] d.h. 42478.193771: sched_wakeup: comm=task_idle-1 pid=39772 prio=120 target_cpu=002 <...>-39771 [002] d... 42478.206438: sched_switch: prev_comm=task_other-0 prev_pid=39771 prev_prio=120 prev_state=R ==> next_comm=task_idle-1 next_pid=39772 next_prio=120 <...>-39771 [002] d.h. 42478.209771: sched_wakeup: comm=task_idle-1 pid=39772 prio=120 target_cpu=002 <...>-39771 [002] d... 42478.222438: sched_switch: prev_comm=task_other-0 prev_pid=39771 prev_prio=120 prev_state=R ==> next_comm=task_idle-1 next_pid=39772 next_prio=120 <...>-39771 [002] d.h. 42478.225771: sched_wakeup: comm=task_idle-1 pid=39772 prio=120 target_cpu=002 <...>-39771 [002] d... 42478.238438: sched_switch: prev_comm=task_other-0 prev_pid=39771 prev_prio=120 prev_state=R ==> next_comm=task_idle-1 next_pid=39772 next_prio=120 *task_idle* preempts every 12ms because of the compensation. with the patch, task_other-0-27670 [002] d.h. 136785.278059: sched_wakeup: comm=task_idle-1 pid=27671 prio=120 target_cpu=002 task_other-0-27670 [002] d... 136785.293623: sched_switch: prev_comm=task_other-0 prev_pid=27670 prev_prio=120 prev_state=R ==> next_comm=task_idle-1 next_pid=27671 next_prio=120 task_other-0-27670 [002] d.h. 136785.294059: sched_wakeup: comm=task_idle-1 pid=27671 prio=120 target_cpu=002 task_other-0-27670 [002] d... 136785.317624: sched_switch: prev_comm=task_other-0 prev_pid=27670 prev_prio=120 prev_state=R ==> next_comm=task_idle-1 next_pid=27671 next_prio=120 task_other-0-27670 [002] d.h. 136785.326059: sched_wakeup: comm=task_idle-1 pid=27671 prio=120 target_cpu=002 task_other-0-27670 [002] d... 136785.341622: sched_switch: prev_comm=task_other-0 prev_pid=27670 prev_prio=120 prev_state=R ==> next_comm=task_idle-1 next_pid=27671 next_prio=120 task_other-0-27670 [002] d.h. 136785.342059: sched_wakeup: comm=task_idle-1 pid=27671 prio=120 target_cpu=002 task_other-0-27670 [002] d... 136785.365623: sched_switch: prev_comm=task_other-0 prev_pid=27670 prev_prio=120 prev_state=R ==> next_comm=task_idle-1 next_pid=27671 next_prio=120 *task_idle* preempts every 24 or 16 ms. This patch could reduce the preempting frequency of task_idle, and reduce the interference from SCHED_IDLE task. Thx. Regards, Jiang