Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp8264728rwi; Tue, 25 Oct 2022 04:44:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6IV4ydVtjHBOlNKViztq+kGVg1DsdJnsU9S+JJ1grvAuN8hyKS/N0V0iIKk6/Pdu6nUWtO X-Received: by 2002:a17:90a:458d:b0:213:54f:ddd3 with SMTP id v13-20020a17090a458d00b00213054fddd3mr13561583pjg.232.1666698298139; Tue, 25 Oct 2022 04:44:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666698298; cv=none; d=google.com; s=arc-20160816; b=a9TvK6iY1zTj5s25dyhAlPXy4DjODv/NjxHGw862IhZv+3ew85S0FcAnQ47h5M8Gjb 48S0wXOHSJAyfq4YZ3SYviLDDSigw0IYfazYkeB0hrgwCjAoxSG5vzJj/51tBWBB22Ig OCf8k8Ps8U0h4vG+TPhBlVeHIM/b3h6YV+Xq22Yn845u/nRFSrG4R09YNApDy0TBYwt1 jR1E1uhWbsCiivaCU7ZJFJ4Gh1s/vvFtFHoF99lA8L7b5MO5odHj1n5qCpIfXp1C0hMp GuEiMOqsQs1UFcKL0yganT+fNL5lbEUcXKjVmYgNhoypGfDByuV5LbQQw8LrX0VUKi4h DmAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:cc:references:message-id:date :subject:mime-version:from:content-transfer-encoding:dkim-signature; bh=jOEv+spg1vFxsgLP+Brkgpa4VWCFOV4NiNl/t5XRFeU=; b=XaVodwEH4tLnqeI1SxLN0GjMBuYYWCD0krnDEj6y3gDF5CmHdBZZTvVuBNMzW4qs/d gfEwcTQme57d1s+RLmeX6ITfmr/asj1U6+f1fOmYzZQQoCKlSuDTj4fpFfKXU7kjuMSE AoPgJSNqdu8asZbeJZG+Mk/INheIgx9WUvW2E8qdWGc41GZ6LKkS938lxdU1eDKNqthC WDnHiCzEsUz2oTxXPE2T1Bg4MVl1yAAjmpeQXyDPiZG2SXwO/obozKhpng6vAPSrv8si DiJmNXNG8+A58xeaQ1jjRevtMPblO+I9g1JZxFA8ElMezOA3CJyCvWL9BB/4TNqe1yOT kB9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=xbKz4RXc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q8-20020a056a00150800b0056b94c5af48si3359138pfu.307.2022.10.25.04.44.46; Tue, 25 Oct 2022 04:44:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=xbKz4RXc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231828AbiJYLTm (ORCPT + 99 others); Tue, 25 Oct 2022 07:19:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231688AbiJYLTk (ORCPT ); Tue, 25 Oct 2022 07:19:40 -0400 Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81ABF1217F4 for ; Tue, 25 Oct 2022 04:19:38 -0700 (PDT) Received: by mail-qt1-x82d.google.com with SMTP id l28so7242004qtv.4 for ; Tue, 25 Oct 2022 04:19:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=jOEv+spg1vFxsgLP+Brkgpa4VWCFOV4NiNl/t5XRFeU=; b=xbKz4RXc7hITxZLV5zki1DRdTSN0MwWgeFqRqblQ/IC4NzR9WeGwjQ+dxwhkIWTMLM F0t//xKeOjFrx/CHRlLc0FHX42lVXad3vqdZiyqzL8fewRljG8p3Iz0YviTLqUha/1fg dVCcGUwJ/q1Zgi5A0/TG4gkhu1o/5CSLJq7Y4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jOEv+spg1vFxsgLP+Brkgpa4VWCFOV4NiNl/t5XRFeU=; b=i164hTx9Kz/BHdEqxTuja5nMy7cSiuGB7N0FeWFS9ZAifzDqrCuatHytY3aEnKMeCV oJ1mpxv+jRI+0XuDhH+72ny25Y7K+sPu+L1a0grVy1zuLik2l99cKo0PWIURzB9dyTxT RoTM8/w391tClkmh6N1Hm0XxNrVr7YjbnJRiqZMdCgTD9PCOERSy9NOYH4mfEnN0f85l e0oOy3r+JzZtuc6WJGMMyJgr7+O6nlAXJvlGV7BxKiRZfiOioVE/oVi46SBNZC9lrJKt EvGTVztgeGyQxn8vZj8CuyWPvjjqAWSDmZZUwLP5Ufge0P/fBeti0LHbvyIZ/7aRuZIb AD2w== X-Gm-Message-State: ACrzQf1zAR6DIWc5lN5nmxSH/Q7KwCZvty+WxKysddK2d+eBjac01Y4I 4MgsQ7HGbio5XBfkz4tQyuSqMQ== X-Received: by 2002:ac8:4e4d:0:b0:39c:e229:7172 with SMTP id e13-20020ac84e4d000000b0039ce2297172mr30548177qtw.129.1666696777194; Tue, 25 Oct 2022 04:19:37 -0700 (PDT) Received: from smtpclient.apple (c-73-148-104-166.hsd1.va.comcast.net. [73.148.104.166]) by smtp.gmail.com with ESMTPSA id m17-20020ae9e711000000b006ed61f18651sm1855390qka.16.2022.10.25.04.19.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 Oct 2022 04:19:36 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Joel Fernandes Mime-Version: 1.0 (1.0) Subject: Re: [RFC PATCH 07/11] sched: Add proxy execution Date: Tue, 25 Oct 2022 07:19:35 -0400 Message-Id: <7BBED338-D158-401B-8A6B-FDBD9FC03973@joelfernandes.org> References: <20221024223324.2jgwrmnqxpgw2m67@airbuntu> Cc: Peter Zijlstra , Steven Rostedt , Connor O'Brien , linux-kernel@vger.kernel.org, kernel-team@android.com, John Stultz , Qais Yousef , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Will Deacon , Waiman Long , Boqun Feng , "Paul E . McKenney" , youssefesmat@google.com In-Reply-To: <20221024223324.2jgwrmnqxpgw2m67@airbuntu> To: Qais Yousef X-Mailer: iPhone Mail (19G82) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MIME_QP_LONG_LINE, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Oct 24, 2022, at 6:33 PM, Qais Yousef wrote: >=20 > =EF=BB=BFOn 10/17/22 09:26, Peter Zijlstra wrote: >=20 >> Additionally, the highest priotiy waiter will get the lock next. >=20 > True for RT. But for CFS, priority is share and there will be no guarantee= the > 'highest priority' task will run as soon as the lock is released to grab i= t, > no? But the mutex lock owner should have done a wake_up in the mutex unlock path= , which is arranged in FIFO order, if I am not mistaken. Subsequently the sc= heduler will at least get a chance to see if the thing that is waiting for t= he lock is of higher priority, at the next preemption point. If it did not get to run, I don=E2=80=99t think that=E2=80=99s an issue =E2=80= =94 it was not highest priority as far as the scheduler is concerned. No? Steve was teaching me some of this code recently, he could chime in :) > For example I can envisage: >=20 > +--------+----------------+--------+-------- > | p0 | p1 | p0 | p1 > +--------+----------------+--------+-------- > ^ ^ ^ ^ ^ > | | | | |=20 > | | | | Fails to hold the lock > holds lock releases lock | and proxy execs for p0 again > | | > | | > tries to hold lock holds lock again > proxy execs for p0 >=20 > The notion of priority in CFS as it stands doesn't help in providing any > guarantees in who will be able to hold the lock next. I haven't looked at t= he > patches closely, so this might be handled already. I think the situation w= ill > be worse if there're more tasks contending for the lock. Priority will > influences the chances, but the end result who holds the lock next is > effectively random, AFAICT. The wake up during unlock is FIFO order of waiters though. So that=E2=80=99s= deterministic. > I had a conversation once with an app developer who came from iOS world an= d > they were confused why their higher priority task is not preempting the lo= wer > priority one when they ported it to Android. >=20 > I wonder sometimes if we need to introduce a true notion of priority for C= FS. > I don't see why an app developer who would like to create 3 tasks and give= them > strict priority order relative to each others can't do that. At the moment= they > have little option in controlling execution order. I want to talk more about this with you, I am actually working on something s= imilar. Let=E2=80=99s talk ;) Thanks, - Joel >=20 > Actually I think we need two types of priorities: >=20 > * global priorities for a sys admin to say which apps are more > important to run over other apps. Or fairly share it if > equal priority. > * local priorities for an app to control which of its tasks are more > important to run over other tasks it owns. >=20 > The concept of share doesn't allow controlling execution order - and force= s us > to look at things like latency_nice to, somewhat, overcome this limitation= . >=20 >=20 > Thanks >=20 > -- > Qais Yousef