Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3608420yba; Mon, 29 Apr 2019 05:38:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXoZuMWGl+ULDneW1Upy/Yp3Y0l6hQ3aw/i3edPONCYwYVQHBDDSYUlynLhBXNN3tlyo0h X-Received: by 2002:a63:df43:: with SMTP id h3mr59287900pgj.294.1556541502075; Mon, 29 Apr 2019 05:38:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556541502; cv=none; d=google.com; s=arc-20160816; b=N1gdfKXg4Mz2gcUH2Imh3Gd7SjPFC5rbHc+zYIwFq6OZyzvc2BhIzN90mobmPiSN7g pDvtdqGcDlw5GP9FKSFAi2Q0pFFPRuv28VoLp+SIeIYmK20F7VB1NvV6gDkoYvPp1Ty0 KZF7LJUHr5TOp6FOg6gLuivG+SOnMq23WAAiDDfKzpLi41X85BtIh4vpno981bWLAc3a ZAqiEtibaHQQXdNGvMY3Flxfp245k1hs51D3Y91ErSQVMKaPyy3EBree/qjmdwSr3JMG ZdUhTgXflubwEO9RIKtJC8RBSysJbLFtrudwF+T6OcuED6W0H5Wht3cH1EvH58atLuYa JrNA== 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=tsdtygGHwHLDiP7U7Nb22tfplZQ4QZkZbhbFoqCY5j8=; b=XP2EmpWEdvsxNygOYXjlRfJo74FJUjXafEqN/GnSdVgvQ2aq7qvjMvSzaz+0ltPEvL i831JyyOJPG9ftx9SeJVL6e61Q9kxVxSUwxZhMEae1d3tz4gUlBjBWUG89LI51Lojz+Q DP76ngLe9rGi9KTA+m2I6syVWeJwUFlzhjR7s4Fh57h8Nqh91dL4dE2O5UQGwPeQmL66 CKwYLKtuN6JRexsL3PADAQ5wpiL3z6OmDJ1v6ABGRkfUmRoor2ind8wrXmKUhUteTRD+ JtB1UYROWfJQAFEz83mGuQNSRJjibsqXdJPEKKgilB0O1/5b7+idDO1gNyiHU49VQVg0 1SQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@digitalocean.com header.s=google header.b=Rp1IdbRA; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=digitalocean.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j184si35286170pfb.106.2019.04.29.05.38.06; Mon, 29 Apr 2019 05:38:22 -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=pass header.i=@digitalocean.com header.s=google header.b=Rp1IdbRA; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=digitalocean.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728157AbfD2Mgu (ORCPT + 99 others); Mon, 29 Apr 2019 08:36:50 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:34706 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727956AbfD2Mgu (ORCPT ); Mon, 29 Apr 2019 08:36:50 -0400 Received: by mail-qt1-f194.google.com with SMTP id j6so11675726qtq.1 for ; Mon, 29 Apr 2019 05:36:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digitalocean.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=tsdtygGHwHLDiP7U7Nb22tfplZQ4QZkZbhbFoqCY5j8=; b=Rp1IdbRAg44yBruvqm0KtYJGRO62vJxcikXVloHeZ4JXGHD+WrE0ueSYlgEkbbgMhk pYs5bP8BEV5lMPCWfOJ+hUQdY8hPHghG9f0qwlLPSYpnzCLsU3q3jiYaUcV9waCOCbKS I5RmTzEKKqEoDUZHojdqSJyyLg9gMcrJ+G568= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=tsdtygGHwHLDiP7U7Nb22tfplZQ4QZkZbhbFoqCY5j8=; b=ewTf+6zY+wI9D4dL7piAPcr4NCbXHw+F9W8RlmXj2woqDkJ85peReFj32KaL1n85Bp xftHo05AsPYGdr65v4wyzt4AWsxD3h0aaUSYg/Wxu25Hynz0c9ua/LwsnH3Isn78gMsM Y+F6stUwjmMiENDTbrRBeKeC7fdGfBZC4gpKDcwd/+B6DeO4Nu5uyA/RuTEbi4Da3fXn c99XiVANbCN0z1hinItsPcv+AqRK2Ww6LVR0ms022nysxs2O5BvJTTliryRsvl9q5E1r jUY9Y9FYRT91N/bxy+kkxH9FSvKLhn1ixYqSWtsFSTbJtZDL4V26ZZmJ6OJBV38yLRYp MOEg== X-Gm-Message-State: APjAAAUkdpV6tQsVFam2OzNBHuI79pqgN0ZO0bVBxX162dMNArsPm4Zm NmLxFKo3QZX+sGgWJ90cLonPSA== X-Received: by 2002:ac8:2728:: with SMTP id g37mr25376314qtg.264.1556541409092; Mon, 29 Apr 2019 05:36:49 -0700 (PDT) Received: from sinkpad (192-222-189-155.qc.cable.ebox.net. [192.222.189.155]) by smtp.gmail.com with ESMTPSA id d55sm3249211qtb.59.2019.04.29.05.36.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Apr 2019 05:36:48 -0700 (PDT) Date: Mon, 29 Apr 2019 08:36:42 -0400 From: Julien Desfossez To: Peter Zijlstra Cc: Vineeth Remanan Pillai , Nishanth Aravamudan , Tim Chen , mingo@kernel.org, tglx@linutronix.de, pjt@google.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, subhra.mazumdar@oracle.com, fweisbec@gmail.com, keescook@chromium.org, kerrnel@google.com, Phil Auld , Aaron Lu , Aubrey Li , Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini Subject: Re: [RFC PATCH v2 16/17] sched: Wake up sibling if it has something to run Message-ID: <20190429123642.GA16059@sinkpad> References: <20190426150337.GC2623@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190426150337.GC2623@hirez.programming.kicks-ass.net> X-Mailer: Mutt 1.5.24 (2015-08-30) User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26-Apr-2019 05:03:37 PM, Peter Zijlstra wrote: > On Tue, Apr 23, 2019 at 04:18:21PM +0000, Vineeth Remanan Pillai wrote: > > (you lost From: Julien) > > > During core scheduling, it can happen that the current rq selects a > > non-tagged process while the sibling might be idling even though it > > had something to run (because the sibling selected idle to match the > > tagged process in previous tag matching iteration). We need to wake up > > the sibling if such a situation arise. > > > > Signed-off-by: Vineeth Remanan Pillai > > Signed-off-by: Julien Desfossez > > --- > > kernel/sched/core.c | 15 +++++++++++++++ > > 1 file changed, 15 insertions(+) > > > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > > index e8f5ec641d0a..0e3c51a1b54a 100644 > > --- a/kernel/sched/core.c > > +++ b/kernel/sched/core.c > > @@ -3775,6 +3775,21 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) > > */ > > if (i == cpu && !rq->core->core_cookie && !p->core_cookie) { > > next = p; > > + rq->core_pick = NULL; > > + > > + /* > > + * If the sibling is idling, we might want to wake it > > + * so that it can check for any runnable tasks that did > > + * not get a chance to run due to previous task matching. > > + */ > > + for_each_cpu(j, smt_mask) { > > + struct rq *rq_j = cpu_rq(j); > > + rq_j->core_pick = NULL; > > + if (j != cpu && > > + is_idle_task(rq_j->curr) && rq_j->nr_running) { > > + resched_curr(rq_j); > > + } > > + } > > goto done; > > } > > Anyway, as written here: > > https://lkml.kernel.org/r/20190410150116.GI2490@worktop.programming.kicks-ass.net > > I think this isn't quite right. Does the below patch (which actually > removes lines) also work? > > As written before; the intent was to not allow that optimization if the > last pick had a cookie; thereby doing a (last) core wide selection when > we go to a 0-cookie, and this then includes kicking forced-idle cores. It works and the performance is similar to our previous solution :-) Thanks, Julien