Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6573184ybf; Fri, 6 Mar 2020 00:06:04 -0800 (PST) X-Google-Smtp-Source: ADFU+vutgTLVeSfPzfx0lNPBCzRJLzn9IdOVZltHDp13NiWHn3Pb43TA22IFICB0SwX8XG19GZa8 X-Received: by 2002:a9d:6544:: with SMTP id q4mr1427222otl.269.1583481964536; Fri, 06 Mar 2020 00:06:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583481964; cv=none; d=google.com; s=arc-20160816; b=pekQa79YYK6ByYZQappCUZW77oRFlsVoa0tsDaSnsGnhEjRSXIcLe58NktQlyNSVi8 AOSro8JfPWLPqmUofpux9P8N3/ZDVM8lkcz82K5MX79oKF7HoijNpo2ENBI8Co569/nS U4gqwSLs6/isn6vETY3PIt21TkRgH2aFlEayT9CVkkhrAHDXOu0+oEDoP1eqkfJJ0fk4 nDhNajfFeyXObkVvdQJhqQd+BjlgrAClB1v3qYbXLqQtaOFv+uAtWcOkwJI4DrIcfqon vFOS15tAbc/uViUxQjQHLwr6JyvvRsyY2ESioIrDllxj38GtfLVhh3OU+JiXiGbGFKvM uZJQ== 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=fLE8ZB0HcdjSfZLQxo/1fQfJtjwlBtD1VH7kpiLR0+U=; b=eXdj9Aj2bZeJ+wmH4BJJ5nfjfYjtnfGHbgwVVyqWbsig2W/KPuBu7LbgXqIffPd3WQ F4ZXzxyZXzQ/POG4sx7oufOwVUm2RPhEfLU6FEGPk54FdYHo6Mix/D8HnzMCdUpKZOxO 1fYvX0VyuUuKEAJ3vs8JLWwSyRyPElrJtQhu90nPkHDbkZoqYZ7w2CrKptMMr5XRz2Xx 1ou5TGV4kPkBSgOtb+0mjyVQEnvhF+y9oAfQSQnISSbbY3eGo2pZVY605OcMmIt+y3J2 KnOqCOzT55EkVwJ+m8trm6DQebm5/0lkMNs9j8cnkSk+lb5Cc8OPaNCgW3vF7RJOujgA LKxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ubyOpI4n; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y184si865399oia.22.2020.03.06.00.05.52; Fri, 06 Mar 2020 00:06:04 -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; dkim=pass header.i=@linaro.org header.s=google header.b=ubyOpI4n; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726190AbgCFIFA (ORCPT + 99 others); Fri, 6 Mar 2020 03:05:00 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:41531 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725905AbgCFIE7 (ORCPT ); Fri, 6 Mar 2020 03:04:59 -0500 Received: by mail-lf1-f68.google.com with SMTP id q10so390505lfo.8 for ; Fri, 06 Mar 2020 00:04:57 -0800 (PST) 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=fLE8ZB0HcdjSfZLQxo/1fQfJtjwlBtD1VH7kpiLR0+U=; b=ubyOpI4n/mJYTfePXj71eIIUihGJ0P4fMrcL6n/0PI+CqLaiccgc49MPT5esrzfNpB pzbhrGKr9srrRxHAhCWYuRdHcCdVvlSCRiqvBQUzSxjlsa36dIkJVCNLm36EAZKFgEAu 4FiUFMtWwpi0Z3SFZpmJhyEjo9DLoD+fwXsvalNTY869wqWk1xpBmmoNFLxXRaZ56LM9 0pNwRfFaP63NG0zZShr3RYpfqlFigjS1HOE3Rx24rtWEChFumyVv6lttj6jhKQgDKqWi rX2uoAuWsCWk/igE3xH8cOmj45c2VykOiDZtf6CmZHppejbEzuSCLfN6EZHUfY9YeHGP I3ig== 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=fLE8ZB0HcdjSfZLQxo/1fQfJtjwlBtD1VH7kpiLR0+U=; b=SYaliZpj+FjM537eCCWzbwUXlW4abpvuONxmLi/2QQh+BLtodT/VZdsQPN+3JqRrjF WuHlxry8WRFX7uGCrI3H03GpccWSk7PUFH33v0fuXc6T80YLIiY0MYZ536KXbuiY81By f3tlsEV4HeZmU0UTTvdXBKYJtlH2TvMkDdXLarAC1s4Yij03geSKsqVVcyoljYLBg/qL TmiZAJLyqfcnsSNRtZK/QA0cicCnix9RsMjKAIx7X6C404Trw9+NzZq1gCk27K4Nd146 mRnRLV9EUPmLNOFcLulCC9XEouj88kg+7+KuD2GkAElIhI/hJ6lZZ2tFGoQ8+TfhQ+I6 riRg== X-Gm-Message-State: ANhLgQ0SV9Avn4hSKtiIvQVOgpe1G10cAC5K1zAqUMGJ8+ZohpyS9jm9 F1fTne7CRviXpRk/9opAt/7Ytozh0T2jifxCc1GSXA== X-Received: by 2002:a19:428a:: with SMTP id p132mr1151971lfa.189.1583481896994; Fri, 06 Mar 2020 00:04:56 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: <12f79b83-491c-4b4b-0581-d23bdcec7c0c@linux.alibaba.com> From: Vincent Guittot Date: Fri, 6 Mar 2020 09:04:45 +0100 Message-ID: Subject: Re: [RFC PATCH] sched: fix the nonsense shares when load of cfs_rq is too, small To: =?UTF-8?B?546L6LSH?= Cc: Ben Segall , Peter Zijlstra , Ingo Molnar , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Mel Gorman , "open list:SCHEDULER" 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 Fri, 6 Mar 2020 at 05:23, =E7=8E=8B=E8=B4=87 wrote: > > > > On 2020/3/5 =E4=B8=8B=E5=8D=883:53, Vincent Guittot wrote: > > On Thu, 5 Mar 2020 at 02:14, =E7=8E=8B=E8=B4=87 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 *cf= s_rq) > >>> long tg_weight, tg_shares, load, shares; > >>> struct task_group *tg =3D cfs_rq->tg; > >>> > >>> - tg_shares =3D READ_ONCE(tg->shares); > >>> + tg_shares =3D scale_load_down(READ_ONCE(tg->shares)); > >>> > >>> - load =3D max(scale_load_down(cfs_rq->load.weight), cfs_rq->av= g.load_avg); > >>> + load =3D max(cfs_rq->load.weight, scale_load(cfs_rq->avg.load= _avg)); > >>> > >>> tg_weight =3D 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 > > Regards, > Michael Wang > > > > >> > >> Regards, > >> Michael Wang > >> > >>> > >>> > >>>