Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp680766yba; Fri, 26 Apr 2019 07:05:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBwar/Wr0MuAFSnsLPgUgp2Pfv8tXRcTMZKUsOWlFJLm2HMnzoO99UU0dVxATAL/QVa6po X-Received: by 2002:a17:902:b70c:: with SMTP id d12mr37957594pls.178.1556287526563; Fri, 26 Apr 2019 07:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556287526; cv=none; d=google.com; s=arc-20160816; b=Ow6arj4oYAsj0E4d6MpgRQJP1Boh5ANKMUHDGmcV5Bj18WtEz7tGvC2YgMtfjMFPdb l3Fqo8k6/fhKdklc2vO2SbJuvyVC3qih+kcMleL4+gzhv3G9yUd3njhIVsjbOlmN54g8 JcRqopbXbsXw/CurpBpX48Z9L0Bsay6MDyNLzAvMwpH6RKtfP9XMnCVtIQ7xt42II+tY sR7YFrp1+T9da6cBd6irvP4MdelUelk8gAMmCbVT4syRUYfwelaFF0BeALR7dWtm1Jcb uAOLuIcvWkg5FuUvdNp2jm/GoOequaEKfFLJd/0JFksQOYZSBSjaMda2dEfj9o66zre5 hMAg== 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=ngzfdohvXqSUVZnRL5smiig+x3FdhK7oHwWhG+cjpGA=; b=chZhdF7O/8Htsmgy9diCpAsQSr9lYDC4vOcN+pYl2JXCJBYh1IBDdtBeWUnC46V3YX 3P58N4USyYfzUj5QqnUgMU+QaGgU/ao2obK+O16X0bUBVZBDqFy1+rvPtBnU0BlET23G G/A/8qnJYGm9OZH0ds+jXvV8dL7CVr+0JOuaEx3+OzffILvNF3RC2M+tiKbbLHSUGo1h ZvnLFzN7YlN4wynTGaDsu84ZXVMunWTuwCexqhAKoOiRGs4oECy3ol5p+1YqH1yXjV7l LC4qPIeWF4nBV092Gc30aJ07NFCSxvcnZoNr26UZVZRCPZZ9oQJ4FiqKVjXl20+fr6YZ rXdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=A2Ovcpju; 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 k73si25790532pfb.195.2019.04.26.07.05.09; Fri, 26 Apr 2019 07:05:26 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=A2Ovcpju; 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 S1726263AbfDZOCW (ORCPT + 99 others); Fri, 26 Apr 2019 10:02:22 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:35682 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726039AbfDZOCW (ORCPT ); Fri, 26 Apr 2019 10:02:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ngzfdohvXqSUVZnRL5smiig+x3FdhK7oHwWhG+cjpGA=; b=A2OvcpjuZlnGx8SM9RnopTxWZ 6op1Z0KKtOzcNSIOLl1ULOMy0oTEjWC9hNw/TuGeKteeud+h7tpBX9v0VafcMajkOFr1eXk7hpPhi XF40UcNDY6ke5PwBB4HOS43E8icf4hNgQjz01v9m6I+vcq0vA7CYY5PPA+iHI1FvPzTmDDW4znjtf 4L3ISCoJ7xHPFAusgYsE0o2HO+KC3J/vEbKN0cUAbmEsKhH5cpYrXiGt3inB0gvQkAM3iA8rYwQUq +FmJ1GrzhltCUK+D7//8Zmpd0P58nuAtBEvABfgZ1KMKsPzuZr26yOGvtUJ4+0SGwZkcpPx+8dGh3 oOpjJlKQw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hK1QZ-0007V3-1q; Fri, 26 Apr 2019 14:02:11 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 3FCB5286B7D80; Fri, 26 Apr 2019 16:02:09 +0200 (CEST) Date: Fri, 26 Apr 2019 16:02:09 +0200 From: Peter Zijlstra To: Vineeth Remanan Pillai Cc: Nishanth Aravamudan , Julien Desfossez , 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 09/17] sched: Introduce sched_class::pick_task() Message-ID: <20190426140209.GA2623@hirez.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Tue, Apr 23, 2019 at 04:18:14PM +0000, Vineeth Remanan Pillai wrote: > +static struct task_struct * > +pick_task_fair(struct rq *rq) > +{ > + struct cfs_rq *cfs_rq = &rq->cfs; > + struct sched_entity *se; > + > + if (!cfs_rq->nr_running) > + return NULL; > + > + do { > + struct sched_entity *curr = cfs_rq->curr; > + > + se = pick_next_entity(cfs_rq, NULL); > + > + if (!(se || curr)) > + return NULL; I didn't get around to reading the original discussion here, but how can that possibly be? I can see !se, in that case curr is still selected. I can also see !curr, in that case curr is put. But I cannot see !se && !curr, per the above check we know cfs_rq->nr_running != 0, so there must be a cfs task to find. This means either curr or se must exist. > + > + if (curr) { > + if (se && curr->on_rq) > + update_curr(cfs_rq); > + > + if (!se || entity_before(curr, se)) > + se = curr; > + } > + > + cfs_rq = group_cfs_rq(se); > + } while (cfs_rq); > + > + return task_of(se); > +}