Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2122483pxa; Fri, 7 Aug 2020 03:49:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyM71FsEWce8SyA4GG41CIjEcos1KWtyynGMPEps0Twu9IYqCMeVGcBkOV+CaMQ6UVr/HMy X-Received: by 2002:a17:906:d78c:: with SMTP id pj12mr8530604ejb.179.1596797346536; Fri, 07 Aug 2020 03:49:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596797346; cv=none; d=google.com; s=arc-20160816; b=HqgHYmBMJdhrkCZaP9EcFKMGHfnrc0lGLO9XToZfYgptEagZVY1JgLgGpvGSyaVgFC SXxBBGu6gh7O6diwnk5Y6ncxZ5VPGK/mJ0CcdIjXRshIqicnGXdXaVs9YN4/eYRpgr6y xhanpejehgMVevvdDFi2orLZqo0z1UgumiXHBZUNCeH3Sq0xHfGJdT2gyiimwL3dUjz2 sfj7KOv2HRlagLZwGYGJUtCk3kle1c64PHf9PSpKMF8FZ8i1JGgMQDjlG5p5CyM0iQ0R BYaVP5n3a51Z7F7lAAQcMTLsHTAwQaOLEr5NlAYy3VDE/kwXr1UCmtLATD+vKmT9NyIo CzBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=aDAlqG4CAxqLl7h0ghsndP8u7Js90/fuXrq6EN1A+rg=; b=TTsbHlUAtGpCOZmxz7z4XORTsYhLgBIcjkeHClUVhxm8Wo3xsfelytQFFEp2OVxG+t +AOhyTqPBbeQLuhjUsi8CwW5Q/J50+QWsx20XYPEBZjfA6SYpVtm32zcmo1IOnmNUICv BFmyttyJk3S44fXLturRMfa5pOVTsyc3ib595qnAK7JIgdoXY+EFTzdg/tTnQhENHndr BpREI3mYIiq/zsXht4QevJkcek5bJvG79LPHSIp3gxqMm5voSpJ2KUsCZMNdBQ8O5h8W qC/+31qFd7Oo1SZVvdx22TspgwgvqiguTVaCDPoNrjLcn58c9dg59kTDk5iMlhcqQHXC VkIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=FFasNe26; 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 cn3si5045609edb.563.2020.08.07.03.48.40; Fri, 07 Aug 2020 03:49:06 -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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=FFasNe26; 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 S1726987AbgHGKrP (ORCPT + 99 others); Fri, 7 Aug 2020 06:47:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726619AbgHGKqh (ORCPT ); Fri, 7 Aug 2020 06:46:37 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87AEFC061574; Fri, 7 Aug 2020 03:46:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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; bh=aDAlqG4CAxqLl7h0ghsndP8u7Js90/fuXrq6EN1A+rg=; b=FFasNe26eiqE66rrR8vnluFd27 myOFROvlOycua+sg+fGFi3UdLHO7qgWvKI2dowqebZ2BjkPzWUu/kPe6rrpB9MMDi7VBg344QDnb4 /t4SKQOFOpJtO9XcGWEU2f0dBcHiAfeXW/MyfxiKJ9sFsvOPCQnoo5Krvwzztzugq+snSgH7PJjSI ZFWvyHGv7O9Tm1AsiguHbdXpwrZQ02mZ4yp/9xacDr4j15QiJVB+Fy/K0Zdz+f/DxtqPZj7EyBFxf RzTabsagq6A9WW4I+2OxlONoZ2kB49FHqPGGDLZ+5pI3Vz/kUgj8ZdSYLvYNrHAvdDu+yWwZcBQ4g 4e6LhTvw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1k3ztG-0005iP-Cy; Fri, 07 Aug 2020 10:46:22 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A94233012DC; Fri, 7 Aug 2020 12:46:18 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 8CF612C8B1E2E; Fri, 7 Aug 2020 12:46:18 +0200 (CEST) Date: Fri, 7 Aug 2020 12:46:18 +0200 From: peterz@infradead.org To: Juri Lelli Cc: mingo@redhat.com, rostedt@goodmis.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, luca.abeni@santannapisa.it, 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: <20200807104618.GH2674@hirez.programming.kicks-ass.net> References: <20200807095051.385985-1-juri.lelli@redhat.com> <20200807095604.GO42956@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200807095604.GO42956@localhost.localdomain> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- and start the server when rq->nr_running != rq->cfs.h_nr_running, IOW when there's !fair tasks around. Not saying we should do it like that, but that's perhaps more deterministic than this.