Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp647016ybl; Wed, 28 Aug 2019 03:18:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3T90rFGkmGW1qC7lZK/4E6XjgNFyRqsYqH4m50MKL5W4CEnxPw9op1CfOl7gR0OG7v9GN X-Received: by 2002:a17:90a:b108:: with SMTP id z8mr3504287pjq.108.1566987499623; Wed, 28 Aug 2019 03:18:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566987499; cv=none; d=google.com; s=arc-20160816; b=p7rBtDd0rvfW7xZEe+hdq8aHGgWGHI/ifHM5Bpc5roXXn7JYoHIh3bui/e265V8vLf pH3B0HDJdNicLGf2NSHteJv1CYUhz5I5JZerFijKyhUJkzLF78bveiUoiA/Lg2PuSV/s kVsoWt/VF4duyM/iYeXuezStPgrVTu0CCaNvpTtK1Z2q7ixWrpYhMeZPH5T8hpuo4WjM Rk8XeOzlxKBI93G+/9mq7tBaxNWAzdNKXgbrkJCyE4/HU4qeWTIYcHZOGYEk9BARy0SZ wl79gfJCBuzedZar/SpZRSixI16NsXxnfk2Cm6PzILJjpoorHPIKsD325cY7suhDDCDP EJlQ== 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=Rc5a5xeeZvIHJsr/Abif0waDBHx+j718Aw76ghCZnZw=; b=Bs0Ef7IgWkqXeZtDrPsksAuGBPezKfgjOb5AWT+UyegDNMxPt7X0RGMQbjHYOoLOXN K8rGdfqlkfVTX3vcPu1ONRCcxKuEpC3gN4shuf3xvnF+1ck0AXwr3qu7fijlyHLiRc+n uEOxASIHJ2XxwwsN7naKTnMAw/NMk95hYM7pDSqYVWhL7r3C1GQh4pQDTDZjnVOzP+74 jVJ9WcSWDRiRgpEFZO7SQkuKZoYd4gscDaiXC/Lj8CqP9t7bgUXwSeT4PG+H5EQqxnnL bVhjjlxs3k6Z4CZCga+svL7OCuGT4LaANhA3wRrhWGBOFI90P/myeMc6pof44uoIM3Zl VzXg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gb16si1574031plb.389.2019.08.28.03.18.03; Wed, 28 Aug 2019 03:18:19 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727103AbfH1KQ5 (ORCPT + 99 others); Wed, 28 Aug 2019 06:16:57 -0400 Received: from foss.arm.com ([217.140.110.172]:56802 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727075AbfH1KQz (ORCPT ); Wed, 28 Aug 2019 06:16:55 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C8CFA337; Wed, 28 Aug 2019 03:16:54 -0700 (PDT) Received: from [10.1.194.37] (e113632-lin.cambridge.arm.com [10.1.194.37]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D65F13F59C; Wed, 28 Aug 2019 03:16:53 -0700 (PDT) Subject: Re: [PATCH v3] sched/fair: don't assign runtime for throttled cfs_rq To: Liangyan , Ingo Molnar , Peter Zijlstra , Ben Segall , linux-kernel@vger.kernel.org Cc: shanpeic@linux.alibaba.com, xlpang@linux.alibaba.com References: <20190826121633.6538-1-liangyan.peng@linux.alibaba.com> From: Valentin Schneider Message-ID: <71df56cc-529b-aefb-2905-48e02de5cf86@arm.com> Date: Wed, 28 Aug 2019 11:16:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190826121633.6538-1-liangyan.peng@linux.alibaba.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/08/2019 13:16, Liangyan wrote: > do_sched_cfs_period_timer() will refill cfs_b runtime and call > distribute_cfs_runtime to unthrottle cfs_rq, sometimes cfs_b->runtime > will allocate all quota to one cfs_rq incorrectly, then other cfs_rqs > attached to this cfs_b can't get runtime and will be throttled. > > We find that one throttled cfs_rq has non-negative > cfs_rq->runtime_remaining and cause an unexpetced cast from s64 to u64 > in snippet: distribute_cfs_runtime() { > runtime = -cfs_rq->runtime_remaining + 1; }. > The runtime here will change to a large number and consume all > cfs_b->runtime in this cfs_b period. > > According to Ben Segall, the throttled cfs_rq can have > account_cfs_rq_runtime called on it because it is throttled before > idle_balance, and the idle_balance calls update_rq_clock to add time > that is accounted to the task. > > This commit prevents cfs_rq to be assgined new runtime if it has been > throttled until that distribute_cfs_runtime is called. > > Signed-off-by: Liangyan > Reviewed-by: Ben Segall > Reviewed-by: Valentin Schneider @Peter/Ingo, if we care about it I believe it can't hurt to strap Cc: Fixes: d3d9dc330236 ("sched: Throttle entities exceeding their allowed bandwidth") to the thing.