Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7923223ybi; Tue, 9 Jul 2019 06:26:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxc4Iw2GqZ06tDNnUHkj8j5JtQZvaphY3bzJwlsoMD48zGWcdusxxIqzG20oK8BRMaI/F7/ X-Received: by 2002:a65:4d4e:: with SMTP id j14mr30403904pgt.50.1562678775312; Tue, 09 Jul 2019 06:26:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562678775; cv=none; d=google.com; s=arc-20160816; b=nHL5UE/PP+VyUsZ22tNI4HB9IwR+2rihqQ0eOepBYEo/oZ12beOFZuUSJCmvmRZN2p MaoaZtdAZC8jHaH4Ul+tRCd32doPDlJhJ/2qtyYTfy82p68Vdzkh8xMZAuih8Gq5+Vie 1Oztu77dCYGxBY+MynWA7F0CR+sJRLKRcVocuc35gQ7h5Uw8juTPOKtbeq9of9yYa5NO ynfofR7Yv2eVSOG1s4jWmWeeN+LL+etESAT+lFo7CDAEfPAqBLpOlsaFqE3OqnSgN7oJ UtbBwdKz5qv2eRLTT3Sru5JAqj9C8ZrSzVCKF3JVfTuapfmNkELPiIzVsKr6XycwPpVh kYVA== 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:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=uHvfpYDHdhQ2JgW2SLRdfAyS5DQuANblqYFHO6GDpHg=; b=v7OXbhXoDHAkpPU2L9QuQwgQSTAEB/ge4BVkHS7CqUCavnOeXhR3SyftYcZYwHgqqR hNmssp8S+pybsVzc5YR5F2ef8Qdjj4YubGk05DqmSqtfB3+mqRteFxVqlt50TlMAUF5w rRxzN8s/MmMjSd9u3tWBvsI6lWGxrNOQZJY+MHFn+0lYaq4BlxchmS/bJo72sjScPIEY RKuSjqY19MAPNiGr3hRPnzL0xtIwo3AlnkCwCYD1Xxn4+nTSDm1HhdmS93/28dVFVK/Y rrZEBQze85LdrhQGYystq2PABMwBL+wrg8t572UI8fEvl/29xUxkTYikcM8VWtdoZGN9 hbeQ== 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 h9si21655580pgs.397.2019.07.09.06.25.59; Tue, 09 Jul 2019 06:26:15 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727012AbfGINYq (ORCPT + 99 others); Tue, 9 Jul 2019 09:24:46 -0400 Received: from mail.sssup.it ([193.205.80.98]:38767 "EHLO mail.santannapisa.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726047AbfGINYp (ORCPT ); Tue, 9 Jul 2019 09:24:45 -0400 Received: from [10.30.3.195] (account l.abeni@santannapisa.it HELO luca64) by santannapisa.it (CommuniGate Pro SMTP 6.1.11) with ESMTPSA id 140673049; Tue, 09 Jul 2019 15:24:41 +0200 Date: Tue, 9 Jul 2019 15:24:36 +0200 From: luca abeni To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , "Rafael J . Wysocki" , Ingo Molnar , Vincent Guittot , "Paul E . McKenney" , Joel Fernandes , Quentin Perret , Luc Van Oostenryck , Morten Rasmussen , Juri Lelli , Daniel Bristot de Oliveira , Patrick Bellasi , Tommaso Cucinotta , Dietmar Eggemann Subject: Re: [RFC PATCH 3/6] sched/dl: Try better placement even for deadline tasks that do not block Message-ID: <20190709152436.51825f98@luca64> In-Reply-To: <20190708135536.GK3402@hirez.programming.kicks-ass.net> References: <20190506044836.2914-1-luca.abeni@santannapisa.it> <20190506044836.2914-4-luca.abeni@santannapisa.it> <20190708135536.GK3402@hirez.programming.kicks-ass.net> Organization: Scuola Superiore S. Anna X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, On Mon, 8 Jul 2019 15:55:36 +0200 Peter Zijlstra wrote: > On Mon, May 06, 2019 at 06:48:33AM +0200, Luca Abeni wrote: > > @@ -1223,8 +1250,17 @@ static void update_curr_dl(struct rq *rq) > > dl_se->dl_overrun = 1; > > > > __dequeue_task_dl(rq, curr, 0); > > - if (unlikely(dl_se->dl_boosted > > || !start_dl_timer(curr))) > > + if (unlikely(dl_se->dl_boosted > > || !start_dl_timer(curr))) { enqueue_task_dl(rq, curr, > > ENQUEUE_REPLENISH); +#ifdef CONFIG_SMP > > + } else if (dl_se->dl_adjust) { > > + if (rq->migrating_task == NULL) { > > + queue_balance_callback(rq, > > &per_cpu(dl_migrate_head, rq->cpu), migrate_dl_task); > > I'm not entirely sure about this one. > > That is, we only do those callbacks from: > > schedule_tail() > __schedule() > rt_mutex_setprio() > __sched_setscheduler() > > and the above looks like it can happen outside of those. Sorry, I did not know the constraints or requirements for using queue_balance_callback()... I used it because I wanted to trigger a migration from update_curr_dl(), but invoking double_lock_balance() from this function obviously resulted in a warning. So, I probably misunderstood the purpose of the balance callback API, and I misused it. What would have been the "right way" to trigger a migration for a task when it is throttled? > > The pattern in those sites is: > > rq_lock(); > ... do crap that leads to queue_balance_callback() > rq_unlock() > if (rq->balance_callback) { > raw_spin_lock_irqsave(rq->lock, flags); > ... do callbacks > raw_spin_unlock_irqrestore(rq->lock, flags); > } > > So I suppose can catch abuse of this API by doing something like the > below; can you validate? Sorry; right now I cannot run tests on big.LITTLE machines... Maybe Dietmar (added in cc), who is working on mainlining this patcset, can test? Thanks, Luca > > --- > > diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h > index aaca0e743776..89e615f1eae6 100644 > --- a/kernel/sched/sched.h > +++ b/kernel/sched/sched.h > @@ -1134,6 +1134,14 @@ static inline void rq_pin_lock(struct rq *rq, > struct rq_flags *rf) rf->cookie = lockdep_pin_lock(&rq->lock); > > #ifdef CONFIG_SCHED_DEBUG > +#ifdef CONFIG_SMP > + /* > + * There should not be pending callbacks at the start of > rq_lock(); > + * all sites that handle them flush them at the end. > + */ > + WARN_ON_ONCE(rq->balance_callback); > +#endif > + > rq->clock_update_flags &= (RQCF_REQ_SKIP|RQCF_ACT_SKIP); > rf->clock_update_flags = 0; > #endif