Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp847605lqc; Fri, 8 Mar 2024 13:33:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU1DIVlUA6qHKh7IeVLKRNtZFYHYN9AP+m1pnK1t6ds+OpWPF8Rnv0MejFRF4kiMf1WpLARvPMKEeqyAWOdpBkjLSEcNvSDQNfLg9UKCQ== X-Google-Smtp-Source: AGHT+IFi85LTfICicMiKyzyT4dhubYkF8R8WaPtxpHJevr5nNstNrw/bYN3apxuHEf9uCvPa8rx0 X-Received: by 2002:a17:907:20a1:b0:a3d:4ed8:f5bf with SMTP id pw1-20020a17090720a100b00a3d4ed8f5bfmr174315ejb.2.1709933630368; Fri, 08 Mar 2024 13:33:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709933630; cv=pass; d=google.com; s=arc-20160816; b=mmduro5NJtd81GOspMXN8zV/BMhfpYlPRaRaHva8f3dWCo/Jv1g6BbNODgDmPK/BhL 9qjmjjn+1tCsfN0h1iY+CFeAe+oFv9T6DB4JAyhs0o40HhtrzUBHX6O7m06am/JhAVEj PTH1HA8iwN2ZjoXMfdpUfZm6XliQVspbV7xHIxzteq6rlsWjvX7XXaLI1fWvSwiXQHbx wf2ysq6W3PeutOWRtsdbgPYf1l2R1+mN9ja0zbReoxjIz/L9bYn0p8vqSzpGdOvEbcQc SSrJPMfmU3NMgPRLttSDNUPI00Kke1rW9gmnav5ntzsgZpRwZIBaPFK24YQif6yEitYP yIEg== 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=H5igBLlHL+omDI78gtXv60d3CphNHqTDlD+bNXhAayE=; fh=XfRwInt81ujW0hihchniGj5rZJiBgIMl4XATyXdXMv8=; b=gg9ElX/jq3aTJstF73/EdtK3jcOsgjnTol2cnH2qjaPDIsIn7ufSGAPk74Rbs7Ozdl riGMDVwWEkIorwMptTvDzyVY6dla3PQaz4HJ5i0Re0WLPUk7hSszVJA8sYCiZPJtWBrl wUxzvuhBR2MVlZo3d5vDwN1KcqqTsy7hRQ5TLdeAEqcse6npaVJcQxp/wsrcCghtruMc 4YLjHPb/H2wN7Rm5c/o48cKvAiR8CuDTS8s7gzrvtkgfA6UT6nYAwXTkN2zfnhYooDJ2 bKpCmttuaSkTtY4rKcn1hrWMDWJugE0YH9eQzWIpDOPn31UrbvwfdtS0SGPiPeTcffzf dJ9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BGBRpk9g; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-97608-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97608-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 hq31-20020a1709073f1f00b00a441fd16143si169237ejc.65.2024.03.08.13.33.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 13:33:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97608-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=BGBRpk9g; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-97608-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97608-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 E65EF1F21AB0 for ; Fri, 8 Mar 2024 21:33:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D2AC55FB8D; Fri, 8 Mar 2024 21:33:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BGBRpk9g" 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 F052E5D746 for ; Fri, 8 Mar 2024 21:33:42 +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=1709933623; cv=none; b=luWZ+JMWTwcHOJwZOIwm/NTFj9o5HmyXrfyWeREvWxbr+RjL1DgXTCSENTb5OOWcG8SDq2YJoLk/vqrzXgNOgyPfacknaSiOjnF/n87A01S2VGx8PjD4Bevn+anjnYY55Ag7Rve3ycLiOJiWGLIdeEo4uhrgi/NDjzj8GjiMMBM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709933623; c=relaxed/simple; bh=TrUDOIKI0EoErh/PVlIhLyDoy9WwS7OqVA/bQxYZfk8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hnSJxBtpBL6zb6bVQBE9op+S9QUnF6Aq0Dbg9oH0JJMsiJHzelLl/59gs8V7Ae4CCsn5F+NjXL+HIOWMPUnufR6iuA/b/L8QkQLPnJTk16o+2ouXuPv690y0sLpK2YLIILEf98qd5Cqm8icANhKLwiM+Qc/GniPPJDYoUOrsK64= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BGBRpk9g; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83363C433C7; Fri, 8 Mar 2024 21:33:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709933622; bh=TrUDOIKI0EoErh/PVlIhLyDoy9WwS7OqVA/bQxYZfk8=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=BGBRpk9g4l+0/PqTqwX6oqhl3R2D/Ma3pXT/yloNlV8OyMPw0u+CT6Dr+0msrK9bl Pct1f0AJVD2YXJzAy582dnRcs8b3XAVsD5eNpr5b0gkNGSwrJRJwxbaqkmncD8NJZj yXKElwoOm84I+YURpjH30sRcqj9FwGwqlZPY7BVmiSkcyu1Ol+mugX+heTjxUM1uQg rprwcwHM+nh68owX5JIURGKrVwDLauzhFq9iCyxoNOVUBapuO7AZQwsutH4uG1i27L EHkIG508QBGDx0pFJI8tvsU00dJ/bj1iTO/YCp9/HxVy0tVzRB0Qo4vr1w9Yem0TDj e4JymeF2DBm6Q== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 1CE89CE0548; Fri, 8 Mar 2024 13:33:42 -0800 (PST) Date: Fri, 8 Mar 2024 13:33:42 -0800 From: "Paul E. McKenney" To: Ankur Arora Cc: Joel Fernandes , 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, juri.lelli@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 26/30] sched: handle preempt=voluntary under PREEMPT_AUTO Message-ID: Reply-To: paulmck@kernel.org References: <20240213055554.1802415-1-ankur.a.arora@oracle.com> <20240213055554.1802415-27-ankur.a.arora@oracle.com> <65e3cd87.050a0220.bc052.7a29@mx.google.com> <87frx514jz.fsf@oracle.com> <12a20651-5429-43df-88d7-9d01ff6212c6@joelfernandes.org> <63380f0a-329c-43df-8e6c-4818de5eb371@paulmck-laptop> <6054a8e0-eb95-45a3-9901-fe2a31b6fe4e@paulmck-laptop> <87plw5pd2x.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: <87plw5pd2x.fsf@oracle.com> On Thu, Mar 07, 2024 at 08:22:30PM -0800, Ankur Arora wrote: > > Paul E. McKenney writes: > > > On Thu, Mar 07, 2024 at 07:15:35PM -0500, Joel Fernandes wrote: > >> > >> > >> On 3/7/2024 2:01 PM, Paul E. McKenney wrote: > >> > On Wed, Mar 06, 2024 at 03:42:10PM -0500, Joel Fernandes wrote: > >> >> Hi Ankur, > >> >> > >> >> On 3/5/2024 3:11 AM, Ankur Arora wrote: > >> >>> > >> >>> Joel Fernandes writes: > >> >>> > >> >> [..] > >> >>>> IMO, just kill 'voluntary' if PREEMPT_AUTO is enabled. There is no > >> >>>> 'voluntary' business because > >> >>>> 1. The behavior vs =none is to allow higher scheduling class to preempt, it > >> >>>> is not about the old voluntary. > >> >>> > >> >>> What do you think about folding the higher scheduling class preemption logic > >> >>> into preempt=none? As Juri pointed out, prioritization of at least the leftmost > >> >>> deadline task needs to be done for correctness. > >> >>> > >> >>> (That'll get rid of the current preempt=voluntary model, at least until > >> >>> there's a separate use for it.) > >> >> > >> >> Yes I am all in support for that. Its less confusing for the user as well, and > >> >> scheduling higher priority class at the next tick for preempt=none sounds good > >> >> to me. That is still an improvement for folks using SCHED_DEADLINE for whatever > >> >> reason, with a vanilla CONFIG_PREEMPT_NONE=y kernel. :-P. If we want a new mode > >> >> that is more aggressive, it could be added in the future. > >> > > >> > This would be something that happens only after removing cond_resched() > >> > might_sleep() functionality from might_sleep(), correct? > >> > >> Firstly, Maybe I misunderstood Ankur completely. Re-reading his comments above, > >> he seems to be suggesting preempting instantly for higher scheduling CLASSES > >> even for preempt=none mode, without having to wait till the next > >> scheduling-clock interrupt. Not sure if that makes sense to me, I was asking not > >> to treat "higher class" any differently than "higher priority" for preempt=none. > >> > >> And if SCHED_DEADLINE has a problem with that, then it already happens so with > >> CONFIG_PREEMPT_NONE=y kernels, so no need special treatment for higher class any > >> more than the treatment given to higher priority within same class. Ankur/Juri? > >> > >> Re: cond_resched(), I did not follow you Paul, why does removing the proposed > >> preempt=voluntary mode (i.e. dropping this patch) have to happen only after > >> cond_resched()/might_sleep() modifications? > > > > Because right now, one large difference between CONFIG_PREEMPT_NONE > > an CONFIG_PREEMPT_VOLUNTARY is that for the latter might_sleep() is a > > preemption point, but not for the former. > > True. But, there is no difference between either of those with > PREEMPT_AUTO=y (at least right now). > > For (PREEMPT_AUTO=y, PREEMPT_VOLUNTARY=y, DEBUG_ATOMIC_SLEEP=y), > might_sleep() is: > > # define might_resched() do { } while (0) > # define might_sleep() \ > do { __might_sleep(__FILE__, __LINE__); might_resched(); } while (0) > > And, cond_resched() for (PREEMPT_AUTO=y, PREEMPT_VOLUNTARY=y, > DEBUG_ATOMIC_SLEEP=y): > > static inline int _cond_resched(void) > { > klp_sched_try_switch(); > return 0; > } > #define cond_resched() ({ \ > __might_resched(__FILE__, __LINE__, 0); \ > _cond_resched(); \ > }) > > And, no change for (PREEMPT_AUTO=y, PREEMPT_NONE=y, DEBUG_ATOMIC_SLEEP=y). As long as it is easy to restore the prior cond_resched() functionality for testing in the meantime, I should be OK. For example, it would be great to have the commit removing the old functionality from cond_resched() at the end of the series, Thanx, Paul