Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6979938ybi; Mon, 8 Jul 2019 12:03:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqxALnXI2qBx16foB0sX6LY3M0652Se8Mn9MlNo34zFJOeGdaLzpYyg7nAPz+rLbZp5uQLl6 X-Received: by 2002:a17:90a:30e4:: with SMTP id h91mr26755628pjb.37.1562612611119; Mon, 08 Jul 2019 12:03:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562612611; cv=none; d=google.com; s=arc-20160816; b=Tvdps94RanZSiJbQLfdw9B9tPQVoGpaG0Q7eiiC1bHgc4C7gltvSMaVlUt9oH9cuZ+ K+0h8hufYux/nqdiL8rh1lxJhQlnZ52u5LVat14MX/dQd2CpdxpGOay/jKKYcT6lN0V6 7RszbdAu+9LCnyVGAJVDg7NO+2nhQoyRCDdml2yyqT6OIRYXuJSS0rAV+JM+MnZta9oI sY8LfmEWvBMH75lFIJYbVO1iAaY4OYrqSb260CRz5q+UxHdyoTR19rSiKDUJO576hFdM XFP6Z2ZntIChJFTrlLV/TMrkLkFa6P2QP9F1upD70wEb4+oIR/L9HIcQDIh6e2iHfIKc 7FCQ== 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=z7WcggLAejPzEpSoHTmfAATgZoGx2QqDsys6bSdrrxM=; b=s+DgO6kk0X60b50CJZNm6QhcQDcxynHVyctvt8wzn8rcV91aboeMXhGni35jz45E2l o44HlKC1rlmh/T6HcyaxAj7uA9ZVVbsWiDEvYW0oEHYKfAPXhNJ6/jtNVr0dfkENPCyE Una3nspByfWUZQXwPs/xAdJNuM8NW+XG2EzhpHGbST1qICBOP235EohPOfKaocBITqBi uVNmqtpuIqZDQV6+K/yjsF1jPSKnyuvYTmjU5J8XXEizKmKm+Dh7OmLCe4RuCc6l4rj+ DVNAgEuDDZ0gUZNHOXmRPg1ocIpvhdj7ggKZHikBIibOlbMkpcNaDHhEHU7muEoFg9i6 +XFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ISRiZEZ6; 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 b67si357984pjc.81.2019.07.08.12.03.15; Mon, 08 Jul 2019 12:03:31 -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=ISRiZEZ6; 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 S1731463AbfGHNzt (ORCPT + 99 others); Mon, 8 Jul 2019 09:55:49 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:45190 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731401AbfGHNzt (ORCPT ); Mon, 8 Jul 2019 09:55:49 -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=z7WcggLAejPzEpSoHTmfAATgZoGx2QqDsys6bSdrrxM=; b=ISRiZEZ66YGoTqn07Ke3eUgF4 0oQOIuAyAQnRMcG3rrcypTh1+D7cXB7f1zv1mtzxST8wFhPrly2T0SiTI7zYJboDdQb/9G+Arm2/I EckJr0WF3bs3OalPk0UvwP0ZXNLLPNlEaNHUe3o1a5QYnq5CdgiO2sQFNFJwQm2q+glyEZ/UWGW3l TDPr1GNUEJvvQINCBWrUu1nC+fYbbdVj/mioF2yH/0aofIQ9Ft7U7yYffIL7pjm2bWJGKNZVSN7Mx Jv/aCmeze/IKL7cwE+eMcm6Oug3u4Dw3OICM6GQoAAkcM7M3zbBwhwHeh6m24Dfboyr00aYk3bOca rRjn67KuQ==; 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.92 #3 (Red Hat Linux)) id 1hkU7G-0004LA-8w; Mon, 08 Jul 2019 13:55:38 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 1CA4120B28AD7; Mon, 8 Jul 2019 15:55:36 +0200 (CEST) Date: Mon, 8 Jul 2019 15:55:36 +0200 From: Peter Zijlstra To: Luca Abeni 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 Subject: Re: [RFC PATCH 3/6] sched/dl: Try better placement even for deadline tasks that do not block Message-ID: <20190708135536.GK3402@hirez.programming.kicks-ass.net> References: <20190506044836.2914-1-luca.abeni@santannapisa.it> <20190506044836.2914-4-luca.abeni@santannapisa.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190506044836.2914-4-luca.abeni@santannapisa.it> 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 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. 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? --- 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