Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp6423523ybh; Wed, 7 Aug 2019 23:49:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2Y1miuvGYSJY1wdry/6MTAehze0yiN2oSG1fGMUPUtgf6Tavpjydx+TxK9i3n+kLVb0iG X-Received: by 2002:a17:90a:e397:: with SMTP id b23mr2405747pjz.140.1565246980813; Wed, 07 Aug 2019 23:49:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565246980; cv=none; d=google.com; s=arc-20160816; b=KSZfGl28IpM1hS0B3mMBD8+2zb6PrhI0oTOsblLfbjf52iWHpuTAM5gW1QVvxgiHjG txDc/eVYabrTL+VNUqAwjkiRhe2xHsnsTzEYmz7WnZEycdLbgXeU1SUJw+x2bnQSB6Jf dAQ4+YjxRIdpXa2WmTa+D34yn4DMh00HQSAkE1/jvDoBvPJFbiBdgSOGmPOuQ23De6fE dK3v80ZdmL+FaezEZ3mHtv/ZxU5sOnEftpErddyUMxf8DtdqiHZvL1N/MZ/isv6zZuDV JnJ0nMlwF+CNHV+5JOrXMn/D2S4PTWybDd3HYiZwtyfsX4vHj3Fice02nDH6mU9XOeu8 RUbA== 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; bh=coZXrpyWM144kDTQlSUwc76POCuNojGKDN16eiN27vs=; b=Cuf4lm82HPq+aa4uBWmQiEsmkN/hUXcgzWIT/2TcX3/897DNQaBQMLa7c/cUe/XDMv g5P4KWcqnPMjRZ6vUm4h4SH+IUlo6q1THxDKzWtgSunL5rSaxtNCk4TKS41afRhmjhvH cyD/PhZFP1ODn+9Yzqa1e0wI/Uh84Iz/qwtuCiE6cGmIQzkWPrY/lsktgQ7zt5YafBQe m8Hxz4mpNm2dDmS27bj1ukHGjiojppnR6XPk5I3/GwjgQwsP2ZNE68Zz+vsu0LfumNA5 BTC1A8mlOggCjT0DtRwsqPGkfrP/PXMw0U8nsafnqbzzmNZcf/S7ZM2vriJ8StHZWRnT JzPA== 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 r30si6154667pgl.69.2019.08.07.23.49.26; Wed, 07 Aug 2019 23:49:40 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731089AbfHHGrl (ORCPT + 99 others); Thu, 8 Aug 2019 02:47:41 -0400 Received: from out30-131.freemail.mail.aliyun.com ([115.124.30.131]:53541 "EHLO out30-131.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725796AbfHHGrl (ORCPT ); Thu, 8 Aug 2019 02:47:41 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04423;MF=aaron.lu@linux.alibaba.com;NM=1;PH=DS;RN=21;SR=0;TI=SMTPD_---0TYwvRMH_1565246851; Received: from aaronlu(mailfrom:aaron.lu@linux.alibaba.com fp:SMTPD_---0TYwvRMH_1565246851) by smtp.aliyun-inc.com(127.0.0.1); Thu, 08 Aug 2019 14:47:37 +0800 Date: Thu, 8 Aug 2019 14:47:31 +0800 From: Aaron Lu To: Tim Chen Cc: Peter Zijlstra , Julien Desfossez , "Li, Aubrey" , Aubrey Li , Subhra Mazumdar , Vineeth Remanan Pillai , Nishanth Aravamudan , Ingo Molnar , Thomas Gleixner , Paul Turner , Linus Torvalds , Linux List Kernel Mailing , =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , Kees Cook , Greg Kerr , Phil Auld , Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini Subject: Re: [RFC PATCH v3 00/16] Core scheduling v3 Message-ID: <20190808064731.GA5121@aaronlu> References: <20190725143003.GA992@aaronlu> <20190726152101.GA27884@sinkpad> <7dc86e3c-aa3f-905f-3745-01181a3b0dac@linux.intel.com> <20190802153715.GA18075@sinkpad> <20190806032418.GA54717@aaronlu> <20190806171241.GQ2349@hirez.programming.kicks-ass.net> <21933a50-f796-3d28-664c-030cb7c98431@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <21933a50-f796-3d28-664c-030cb7c98431@linux.intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 06, 2019 at 02:19:57PM -0700, Tim Chen wrote: > +void account_core_idletime(struct task_struct *p, u64 exec) > +{ > + const struct cpumask *smt_mask; > + struct rq *rq; > + bool force_idle, refill; > + int i, cpu; > + > + rq = task_rq(p); > + if (!sched_core_enabled(rq) || !p->core_cookie) > + return; I don't see why return here for untagged task. Untagged task can also preempt tagged task and force a CPU thread enter idle state. Untagged is just another tag to me, unless we want to allow untagged task to coschedule with a tagged task. > + cpu = task_cpu(p); > + force_idle = false; > + refill = true; > + smt_mask = cpu_smt_mask(cpu); > + > + for_each_cpu(i, smt_mask) { > + if (cpu == i) > + continue; > + > + if (cpu_rq(i)->core_forceidle) > + force_idle = true; > + > + /* Only refill if everyone has run out of allowance */ > + if (cpu_rq(i)->core_idle_allowance > 0) > + refill = false; > + } > + > + if (force_idle) > + rq->core_idle_allowance -= (s64) exec; > + > + if (rq->core_idle_allowance < 0 && refill) { > + for_each_cpu(i, smt_mask) { > + cpu_rq(i)->core_idle_allowance += (s64) SCHED_IDLE_ALLOWANCE; > + } > + } > +}