Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp755269imp; Thu, 21 Feb 2019 10:29:43 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia79SZxTRFFbKPa4BCtWwjeJYIQVEUZcuiGXFomzLLcjzH73SQ+k0KWatbS9+TLzPuNZqDG X-Received: by 2002:a63:1723:: with SMTP id x35mr35064184pgl.364.1550773783459; Thu, 21 Feb 2019 10:29:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550773783; cv=none; d=google.com; s=arc-20160816; b=RieRBticZ/dNQoBRY4IXV2FfrmqTLKLlsiIyHOQv34vbwJZV+pH7gDP3IOfTiSpbuu NTe11+dp4+htdTmMqah9k53t2daTlyQSOrcKQG7ZMwvfO02waR/cEg9BskCJQ/Z33yxe ow2fDDzHoL9EC1Bx9Ow/ZwWy1d4x6S9bjCWBWbPLh9MbwKZKZ5hREi8ix/4XMD/K+PnU NDTk409qztEASJZGTmA14sIlnJYDKtnY8opAW83fVy00UwtAQPUiUR7+DlVZ7RY7XsEv Kt3Gg4UsPJzLzkEvAAgqksGoYgwxg6cgLDVpJtlFB5zYuBOJuygDowEXnxR0WbrRQE1r mI9Q== 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=J3TiiwVnXkC6bv3Y1yRdnZUE4u8LnGIKfBYqq2jjyqw=; b=BNr8/jsRkqR7fZ6IXeqS8Y7zdYzQ6Z7VcrUVHc1T+LPgzYDbf224jSJZEoL/E4UcpR eYMWCoobLJBdnVpK3gaspJrh8Wrkm+5gbbPiqTNLU6Rgur+MZx06YxC1hM35TWSJTWcb nCn03s+pn9NOJ7d09YJvkeqt1Zckkbu2o8c0R1w3zsjVOj4D6SFDaZ2ZMq0uOJxE/NKn xNKF9ileK9TiRPsgeyYBKBqbvTFl+WlStsGLPHIz0kDpgSasm38XYC/ECV9MXb9yTgWj nfLHKpISj9cqSOBYD1cri9nCWN4AykbHBiYzWfewOeN+f++b3vu/NbSadXcv/kX+GB2z kOKg== 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 u5si9300291plm.225.2019.02.21.10.29.28; Thu, 21 Feb 2019 10:29:43 -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 S1728814AbfBUS2j (ORCPT + 99 others); Thu, 21 Feb 2019 13:28:39 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:49244 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726155AbfBUS2j (ORCPT ); Thu, 21 Feb 2019 13:28:39 -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 9F7B780D; Thu, 21 Feb 2019 10:28:38 -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 852733F5C1; Thu, 21 Feb 2019 10:28:36 -0800 (PST) Subject: Re: [RFC][PATCH 15/16] sched: Trivial forced-newidle balancer To: Peter Zijlstra Cc: mingo@kernel.org, tglx@linutronix.de, pjt@google.com, tim.c.chen@linux.intel.com, torvalds@linux-foundation.org, 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> <20190221164146.GV32494@hirez.programming.kicks-ass.net> <20190221164702.GY32534@hirez.programming.kicks-ass.net> From: Valentin Schneider Message-ID: <49bd4760-53d4-3695-4bcc-aeb9086617ab@arm.com> Date: Thu, 21 Feb 2019 18:28:34 +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: <20190221164702.GY32534@hirez.programming.kicks-ass.net> 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 21/02/2019 16:47, Peter Zijlstra wrote: [...] >>> 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(). >> >> Indeed. We preserve the occupation from the last time around; it's not >> perfect but its better than nothing. >> >> Consider there's two groups; and we just happen to run the other group. >> Then our occopation, being what it was last, is still accurate. When >> next we run, we'll again get that many siblings together. >> >>> 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? >> >> Correct, otherwise an SMT4 with 5 tasks could end up ping-ponging the >> one task forever. >> Wouldn't we want to move some tasks in those cases? If we're going newidle we're guaranteed to have a thread for that extra task. So if (p->core_occupation == cpumask_weight(cpu_smt_mask(that)) we could want to steal, overriding the occupation comparison (we already have a (p == src->core_pick) abort before). Kind of feels like CFS stealing that steals when nr_running > 1. >> Note that a further condition a little up the callchain from here only >> does this stealing if the thread was forced-idle -- ie. it had something >> to run anyway. So under the condition where there simple aren't enough >> tasks to keep all siblings busy, we'll not compact just cause. > > Better example; it will avoid stealing a task from a full SMT2 core to > fill another. > Aye, that's the scenario I was thinking of. Thanks for clearing things up.