Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp643466imp; Thu, 21 Feb 2019 08:20:40 -0800 (PST) X-Google-Smtp-Source: AHgI3IbQ1IQXbV/Crv70h4Q1aGqcf+WKshlnOZDw7K7DMcKUM2XqayhAlLjG/4CIYWHMgcpzYkCY X-Received: by 2002:a62:2a4b:: with SMTP id q72mr40763356pfq.61.1550766040752; Thu, 21 Feb 2019 08:20:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550766040; cv=none; d=google.com; s=arc-20160816; b=rqO3bkUBCO+3psr+IpPzkRRsHRXBRCn6iDVN+sA3BOuLZ4+5a2Jxu5252NqC+KQQqI 5grwP7z8rILMLZUIcGefdIsXYV1r90aiVMDtc52KfVm8CZsudJL3u33NHPpfP348MyLV fhYBByHdFeHHoU8zCNI3e5NzMUPF7V88x4SZFg6WSXsV0n8oEju+dBOq8uIPukkYiGpj S/zTp77D/xTNxO94EGj/qwuqGOdNFGY2sjI10hDHG+EYhr1yrqaz2tsUXgRnXiNM7zbp DX69yLGG9WcgK1Fw9MiIgE4rABT/2sRHSC3LwC73OSLrT91JRt0GCHm7MX74zE2F6SwE qs8g== 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=CE46FlVxtlBiwofUQbA084vZQr3goruZ/m5o2k0S228=; b=Xd/TQyIf/JLUBEWLb3F3Ac5qNt6iZ4rXCP4mwdOHbTpeIUU9P0b3TySJC4Py44gcLL 84f/XLBUOUZK+7MYtUi2t5EnjuUFWqueeJ8F54hmExhzKFR35zLgsmlGdgbqO+34Lf5q 5nkwS0wo5XibS5I6WX/xydVCkwwb+eIFujCjGfnEhOjCILppIFEmZMbbqLkoT4YNVkO+ r1xiNDPNyncsbkMdQzyUA0JNsCev+cpN46YLw0GDMdcly669ZAikBISKLjVY+VsJCevq +tXcxoz4MysF+XGzugRffe8JIa/+v+iqnc8Q6a0kSY1PZarr86H/63nsfCEGE56Y7XjJ JK7Q== 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 x1si1770078plo.58.2019.02.21.08.20.25; Thu, 21 Feb 2019 08:20:40 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726494AbfBUQTv (ORCPT + 99 others); Thu, 21 Feb 2019 11:19:51 -0500 Received: from foss.arm.com ([217.140.101.70]:47406 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725932AbfBUQTv (ORCPT ); Thu, 21 Feb 2019 11:19:51 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A7D71A78; Thu, 21 Feb 2019 08:19:50 -0800 (PST) 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 8B4F83F690; Thu, 21 Feb 2019 08:19:48 -0800 (PST) Subject: Re: [RFC][PATCH 15/16] sched: Trivial forced-newidle balancer To: Peter Zijlstra , mingo@kernel.org, tglx@linutronix.de, pjt@google.com, tim.c.chen@linux.intel.com, torvalds@linux-foundation.org Cc: linux-kernel@vger.kernel.org, subhra.mazumdar@oracle.com, fweisbec@gmail.com, keescook@chromium.org, kerrnel@google.com References: <20190218165620.383905466@infradead.org> <20190218173514.796920915@infradead.org> From: Valentin Schneider Message-ID: Date: Thu, 21 Feb 2019 16:19:46 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190218173514.796920915@infradead.org> 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 Hi, On 18/02/2019 16:56, Peter Zijlstra wrote: [...] > +static bool try_steal_cookie(int this, int that) > +{ > + struct rq *dst = cpu_rq(this), *src = cpu_rq(that); > + struct task_struct *p; > + unsigned long cookie; > + bool success = false; > + > + local_irq_disable(); > + double_rq_lock(dst, src); > + > + cookie = dst->core->core_cookie; > + if (!cookie) > + goto unlock; > + > + if (dst->curr != dst->idle) > + goto unlock; > + > + p = sched_core_find(src, cookie); > + if (p == src->idle) > + goto unlock; > + > + do { > + if (p == src->core_pick || p == src->curr) > + goto next; > + > + if (!cpumask_test_cpu(this, &p->cpus_allowed)) > + goto next; > + > + if (p->core_occupation > dst->idle->core_occupation) > + goto next; > + IIUC, we're trying to find/steal tasks matching the core_cookie from other rqs because dst has been cookie-forced-idle. If the p we find isn't running, what's the meaning of core_occupation? I would have expected it to be 0, but we don't seem to be clearing it when resetting the state in pick_next_task(). If it is running, we prevent the stealing if the core it's on is running more matching tasks than the core of the pulling rq. It feels to me as if that's a balancing tweak to try to cram as many matching tasks as possible in a single core, so to me this reads as "don't steal my tasks if I'm running more than you are, but I will steal tasks from you if I'm given the chance". Is that correct? [...]