Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp241522imm; Thu, 31 May 2018 23:19:22 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKH+4dGw7MnitM2bqZcOYSKpZIbku7AMaO9E9XwG3wWnVSVwmkx6jXUDJR+YXlVKm+06ud1 X-Received: by 2002:a63:79ca:: with SMTP id u193-v6mr7952475pgc.112.1527833962928; Thu, 31 May 2018 23:19:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527833962; cv=none; d=google.com; s=arc-20160816; b=Q0LD1CEOk+X9QP2Ni6etNeX/ZJvSZost43I5XDFPYZa3J7SByiXlkwUG0TZDCKynBE n09c9LWXFPrMeQ32gIFA9/YlxogeWNLM/s7NTLbEJJGQzdEfiyOFtolR7pa1XPAs8+u9 C3qfTZ0ZuJi6//+pTWC/hguHOmphEvdKBO9VZqbI5DaCjtYTWY6OG5pUYaPqp38O36Un aAWVgRaGiiHeCi5xt7R0KhgGlpjfh/xMvGx77YwPNEU7y8TsgAlic/+IloVVaymtFkZ4 WLoSzsW+K0VM4ZKmBkn10wO5S0jNAm5IIYuGXHhwGEbzEKH6ybl/g92/LdNe24E6j/Ly 1clw== 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:arc-authentication-results; bh=tM4oUnxnaSP8L4G+KsQAsf1oWAOkZInwQqcE+ScRpDU=; b=ca2Qg5YyF8gfmijJo1hM2ybQQMOHF1orjsY+4RDXamm+z7SAGxuIdcot2arzY/JwfA fOvx0pmyPmTrvCEffAokJGQUVlsWIcjh54V2tzQ4Vh5ztH07hMLb8Usewn08pQ7WsNM3 TKE92ivs6gcxJlmgpmPjTYvwzsYayi+liALjNsLyq7mh6rcbMQT6s5MlMQrp4mFrHR9v 7hY2yuWT3bDZh2iHu1jGCp9q+azNSRtRkyyPGQXk4clRAASi+tH1vV9BYNowntikIyUB dmr2mHAKJrdVytMAWyiTxLIeSvwtKv77Y9EezQSLLLX8UVu1Dkip6fql51fJZz8KJkcu Lp2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=jjbUq/ZG; 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 s2-v6si11434177plq.372.2018.05.31.23.19.08; Thu, 31 May 2018 23:19: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=@joelfernandes.org header.s=google header.b=jjbUq/ZG; 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 S1751129AbeFAGSo (ORCPT + 99 others); Fri, 1 Jun 2018 02:18:44 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:36864 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750812AbeFAGSn (ORCPT ); Fri, 1 Jun 2018 02:18:43 -0400 Received: by mail-pl0-f65.google.com with SMTP id 31-v6so4777768plc.4 for ; Thu, 31 May 2018 23:18:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=tM4oUnxnaSP8L4G+KsQAsf1oWAOkZInwQqcE+ScRpDU=; b=jjbUq/ZGlLMnrYkAwmr+EqDxIVOMbFMwdASqTTMbPSsLO5EHfy76P2Akfqm+9vhJVG j4J/1N/aj2bg4KsGvDYS2nwu6+6yeH39C8pMtg7oO4wgkYOeDeMkigQtwcRCEcRZW08J elwEHv7NapdY7Qn+9PA0p6wV4H2sKhN2mPGRg= 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=tM4oUnxnaSP8L4G+KsQAsf1oWAOkZInwQqcE+ScRpDU=; b=TXsmEhunsfdLnCJGukt+ilKoyQSGLqvIix+67iIHOp8gW4No7KOq2o78TIX2May/6i pfeDsADK4r1wrdzFJwO6O8OK0VCt+ZB1vzDZbbPbVlHSBp4dQQyCsCrxDn70JGDgxPBC qIY//gREkfr6K9LECkMQgbOowk2EIjk0gbXi+AFccupQZ9rWV+003r3ltgOoKulN+yGe AAsmKajtkk9EE9MTQfAwD3xJuEDGYYN2mjDwoQ+xKy3W9WqLWecN6gjKm1pC8pywwq5c IkCUpMpHX5OIGWdFQ/JYTvuyQIqbwm2Xgn5SEWXkDaRF3UrPmynciCwmDUnU5EqmtGPg GQuQ== X-Gm-Message-State: ALKqPwe5XjfyZ5JBozqRFf7VdsnQuUksBmoPaXRkNhZIenE7m0HikZa0 QOfomvsk/fu+Jn+7E7IcrX2y8Q== X-Received: by 2002:a17:902:b416:: with SMTP id x22-v6mr10003072plr.267.1527833922617; Thu, 31 May 2018 23:18:42 -0700 (PDT) Received: from localhost ([2620:0:1000:1600:3122:ea9c:d178:eb]) by smtp.gmail.com with ESMTPSA id c3-v6sm74233837pfn.62.2018.05.31.23.18.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 31 May 2018 23:18:42 -0700 (PDT) Date: Thu, 31 May 2018 23:18:41 -0700 From: Joel Fernandes To: byungchul park Cc: peterz@infradead.org, mingo@kernel.org, rostedt@goodmis.org, tglx@linutronix.de, raistlin@linux.it, linux-kernel@vger.kernel.org, juri.lelli@gmail.com, bristot@redhat.com, kernel-team@lge.com Subject: Re: [RESEND, v3, 2/2] sched/deadline: Initialize cp->elements[].cpu to an invalid value Message-ID: <20180601061841.GA191514@joelaf.mtv.corp.google.com> References: <1515392081-32320-2-git-send-email-byungchul.park@lge.com> <20180601061255.GA189147@joelaf.mtv.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180601061255.GA189147@joelaf.mtv.corp.google.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 31, 2018 at 11:12:55PM -0700, Joel Fernandes wrote: > On Mon, Jan 08, 2018 at 03:14:41PM +0900, byungchul park wrote: > > Currently, migrating tasks to cpu0 unconditionally happens when the > > heap is empty, since cp->elements[].cpu was initialized to 0(=cpu0). > > We have to distinguish between the empty case and cpu0 to avoid the > > unnecessary migrations. Therefore, it has to return an invalid value > > e.i. -1 in that case. > > > > Signed-off-by: Byungchul Park > > Acked-by: Steven Rostedt (VMware) > > Acked-by: Daniel Bristot de Oliveira > > --- > > kernel/sched/cpudeadline.c | 10 +++++++++- > > 1 file changed, 9 insertions(+), 1 deletion(-) > > > > diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c > > index 9f02035..bcf903f 100644 > > --- a/kernel/sched/cpudeadline.c > > +++ b/kernel/sched/cpudeadline.c > > @@ -138,6 +138,12 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p, > > int best_cpu = cpudl_maximum_cpu(cp); > > WARN_ON(best_cpu != -1 && !cpu_present(best_cpu)); > > > > + /* > > + * The heap tree is empty for now, just return. > > + */ > > + if (best_cpu == -1) > > + return 0; > > + > > if (cpumask_test_cpu(best_cpu, &p->cpus_allowed) && > > dl_time_before(dl_se->deadline, cpudl_maximum_dl(cp))) { > > if (later_mask) > > @@ -265,8 +271,10 @@ int cpudl_init(struct cpudl *cp) > > return -ENOMEM; > > } > > > > - for_each_possible_cpu(i) > > + for_each_possible_cpu(i) { > > + cp->elements[i].cpu = -1; > > cp->elements[i].idx = IDX_INVALID; > > Shouldn't you also set cp->elements[cpu].cpu to -1 in cpudl_clear (when you > set cp->elements[cpu].cpu to IDX_INVALID there)? I messed up my words, I meant : "when setting cp->elements[cpu].idx to IDX_INVALID there". Which means I need to call it a day :-) - Joel