Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp489804imm; Fri, 12 Oct 2018 01:31:03 -0700 (PDT) X-Google-Smtp-Source: ACcGV60vqMZ5pC9qOcORCcx1xeL7WPO+fb+vmjxf2EVgZXLWdJEd3i7xiNgDtfN0knleAZfZfPoq X-Received: by 2002:a63:1e5c:: with SMTP id p28-v6mr4703506pgm.376.1539333063524; Fri, 12 Oct 2018 01:31:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539333063; cv=none; d=google.com; s=arc-20160816; b=Y1+Akzh6CpqzWzSlfUG0L+7MZ9mdy735NceqtnhM/roSPilngrVBHmF+WElklZrnne CNQDn0QacGOC0w85qvHvJebc4LcjNq9ibT7Pq34jHRgmu70y+ZuPQombxbaCCsdVydgA JcS+q/CCLJjkLtOaQRGq2KuJXncRAGAm8HA7XTFOzi3K9/FgixvbdK4P2CaWYJoPXfPo SE1v+Gd7S1ks4+locDNciVCdSIvtaklify5Ns9pFTUrjZhf0GV5kmH9oIAzyMP0lyP43 AZRWOAMhw6qoihhhZhK5FnYwyFiCrQmrebptynSgpkXp9qtKKVn9es2n2KV1n4K2e7D4 m8xw== 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=0uFJzDeiKzDpzpa+RpZEwszDt2nMNJOOP32gfeVX2u8=; b=uuU3xtKhLU5gBXTqEB10SF+vUTK4/8eNn3Fe7+D/dmaVK5cRuUcWyNQgkOXg4lDhxO 7ckovSk+wNQ/mw4MYW8xzfD49Vty9YwDBD3DmDdK0nntTjFtdD140Ww6x2mX18RK36rn QdAFl5JA7BhExTZWtLtGDfpLw+x71O04oyiDYDfFU3E72TFewSTwY/ysQSVsCot7mS/P C6Ib7255cgCfaUgzqMDLMmyoUYqB4jfERIc7/kFlJyJr61yPiovsw8ARc92BacHo0fYj t0JMYPYmrkiEkM2CwuWDkATkCFpSs/UZmVFmnluJYFRNLKIs4+ov70oBDifYaaMzf/Wb s3wQ== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p188-v6si629222pfg.197.2018.10.12.01.30.48; Fri, 12 Oct 2018 01:31:03 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727880AbeJLQBh (ORCPT + 99 others); Fri, 12 Oct 2018 12:01:37 -0400 Received: from mail-ed1-f48.google.com ([209.85.208.48]:44795 "EHLO mail-ed1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727524AbeJLQBh (ORCPT ); Fri, 12 Oct 2018 12:01:37 -0400 Received: by mail-ed1-f48.google.com with SMTP id z21-v6so10713410edb.11 for ; Fri, 12 Oct 2018 01:30:16 -0700 (PDT) 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=0uFJzDeiKzDpzpa+RpZEwszDt2nMNJOOP32gfeVX2u8=; b=r+qS19Fla735P/Zj4CQL1r8/wwaYp5Y1EdEQPVmVaPTX7P7F+lUonhUjbHNCUvKJOZ lEkHepDwrr/zJxBdkJIeGoRrbQ+WighJ2+aAHdNbO7h8Jw0yHeLUULEkARYjQmcEamu6 ksol2cN89xEgw01noxKPxVJLgRmkfCOlnyU2bwHHtXQ8GoYXGEqsWxa9e2BN2cjQB+JD qGArMNtgfnTcvpo0xZCRZ8QhsvK8T+PrZWMrDr6zpsPGvVfH7ddw/J6aKUVqrsPxCfiW 2+0Qc/+S2h9CfLr9mtFZFrtYnfiYYgdzF5BzhH0ccxmt296vDMwsTONX+nY3LcE0EgQi Z79Q== X-Gm-Message-State: ABuFfohRgwhoR3ae+nWn2e96rxGnD3s/3cbh3CFmtnU6bUOgCIRoQxs2 SgUEI7BgsV8N4jupLv1r+yVs5A== X-Received: by 2002:a17:906:70c3:: with SMTP id g3-v6mr6029253ejk.194.1539333016000; Fri, 12 Oct 2018 01:30:16 -0700 (PDT) Received: from localhost.localdomain (p200300EF2BD31613C1F2E846AEDA540D.dip0.t-ipconnect.de. [2003:ef:2bd3:1613:c1f2:e846:aeda:540d]) by smtp.gmail.com with ESMTPSA id s46-v6sm413233edb.49.2018.10.12.01.30.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Oct 2018 01:30:14 -0700 (PDT) Date: Fri, 12 Oct 2018 10:30:10 +0200 From: Juri Lelli To: luca abeni Cc: Peter Zijlstra , mingo@redhat.com, rostedt@goodmis.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, claudio@evidence.eu.com, tommaso.cucinotta@santannapisa.it, alessio.balsini@gmail.com, bristot@redhat.com, will.deacon@arm.com, andrea.parri@amarulasolutions.com, dietmar.eggemann@arm.com, patrick.bellasi@arm.com, henrik@austad.us, linux-rt-users@vger.kernel.org Subject: Re: [RFD/RFC PATCH 5/8] sched: Add proxy execution Message-ID: <20181012083010.GV9130@localhost.localdomain> References: <20181009092434.26221-1-juri.lelli@redhat.com> <20181009092434.26221-6-juri.lelli@redhat.com> <20181010131048.54afd1b6@luca64> <20181011123448.GS9130@localhost.localdomain> <20181011125325.GA9867@hirez.programming.kicks-ass.net> <20181012092231.0bdb5cf7@sweethome> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181012092231.0bdb5cf7@sweethome> 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 12/10/18 09:22, luca abeni wrote: > On Thu, 11 Oct 2018 14:53:25 +0200 > Peter Zijlstra wrote: > > [...] > > > > > + if (rq->curr != rq->idle) { > > > > > + rq->proxy = rq->idle; > > > > > + set_tsk_need_resched(rq->idle); > > > > > + /* > > > > > + * XXX [juril] don't we still need to migrate > > > > > @next to > > > > > + * @owner's CPU? > > > > > + */ > > > > > + return rq->idle; > > > > > + } > > > > > > > > If I understand well, this code ends up migrating the task only > > > > if the CPU was previously idle? (scheduling the idle task if the > > > > CPU was not previously idle) > > > > > > > > Out of curiosity (I admit this is my ignorance), why is this > > > > needed? If I understand well, after scheduling the idle task the > > > > scheduler will be invoked again (because of the > > > > set_tsk_need_resched(rq->idle)) but I do not understand why it is > > > > not possible to migrate task "p" immediately (I would just check > > > > "rq->curr != p", to avoid migrating the currently scheduled > > > > task). > [...] > > I think it was the safe and simple choice; note that we're not > > migrating just a single @p, but a whole chain of @p. > > Ah, that's the point I was missing... Thanks for explaining, now > everything looks more clear! > > > But... Here is my next dumb question: once the tasks are migrated to > the other runqueue, what prevents the scheduler from migrating them > back? In particular, task p: if it is (for example) a fixed priority > task an is on this runqueue, it is probably because the FP invariant > wants this... So, the push mechanism might end up migrating p back to > this runqueue soon... No? Not if p is going to be proxying for owner on owner's rq. OTOH, I guess we might have counter-migrations generated by push/pull decisions. Maybe we should remove potential proxies from pushable? We'd still have the same problem for FAIR though. In general it seems to make sense to me the fact that potential proxies shouldn't participate to load balancing while waiting to be activated by the mutex owner; they are basically sleeping, even if they are not. > Another doubt: if I understand well, when a task p "blocks" on a mutex > the proxy mechanism migrates it (and the whole chain of blocked tasks) > to the owner's core... Right? > Now, I understand why this is simpler to implement, but from the > schedulability point of view shouldn't we migrate the owner to p's core > instead? Guess the most important reason is that we need to respect owner's affinity, p (and the rest of the list) might have affinity mask that doesn't work well with owner's.