Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6641447ybf; Fri, 6 Mar 2020 01:36:43 -0800 (PST) X-Google-Smtp-Source: ADFU+vvyxG+D76Ap2QJJ3UJXQkzs7XuS1tBaujIb9N5yROSf752TzfLszii0vgmrxow47Js2rR2x X-Received: by 2002:aca:d64a:: with SMTP id n71mr1991686oig.72.1583487403582; Fri, 06 Mar 2020 01:36:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583487403; cv=none; d=google.com; s=arc-20160816; b=dHihSPdVRLm6OvBiRIreMui9P5gBEkOQcuVjw0eLIa5saqwOGKjQb4487w5DWv1+Gz lFbkLgkH9VmFaZe404PJFA55JAfWT6O3aZMp77aqjgDG/toD2x3f2BT3CErqCkOA/JJ4 g2VdW2tKli06oP+QOTLn2E4WPXjU1y1RP7hOi0hlwWuMgDw23M/bN3R/1YMCrppzF3U2 CLIfWii+kTiG1ldfsU1c+HXxWcLx87u+7Ka7QkUeTlbshxe7XUNtjeiSd1aG7+SROlxs Pa5BarT469I38a32IizzTXsAl7xVwuU0jvCJ/E4OAE00CQYreAcABjhjCleRYDbcg6ON IStg== 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=ji2gPRs83eDD/Gn36z7RZF1fM8IM9Se6RfTjYPE+ti4=; b=wBLt7YTHnB2lqwBEaCvU0tZA1ETO85DlIwJdgR1Ld+i/Z3KB/0E6NfPxwZQDGL3kFj OLto+PZLvUMum9+YUxjpouv7c3WxyGC1T4pNEY/jtXnWjx7Wm/TN/KTp1YYp/dw8jnRj xilTB+0hhakHTxqhUzEWt9i0nMOM5RWVtDyhTezgTdZJ2/GAQqs5rjQWgHJKVm5gVeUg Lu6IhIW93i2kzdCwd9Bp83R5279MYiPkbIg7mmeccZLcQvLzgY5SnR6h2p0+HvHIH9WA Yo2MhRVsTmkxAzUdxX1vkNvNrXPhtPZRrW5uZpV0RV/LkjI0ystEMEXCvO54vOXy0H4z JCmw== 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 u205si1077207oif.235.2020.03.06.01.36.31; Fri, 06 Mar 2020 01:36:43 -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 S1726533AbgCFJfr (ORCPT + 99 others); Fri, 6 Mar 2020 04:35:47 -0500 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:54521 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726047AbgCFJfq (ORCPT ); Fri, 6 Mar 2020 04:35:46 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R561e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07417;MF=yun.wang@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0Trp4UVu_1583487338; Received: from testdeMacBook-Pro.local(mailfrom:yun.wang@linux.alibaba.com fp:SMTPD_---0Trp4UVu_1583487338) by smtp.aliyun-inc.com(127.0.0.1); Fri, 06 Mar 2020 17:35:39 +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> <12f79b83-491c-4b4b-0581-d23bdcec7c0c@linux.alibaba.com> From: =?UTF-8?B?546L6LSH?= Message-ID: <746d2b82-fb39-1412-0dc3-c5ff10b578ec@linux.alibaba.com> Date: Fri, 6 Mar 2020 17:34:53 +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/6 下午4:04, Vincent Guittot wrote: > On Fri, 6 Mar 2020 at 05:23, 王贇 wrote: >> >> >> >> 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? > > cfs_rq->load.weight will never be 0, it's min is 2 > >> >> If cfs_rq->load.weight got at least something, the load will not be >> zero after pick the max, correct? > > But the cfs_rq->avg.load_avg will never be other than 0 what ever > there are heavy or light tasks in the group Aha, get the point now :-) BTW, would you like to give a review on [PATCH] sched: avoid scale real weight down to zero please? Regards, Michael Wang > >> >> Regards, >> Michael Wang >> >>> >>>> >>>> Regards, >>>> Michael Wang >>>> >>>>> >>>>> >>>>>