Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2246223pxa; Fri, 7 Aug 2020 06:52:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhx1fCdRjlx1WG6LlGdb36XNCCPOzPBXnJyk91lP/so7V00rR+ahQCpBhfL2Nm1hAxto1v X-Received: by 2002:a17:907:402b:: with SMTP id nr19mr9335541ejb.123.1596808359487; Fri, 07 Aug 2020 06:52:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596808359; cv=none; d=google.com; s=arc-20160816; b=lH4EGfBNArtchFxfgTSax5MnPSW7WAWaJnBzm+bAYYNXWTmZEBynAcoGDXaBva6Bmj w4SsIywTRaPC792TBNDyJrfVD/uoGs+HdwzHZ1qnFApGT1yG32tLGRmyF6xbiwXqL20S oPD57RCCa/JQyc80/mY95XNpZ8OfJfmCaShZPYMD0pBAcIu0P1PXpghDgpo1b2VZ7i4k 5b1qo/jlINnaFSg3wi7QjHAwxtHQ+11XIAB7spinsppKxRGJsZ/zD7t1mpqvERHP4Qn1 Dm2cI9v4lRnbtVHYA9Nes+c6fVOb3KjLASgHoF93bKUs5KSgCe3sAdlpvx9p3G8Ezej7 AdJg== 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=ujdln86CZczrCSUBGWnYMwmRkd0L8UWDYcWUyCpN5Fg=; b=0O6XjQOq/2uHSuOYyFyH4Cr2Gnrtd+pKfVhFfCPu4SbmyRfED5+8tVoiWX03QvqmMI h6s2PvBv+b3abXYxjoegyYrxG5hNOkNjz2rIydhersnLu4+UF35P6FAPkTqorgp9beFw idJZPtuGZ727iFsUu56q3clHr9vU+HoIFpi4SyZ3QywMFWFwq9tNAK7QDEYtsjP8OyPG ry6iT7H6ckBUzpUQ6VVveCL7Lc5JqoWDrujnAmgN5+/BmUS3SY2eokRaIsVrldVYIxem PNEYH2GBoVnBLD82VdyX3cRQVcHVfv/p+d1JiciBHrpCZLflDvNhhmEjceW2ywumzCRi 7RrA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k19si5071663edx.265.2020.08.07.06.52.15; Fri, 07 Aug 2020 06:52:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726159AbgHGNue (ORCPT + 99 others); Fri, 7 Aug 2020 09:50:34 -0400 Received: from ms01.santannapisa.it ([193.205.80.98]:61185 "EHLO mail.santannapisa.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726262AbgHGNt4 (ORCPT ); Fri, 7 Aug 2020 09:49:56 -0400 Received: from [94.37.192.58] (account l.abeni@santannapisa.it HELO nowhere) by santannapisa.it (CommuniGate Pro SMTP 6.1.11) with ESMTPSA id 150297187; Fri, 07 Aug 2020 15:49:52 +0200 Date: Fri, 7 Aug 2020 15:49:41 +0200 From: luca abeni To: peterz@infradead.org Cc: Juri Lelli , mingo@redhat.com, rostedt@goodmis.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, tommaso.cucinotta@santannapisa.it, alessio.balsini@gmail.com, bristot@redhat.com, dietmar.eggemann@arm.com, linux-rt-users@vger.kernel.org, mtosatti@redhat.com, williams@redhat.com, valentin.schneider@arm.com Subject: Re: [RFC PATCH v2 6/6] sched/fair: Implement starvation monitor Message-ID: <20200807154941.2bb11408@nowhere> In-Reply-To: <20200807104618.GH2674@hirez.programming.kicks-ass.net> References: <20200807095051.385985-1-juri.lelli@redhat.com> <20200807095604.GO42956@localhost.localdomain> <20200807104618.GH2674@hirez.programming.kicks-ass.net> Organization: Scuola Superiore S.Anna X-Mailer: Claws Mail 3.17.5 (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 Fri, 7 Aug 2020 12:46:18 +0200 peterz@infradead.org wrote: > On Fri, Aug 07, 2020 at 11:56:04AM +0200, Juri Lelli wrote: > > Starting deadline server for lower priority classes right away when > > first task is enqueued might break guarantees, as tasks belonging to > > intermediate priority classes could be uselessly preempted. E.g., a > > well behaving (non hog) FIFO task can be preempted by NORMAL tasks > > even if there are still CPU cycles available for NORMAL tasks to > > run, as they'll be running inside the fair deadline server for some > > period of time. > > > > To prevent this issue, implement a starvation monitor mechanism that > > starts the deadline server only if a (fair in this case) task hasn't > > been scheduled for some interval of time after it has been enqueued. > > Use pick/put functions to manage starvation monitor status. > > One thing I considerd was scheduling this as a least-laxity entity -- > such that it runs late, not early Are you thinking about scheduling both RT and non-RT tasks through deadline servers? If yes, then I think that using something like laxity-based scheduling for the SCHED_OTHER server can be a good idea (but then we need to understand how to combine deadline-based scheduling with laxity-based scheduling, etc...) Or are you thinking about keeping the SCHED_OTHER server throttled until its laxity is 0 (or until its laxity is lower than some small value)? In this second case, the approach would work even if RT tasks are not scheduled through a server (but I do not know which kind of performance guarantee we could provide). > -- and start the server when > rq->nr_running != rq->cfs.h_nr_running, IOW when there's !fair tasks > around. Yes, this could be a good optimization. Luca > > Not saying we should do it like that, but that's perhaps more > deterministic than this.