Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6415512ybf; Thu, 5 Mar 2020 20:25:24 -0800 (PST) X-Google-Smtp-Source: ADFU+vtfdUxVyMaj3R+rZjCnS9xZA+t/00Vu+2+BazVry0Luzh2pZNY6xUuLmBLDSslGcXY0uvzL X-Received: by 2002:a9d:7087:: with SMTP id l7mr1101985otj.0.1583468724314; Thu, 05 Mar 2020 20:25:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583468724; cv=none; d=google.com; s=arc-20160816; b=nHlKttCWwc0Z8zp1dar4h2zBZrHjVMhWrinYdIYVYd8UybKA7ksjXPMaPOAb/rk0wP Jb8U5r5TBWa07kJ67IIWi+uhj187FSr6qNvfq8CgcsuQBApCA14i9YOIAq+A6PBHAa1e prkkLs6VzhlXOk/oLTCVYtaa8AI7a82AnJB5oOSRYV5/Go+hJK7ZXOwCnnOIUcp8JNas 8Glm2gM2c/TQIPxBKqjCziwp58lyPW4YDSc2LUN96m2WXwN88p63aEfVqFzcxU4uwkNq e+Qx1+T/YAy2dNBffA2/yr5S7Nz9G/e9l6xEGA/NZNwvGSvEMV6SZp80yFdRABL0AXc7 RoJg== 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=EkfKIpXeyxVDxnXTOp+KnrYeL1+Ei0LctHTkfJtvK18=; b=MtUzoUO2tipoAriQmOMDE7VW1Dy7RO2YYc+NIkA30O5lo3SOBRhpOi5KLC2mU8rjAe SFehLGhlBii4I3yvzr+Xo5vG96SJrmlHQo7tgSMzMbqC4R1lKFBavcBOk47kdamBKEHR AYFiwJxfig2dPMIiUpqGSLnbawOdtLBhbGeiu6NIMDSIYsWvR2Hk13CiBNADJx+rPcES VRIijh3exwHe3gvedoZdzcyHZ94SAnxmI20vtx3HU9awRkVF1sdZAD0drIUr9bORXbo/ G4UlVnBSvgp97NcvG5aN1EdRg3DH0J19U4RQSvB/DuwqBcLgxJXohVNRZ5MqwFXwXHSo zrWw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l23si687429otj.144.2020.03.05.20.25.12; Thu, 05 Mar 2020 20:25:24 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726887AbgCFEX1 (ORCPT + 99 others); Thu, 5 Mar 2020 23:23:27 -0500 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:54612 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726251AbgCFEX1 (ORCPT ); Thu, 5 Mar 2020 23:23:27 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R911e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04391;MF=yun.wang@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0Trni2vY_1583468602; Received: from testdeMacBook-Pro.local(mailfrom:yun.wang@linux.alibaba.com fp:SMTPD_---0Trni2vY_1583468602) by smtp.aliyun-inc.com(127.0.0.1); Fri, 06 Mar 2020 12:23:22 +0800 Subject: Re: [RFC PATCH] sched: fix the nonsense shares when load of cfs_rq is too, small To: Vincent Guittot Cc: Ben Segall , Peter Zijlstra , Ingo Molnar , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Mel Gorman , "open list:SCHEDULER" References: <44fa1cee-08db-e4ab-e5ab-08d6fbd421d7@linux.alibaba.com> <20200303195245.GF2596@hirez.programming.kicks-ass.net> <1180c6cd-ff61-2c9f-d689-ffe58f8c5a68@linux.alibaba.com> From: =?UTF-8?B?546L6LSH?= Message-ID: <12f79b83-491c-4b4b-0581-d23bdcec7c0c@linux.alibaba.com> Date: Fri, 6 Mar 2020 12:23:22 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: 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 2020/3/5 δΈ‹εˆ3:53, Vincent Guittot wrote: > On Thu, 5 Mar 2020 at 02:14, ηŽ‹θ΄‡ wrote: [snip] >>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c >>> index fcc968669aea..6d7a9d72d742 100644 >>> --- a/kernel/sched/fair.c >>> +++ b/kernel/sched/fair.c >>> @@ -3179,9 +3179,9 @@ static long calc_group_shares(struct cfs_rq *cfs_rq) >>> long tg_weight, tg_shares, load, shares; >>> struct task_group *tg = cfs_rq->tg; >>> >>> - tg_shares = READ_ONCE(tg->shares); >>> + tg_shares = scale_load_down(READ_ONCE(tg->shares)); >>> >>> - load = max(scale_load_down(cfs_rq->load.weight), cfs_rq->avg.load_avg); >>> + load = max(cfs_rq->load.weight, scale_load(cfs_rq->avg.load_avg)); >>> >>> tg_weight = atomic_long_read(&tg->load_avg); >> >> Get the point, but IMHO fix scale_load_down() sounds better, to >> cover all the similar cases, let's first try that way see if it's >> working :-) > > The problem with this solution is that the avg.load_avg of gse or > cfs_rq might stay to 0 because it uses > scale_load_down(se/cfs_rq->load.weight) Will cfs_rq->load.weight be zero too without scale down? If cfs_rq->load.weight got at least something, the load will not be zero after pick the max, correct? Regards, Michael Wang > >> >> Regards, >> Michael Wang >> >>> >>> >>>