Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1568758lqe; Mon, 8 Apr 2024 12:51:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+S8lJP5KUy/FEu3GVhCtEN9CJuutOtU0ImVlAiK683IGwajguW4MNaPtVft4cesEamS2tC7ErUGtFUjyIVAw0bZpgtKgMSFnoRbMRGA== X-Google-Smtp-Source: AGHT+IHnGm3NeoTJ0wzzDtJfPzwgLvdeIGG1R8GVvfrN/eLQhza9tvbkFbEAbSUxFP+cRB9fPT4X X-Received: by 2002:a05:620a:44c6:b0:78a:74af:8867 with SMTP id y6-20020a05620a44c600b0078a74af8867mr11697101qkp.19.1712605905688; Mon, 08 Apr 2024 12:51:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712605905; cv=pass; d=google.com; s=arc-20160816; b=uDnUQiGl2ml+DHEoAO4rmO4AymBro4IOI/whiyz2QCfqPbxyfmn7w5S9rvEJz1Yqo7 cHCcTl5+iQJqP+sq1q00rQmcKgOy/5bFYzF4EifVkO0nrphUxobEIptZH2SC9kd/qrsx BD9ErNLcYEexiA0Yzf0vBMfFmQlHyPYYkjI6iM3pNkTg6W3AqgvN89+ozVlhprHmFIFW y/HgkwBGqSNgfn8UNf+N5E4TUVG7fAShyTMeiVblpfo/Oz3BC06huEd2ly5XpSkvr455 OExIAvtQFEmGDEAAzm+yKPr8GSo8hKIDEmVtqbmEX7xpbsxdY4Hxohz0o7xZRsZ+y4M4 d1KQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=C/1GfbVoOcsdIxsKvHhVJgku1EJaAbD6ddXpXExhDos=; fh=dK5jbcV4hLuoyBqKyn4pqG0lNP0p261Y4dcwStyxcoY=; b=v3Tgvd02V2jkT2Lj3sJlJWXBk6bImCvKYhPmJsvF+pJEycCZPs7UShU4DpNtA+BDeQ 7ZUQUSdaqhHixB4UgLXN+Xzb3IFHmfXxt0emXpWEEhn4lm4sfD2dLqSw5bV3bjr2WtE2 h8Q3NE6D/adx4SotGK+pKketMqqOHdAhYEsNu7iV8hZRR3oqT7zp7YrlReDF927DPz+F 7efWz7WKqfhU3Txxaz9Id3MoWXBA4OGYdVJM+3e9pUhV39c5PzC526zzooipJpbb9NIW XCpMVqo8P2wrvrBMETZHPqcdoJMzZWCfs7kLELhILeUVr63Red8oeignoOaeELyOWlTV 6MPg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rJQp+Gy+; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-135889-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135889-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h2-20020a05620a244200b0078d32d64f9csi9956801qkn.623.2024.04.08.12.51.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 12:51:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135889-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rJQp+Gy+; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-135889-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135889-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 3807C1C21CB3 for ; Mon, 8 Apr 2024 19:51:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5FD8D14600D; Mon, 8 Apr 2024 19:51:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rJQp+Gy+" Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1BBA1DDD6 for ; Mon, 8 Apr 2024 19:51:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712605897; cv=none; b=oh5cJ8HndaOqiumJiCUX4i6gl7veGC1XwFSLm2wygR8beQWbgGeRatMTRq0ANzicZ9VRWNdu9J0iB1ay0Dk+sfaOXBl90NpHc8Z3dD9EsdKu7Yr+iH4BkLt1acN4WnANchY0rVONT7CuyTwA867jI94HTdltnuMRaefjxMvNAPQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712605897; c=relaxed/simple; bh=C/1GfbVoOcsdIxsKvHhVJgku1EJaAbD6ddXpXExhDos=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=T2mDLZIYpCB4LlsRFQjWIZSFHgvxFc+1TF7fULCkVqfajyvS+Rdr+lVehwplABNNlZ6bxGPgE34R2f3KZbfyPns+zmza56omlhsXO1SDgrUFQ0NDGQRmU5scAo4sGJMeb11vBzA/DOjA7Fm8rjox6d3JM6kyribSjOTnQ/UvMi0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=rJQp+Gy+; arc=none smtp.client-ip=209.85.208.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-56e5174ffc2so124a12.1 for ; Mon, 08 Apr 2024 12:51:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712605894; x=1713210694; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=C/1GfbVoOcsdIxsKvHhVJgku1EJaAbD6ddXpXExhDos=; b=rJQp+Gy+9mGhwSDMtLNYQj10bVwDlh7u74FMGVoz8OT2He4GO2deAk7x2VM7cHCyDu J/SHp625SJFIa+sz07e7eI5Uaeh8XupZJo1+Y31PDYxP0AU8Ei5/1rwSDah5L5dW1w6I Dtz54TfSx+5twMCR8MoG/7hyA3f5TLgITiKII2D84TkAT77+ZanRkRVB3Pp6YQwb/o9H mbuuCXS2QSlyTXS4XV3wO0Ozr/FJtdiBB6IAMKqo7dR1VCzwJ1PzvzF2Ot/MCIk7XVGb gvrLUW40d6Kr6wjUwY8Mh/CVQIJ/C7DxkaqEoOHDqJwd44cSarizoodX5oV8uBdxIFjF yJqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712605894; x=1713210694; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C/1GfbVoOcsdIxsKvHhVJgku1EJaAbD6ddXpXExhDos=; b=U9KUfKO0OAFY2OTKIcwosOYu/gE/PrxlEx9t3VfMMg14AA7pGMNg+P/P+IoM0oOP9G RBSEQXhZis1l0VAWFQwYFqpJ7tqY01ggkbWuBSr4qkvTImlCUnDPIATGmw8rKeI0qhRu oR8994/2WL1KkcZGqNNGNTpgVHvPfpmr+GGTUoJ0nHOFXgV4yq7ZZ0uAohGiffyOl7Iq +b3H/SPwPneQJXxiQxoGNPHqATKBwOXTjHh42KemcZaYiwDmyGgzhoqd7EUWIByts/Rc yw9dfIjYdodqxjicMHnB3CprdEYHXBnmVwbb7hzjKxQdYrQCja5Ne+VlkJfr/LPvcY7Y o25Q== X-Forwarded-Encrypted: i=1; AJvYcCVevwMWgoO4YadvNSl+eAzPNRsWp42g4bvmeRueZRx8XNOjLht5sjXQHS7s/oeCmhk/WjqTENWn0MG4EHuDek4NbcXzvw9hKiBuLV+c X-Gm-Message-State: AOJu0Yz2/EeLO8MIyEiN8zO9ug5WfIix69JM626dnFbiM/NH3ShXmLex 9vq8UrpTule4ZdefarH/LVbrtMdcxSV9Kim9CElkmttN2an4I7MrgdlkSWT7+A4DhLTy40CabPM yXdico4kI2vqVzZPz1AochSe8PQBmzEUYwgo= X-Received: by 2002:aa7:de18:0:b0:56e:2ba2:c32b with SMTP id h24-20020aa7de18000000b0056e2ba2c32bmr29945edv.6.1712605893966; Mon, 08 Apr 2024 12:51:33 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240403005930.1587032-1-qyousef@layalina.io> <20240404220500.dmfl2krll37znbi5@airbuntu> <20240405171653.boxbylrdak5fopjv@airbuntu> <20240407122700.ns7gknqwqkpjjyd4@airbuntu> In-Reply-To: From: John Stultz Date: Mon, 8 Apr 2024 12:51:22 -0700 Message-ID: Subject: Re: [PATCH] sched/pi: Reweight fair_policy() tasks when inheriting prio To: Vincent Guittot Cc: Qais Yousef , Ingo Molnar , Peter Zijlstra , Juri Lelli , Steven Rostedt , Daniel Bristot de Oliveira , Thomas Gleixner , "Paul E. McKenney" , Joel Fernandes , Dietmar Eggemann , linux-kernel@vger.kernel.org, Yabin Cui Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Apr 8, 2024 at 12:17=E2=80=AFAM Vincent Guittot wrote: > > On Sun, 7 Apr 2024 at 14:27, Qais Yousef wrote: > > > > On 04/05/24 18:16, Qais Yousef wrote: > > > > > > > > > > All that to say that I think the weight is not applied on purpose. > > > > This might work for your particular case but there are more changes= to > > > > be done if you want to apply prio inheritance between cfs tasks. > > > > > > > > As an example, what about the impact of cgroup on the actual weight > > > > and the inherited priority of a task ? If the owner and the waiter > > > > don't belong to the same cgroup their own prio is meaningless... ta= sk > > > > nice -20 in a group with a weight equal to nice 19 vs a task nice 1= 9 > > > > in a group with a weight equals to nice -20 > > > > > > That is on my mind actually. But I thought it's a separate problem. T= hat has to > > > do with how we calculate the effective priority of the pi_task. And p= robably > > > the sorting order to if we agree we need to revert the above. If that= is done > > > > Thinking more about it the revert is not the right thing to do. We want= fair > > tasks to stay ordered in FIFO for better fairness and avoid potential > > starvation issues. It's just the logic for searching the top_waiter nee= d to be > > different. If the top_waiter is fair, then we need to traverse the tree= to find > > the highest nice value. We probably can keep track of this while adding= items > > to the tree to avoid the search. > > > > For cgroup; is it reasonable (loosely speaking) to keep track of pi_cfs= _rq and > > detach_attach_task_cfs_rq() before the reweight? This seems the most > > straightforward solution and will contain the complexity to keeping tra= ck of > > cfs_rq. But it'll have similar issue to proxy execution where a task th= at > > doesn't belong to the cgroup will consume its share.. > > That's a good point, Would proxy execution be the simplest way to fix all= this ? So, at the moment, in part. It ought to resolve the issue for in-kernel mutexes (blocked tasks stay on rq, if blocked tasks are selected to run we will instead run the runnable lock owner - thus it works across scheduling classes), but it isn't tied into userland futexes the way rt_mutexes are at this point. Review and feedback on the series would be greatly appreciated! (Nudge! Nudge! :) -john