Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3909969ybl; Mon, 26 Aug 2019 02:27:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqzn0e+AOp9vdfmmmvTHeBjUCq1wip1ygc0mbm3ny4+geDMlWDIQZJCYCsNJAJ5T5UG1bqVc X-Received: by 2002:a63:460c:: with SMTP id t12mr15361268pga.69.1566811639215; Mon, 26 Aug 2019 02:27:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566811639; cv=none; d=google.com; s=arc-20160816; b=zfOzExJYBKgWyVA+vI6TEcYzSu21kyOcC221P/cM1we/Cd5P/DaVq5hiikNyzcNGA6 v1LQNlgxiBW9VMTVLoJfpqyOxU2GUVyfZJTPbLD/b8yN2lN5qlbYKGeJG3MOOWsMOLED Ksa3NMJFm+m9u77xQXXAwWIZ6/U4njnj7Jv21sh7jjXa+lNCy/DN2rP9nQHm2kqwDwL2 IF7wWr6fuDV8ZA8zIEqiv6Wp1QhIvv0hkbiQ/18t9zUjrR0kvir6xDjf5nus6M8/wrca ievQPGJKTIxBjk2txYehWvKx1kx6Ma+nE9wIebbdUb/0PObfgASNZKQpXCC/XcPksW0M E16Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=AYY21M19zx8FMLZ0hdxNGSVGO72qMoETVC6sYSM50Z8=; b=DHtZtUoiaQ5ceBpbSzPwWNQ8Hn33jAvCCVmgG6Ebur8m1WZPjBVsbdO8aa4hfpcD/3 /FMcA7EJQ9KNeV6h1lCfHDAr8anO0q6deY96AAqtzWHQtVtFvgf8du6m6zBP6CU14SXi otFHLOoUJEnl9OwVBxWbmkE6ogxE4sI5PPCLEcgWBlk3zkNlKX4X1CIEaNCf23ktPw0x k1GvoDlkYxWooAdhDPm1YgHEH8A+37IuVNQ8n2KtM/TgKuWcB3h9cUbwtHzVzvQO8qZR nfsn8PTXkwZx6vOrYjJuD/kqUslCy4kFBBW0pFgGi3TTiHaGQRKhIFeQ7kxHYe+whGag sZvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=SFGwhVLe; 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 t17si2579253pjw.104.2019.08.26.02.27.03; Mon, 26 Aug 2019 02:27: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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=SFGwhVLe; 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 S1730962AbfHZJZT (ORCPT + 99 others); Mon, 26 Aug 2019 05:25:19 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:60694 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729753AbfHZJZS (ORCPT ); Mon, 26 Aug 2019 05:25:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=AYY21M19zx8FMLZ0hdxNGSVGO72qMoETVC6sYSM50Z8=; b=SFGwhVLebobrVZKf90FpOOQyV wsMKLWtMlSvAFmxGn+g/8f8+6/2a3fzsY+ecqlpDoM7yFFTCn1xFmU4IpWRqONMwozni9YuUS71OT rJYQUXEnLPGfV7Xw30wrXG1a+47fIDGpN0zIP2vqxeYdpiGvhMM4qDmIsS9QiolkuPcgRn8Hp5hAZ KY8mHAKykc84RpmFz6sshjc1j/sC7+QFj027+x1zYO0OOa/7AahLBUJCfKPou/RBOPeYpTd2dB+Se YCy3N8i2mgBM2cA9AQbPmAix+zi8MMDOT94eSqheOKang4RWAtRUmx7IE8vUhMiZ5BsJH3eHFDFhs FZF9cOHgg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1i2BFN-0006aa-7Q; Mon, 26 Aug 2019 09:25:09 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 27A81307602; Mon, 26 Aug 2019 11:24:33 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 841672022F842; Mon, 26 Aug 2019 11:25:06 +0200 (CEST) Date: Mon, 26 Aug 2019 11:25:06 +0200 From: Peter Zijlstra To: Liangyan Cc: Ingo Molnar , Ben Segall , Valentin Schneider , linux-kernel@vger.kernel.org, shanpeic@linux.alibaba.com, xlpang@linux.alibaba.com Subject: Re: [PATCH v2] sched/fair: don't assign runtime for throttled cfs_rq Message-ID: <20190826092506.GO2369@hirez.programming.kicks-ass.net> References: <20190824091558.86296-1-liangyan.peng@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190824091558.86296-1-liangyan.peng@linux.alibaba.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 24, 2019 at 05:15:58PM +0800, 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. > This will cause other cfs_rq 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; }. > This cast will cause that runtime will be a large number and > cfs_b->runtime will be subtracted to be zero at last. > 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. That is distinctly unreadable. Please try again with a little bit of whitespace added. > This commit prevents cfs_rq to be assgined new runtime if it has been > throttled to avoid the above incorrect type cast. > > Signed-off-by: Liangyan > Reviewed-by: Ben Segall > Reviewed-by: Valentin Schneider