Received: by 2002:ab2:3b09:0:b0:1ed:14ea:9113 with SMTP id b9csp241375lqc; Thu, 29 Feb 2024 16:28:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUEmDLfsPFb0S7QMVnue5Cx50BABvaPeYB74A+SGwHQcgKeNuJGdtKQov/1nnCnlkhst24RRch8YD7kluKWeCOgfAZX7jl3IQqjMJHTWw== X-Google-Smtp-Source: AGHT+IEHvBEypX38JJ8+GkibeQ7oprMBrioYvyKTz/4OEJgLKJVqWGvjajlFWNJIKhutBZRpap7N X-Received: by 2002:a17:906:fb09:b0:a3d:bb68:be30 with SMTP id lz9-20020a170906fb0900b00a3dbb68be30mr150663ejb.6.1709252909078; Thu, 29 Feb 2024 16:28:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709252909; cv=pass; d=google.com; s=arc-20160816; b=BQNShdG/jd1vH34b48DJ1CByxdyM/V89K4jTjRt48ExrC2TgYnSuijhJ+Y720R96sw pjclArGLzlGW5/oUP5iYAbJ4KgcYMMbGh+EQNRPM/RhDJuTyy6V3xp6fpRU4/FNcAJso DIm+i47HGq+FNMiDdDATevCY9QsIVkKABMTHg/zU7l8qG7oYL1+97+PPMCecwJqFRn9t Il8pqXsS1AE8P6FMYr0wvFX18Osm9KSR3HrUx//X3/8vvMlPXEFYVbT1bwR6SsUZmGXn xbhpi7Xk0Z6iDYmCdL9aHKX+bwNks0AjUy2MrmO3zbCWlc4x6FDGSfWSyokaRDtQvM0L 5CQA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=iYuHaDZqiN2tBL8VBogriKwtL1OATEgmwGccy2GDKZU=; fh=k5lLkVEDuS6Yfi8OgAp6piyULRJO0xyCrTsHi0wbz5I=; b=0N2mUKOe/kcHqlQOTm7SOEIc1OslJo5H39DSwuMHmwmV+kD6FOskRkRT8dm537IZZn sY5X12Qnn/pTdfP3zsPZypjrx+U00Bmemg2fA7UzFO7oZACx9wSH0hRSM9dIF0/S9Tgd Qu+DkxSL0pN++xedVqoLn5h7NPQp6DzvDOITvmcDBl8rMeRjpwvavQ74I20zSZx7Kxs/ FTdFwwzqRxCaxUwYOMoL00yZiXdLEqjIdN8gfnCeAkd6+FAiooL/wjvqPbVtJjBrGb8o DcCdt5whiX4COhb96TqxZDzI3rRyJrsuWrV/dMhbn7exCARcFWN6hhvibfH1VqMinOT4 4HgA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vO9ua2+5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-87734-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87734-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id c6-20020a170906694600b00a441dd88f3fsi960524ejs.320.2024.02.29.16.28.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 16:28:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87734-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vO9ua2+5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-87734-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87734-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AB51C1F23188 for ; Fri, 1 Mar 2024 00:28:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3808D64B; Fri, 1 Mar 2024 00:28:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="vO9ua2+5" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 574FB368 for ; Fri, 1 Mar 2024 00:28:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709252901; cv=none; b=kw4u+aSy+EJQqp0i+enp6/2sIuiXoAxPkOdm8A4IPMkQqHdMgwID87ultcm8SaSjiZyPLYxlsL5zhxcXnJ4VlWXdcTW/Gc8L4CsKUVRl9QrXeUpH5dgdz9A+tI2Ujs7ICTrPs5Dut2LI3CH14ET8xqiG3m8oFi0bzrVdxV7+jys= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709252901; c=relaxed/simple; bh=dVqPsWNUmiWnQmiOcSt5UZwFL2hedrAKbpRRWjmdhbU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jBvLT4XLeEBNAjXc63Dz8N0Z26E1lOotWFz+Vb8xB2Hscj3lk4pR5VNQqIykGBfFGMCfU4SiZHCguSsiZQdSQzB6Xe7PYVeiTshxMEAQKLrGsznnT1eAOjzy0e1utu+EaPTYtdxDM+a75Jlpu5ZefiRilzp1g7yTxoDWlgBBwOc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=vO9ua2+5; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0264C433F1; Fri, 1 Mar 2024 00:28:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709252900; bh=dVqPsWNUmiWnQmiOcSt5UZwFL2hedrAKbpRRWjmdhbU=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=vO9ua2+5EtkcfmQJPeAAwbItqAA6JCWIBPQuDFlhUdmHG2VlG05cq1iJC1vTxYI9i wnQD5iG7VNzZR1XR50IMZej/HgUSBZVTU4VZajWCqJ9GT1WmUSswEABIIKkpEKVIbv Hul/8/imWcyt03uRyGYlDab/M6U4pOD4iZnjqQV0XdctkLvycm75iogmEHN8myHwJr BHOwBxpISwo7xGgWW11BimoiKlnn2DuENzdVvsHbAFaVvSOTCJI3QjU+njNG99Tfs5 IErBkMZUhbLeSeKOBUZdKg8ICBT6kpAiVpE82h2Wvnor6pZA2LbY3RahBQgr+crrz0 16SO8szLf/VmA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 53257CE0B6C; Thu, 29 Feb 2024 16:28:20 -0800 (PST) Date: Thu, 29 Feb 2024 16:28:20 -0800 From: "Paul E. McKenney" To: Ankur Arora Cc: Juri Lelli , linux-kernel@vger.kernel.org, tglx@linutronix.de, peterz@infradead.org, torvalds@linux-foundation.org, akpm@linux-foundation.org, luto@kernel.org, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, mingo@redhat.com, vincent.guittot@linaro.org, willy@infradead.org, mgorman@suse.de, jpoimboe@kernel.org, mark.rutland@arm.com, jgross@suse.com, andrew.cooper3@citrix.com, bristot@kernel.org, mathieu.desnoyers@efficios.com, geert@linux-m68k.org, glaubitz@physik.fu-berlin.de, anton.ivanov@cambridgegreys.com, mattst88@gmail.com, krypton@ulrich-teichert.org, rostedt@goodmis.org, David.Laight@aculab.com, richard@nod.at, mjguzik@gmail.com, jon.grimm@amd.com, bharata@amd.com, raghavendra.kt@amd.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: Re: [PATCH 23/30] sched/fair: handle tick expiry under lazy preemption Message-ID: Reply-To: paulmck@kernel.org References: <20240213055554.1802415-1-ankur.a.arora@oracle.com> <20240213055554.1802415-24-ankur.a.arora@oracle.com> <871q8v7otl.fsf@oracle.com> <87a5ni6d31.fsf@oracle.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87a5ni6d31.fsf@oracle.com> On Thu, Feb 29, 2024 at 03:54:42PM -0800, Ankur Arora wrote: > > Juri Lelli writes: > > > On 28/02/24 22:43, Ankur Arora wrote: > >> Juri Lelli writes: > > > > .. > > > >> > For deadline we call resched_curr_tick() from the throttle part of > >> > update_curr_dl_se() if the dl_se happens to not be the leftmost anymore, > >> > so in this case I believe we really want to reschedule straight away and > >> > not wait for the second time around (otherwise we might be breaking the > >> > new leftmost tasks guarantees)? > >> > >> Yes, agreed, this looks like it breaks the deadline invariant for both > >> preempt=none and preempt=voluntary. > >> > >> For RT, update_curr_rt() seems to have a similar problem if the task > >> doesn't have RUNTIME_INF. > >> > >> Relatedly, do you think there's a similar problem when switching to > >> a task with a higher scheduling class? > >> (Related to code is in patch 25, 26.) > >> > >> For preempt=voluntary, wakeup_preempt() will do the right thing, but > > > > Right. > > > >> for preempt=none, we only reschedule lazily so the target might > >> continue to run until the end of the tick. > > > > Hummm, not sure honestly, but I seem to understand that with > > preempt=none we want to be super conservative wrt preemptions, so maybe > > current behavior (1 tick of laziness) is OK? Otherwise what would be the > > Yeah, that's kind of where I'm thinking of getting to. Be lazy so long > as we don't violate guarantees. > > > difference wrt preempt=voluntary from a scheduler pow? Yes, it might > > break deadline guarantees, but if you wanted to use preempt=none maybe > > there is a strong reason for it, I'm thinking. > > Yeah, the difference between preempt=none and preempt=voluntary is > looking narrower and narrower, and maybe a bit artificial in that > there seem to be very few cases where the two models would actually > differ in behaviour. If it turns out that cond_resched() and the preemption points in might_sleep() really can be dispensed with, then there would be little difference between them. But that is still "if". ;-) Thanx, Paul > Thanks > Ankur > > >> Thanks for the review, btw. > > > > Sure. Thanks for working on this actually! :) > > > > Best, > > Juri