Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp869974rwi; Mon, 10 Oct 2022 08:13:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4s+1s7mdlXVnG08C8QpX+9ZDi2JWtQT+FWeyQ2mOdTUBOGC/flfkYSqjRnAl6fyxaqwyZS X-Received: by 2002:a17:906:cc0f:b0:78d:4741:4c7d with SMTP id ml15-20020a170906cc0f00b0078d47414c7dmr14995255ejb.379.1665414787951; Mon, 10 Oct 2022 08:13:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665414787; cv=none; d=google.com; s=arc-20160816; b=05iXdGAY6L9xQN7JUosg2hHXPw4M8k1l+XBEgaH4Bb+mCjkEZWTOPCLBv1hz2UvEcM XihIe52AnK1vyirMHp4e3DfoDa8veTZ775Li85CW1NHXaOCeeah7Bi9dFWIoRsYhd6n4 7JLQ9ezwNTxSzRF8XlvHbCmRZGug5lJ8v3pPxNQ6xk3ZrPiL9in3Eknbh1pn4uSCnNAA 5FbJYg5x+p105oj+AgVLlEqm3J9FyJZOv1EAQ9tTFCO5q4iRZ6QrsndA74P4iSmuZCUD 5Rl/dUC2Dphwc5uFf5bcbDswEKhUX9SgdtDeaEzGyXzqkK+orRh7h/7AkOPT3Nyx0Cmz zDcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=hm8aC5OjeQZyTIDZuuxP0fuLEqal2HQ7FyoiHjkn3oE=; b=ar5ZxsZAk5UOgE4DGynxr7Q+SQaq5U6PgC1H0E9emSI7RT4QbyR4Bxl9Xq/4fdnei+ KY2/dvWPTr0wBWBk/YQB2Y6hPa5BBxIILKQOpVPofwzPBzhxSpXTk9a0QHzQG7ArOTl+ cba9JCdHYBdPqjZPbLDvpekIY7kKtaKEgm7zNiu8+iw6/OXcjYBRsNtpQUY3dtZx1yJo oCOVGm2K/WYEk6eZNAtjeYaQBbupNGCpxXn5dKnrqtE0FNPeU7rdsmWgnO1UeAS4JnJO sJ73UadYRqHziT6f1bV0KWsBwj9sBiuTtF7iQ1Wl4EMqU+IYqc5jYNbTCp6lUNexDpND F3eg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ck16-20020a0564021c1000b0045731196587si6346915edb.64.2022.10.10.08.12.41; Mon, 10 Oct 2022 08:13:07 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229487AbiJJOq5 (ORCPT + 99 others); Mon, 10 Oct 2022 10:46:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbiJJOqz (ORCPT ); Mon, 10 Oct 2022 10:46:55 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 97AD65EDD2 for ; Mon, 10 Oct 2022 07:46:54 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9120012FC; Mon, 10 Oct 2022 07:47:00 -0700 (PDT) Received: from wubuntu (unknown [10.57.35.2]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 98D8F3F766; Mon, 10 Oct 2022 07:46:52 -0700 (PDT) Date: Mon, 10 Oct 2022 15:46:50 +0100 From: Qais Yousef To: Joel Fernandes Cc: Youssef Esmat , Peter Zijlstra , LKML , Steven Rostedt , juri.lelli@redhat.com, vincent.guittot@linaro.org, Dietmar Eggemann , Thomas Gleixner , bristot@redhat.com, clark.williams@gmail.com, bigeasy@linutronix.de, "Paul E. McKenney" Subject: Re: Sum of weights idea for CFS PI Message-ID: <20221010144650.fjwhjdbqqaxz4sow@wubuntu> References: <0BFD3887-60A2-4C74-9D37-49B7B6E64299@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0BFD3887-60A2-4C74-9D37-49B7B6E64299@joelfernandes.org> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE 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 10/08/22 11:04, Joel Fernandes wrote: > > > > On Oct 6, 2022, at 3:40 PM, Youssef Esmat wrote: > > > [..] > >> > >>> Anyway - just trying to explain how I see it and why C is unlikely to be > >>> taking too much time. I could be wrong. As Youssef said, I think there's > >>> no fundamental problem here. > >> > >> I know on Android where they use smaller HZ, the large tick causes lots of > >> problems for large nice deltas. Example if a highly niced task was to be > >> preempted for 1ms, and preempts instead at 3ms, then the less-niced task > >> will not be so nice (even less nice than it promised to be) any more > >> because of the 2ms boost that the higher niced task got. This can lead the > >> the sched_latency thrown out of the window. Not adjusting the weights > >> properly can potentially make that problem much worse IMO. > > > > Once C releases the lock it should get adjusted and A will get adjusted > > also regardless of tick. At the point we adjust the weights we have > > a chance to check for preemption and cause a reschedule. > > Yes but the lock can be held for potentially long time (and even user space > lock). I’m more comfortable with Peter’s PE patch which seems a more generic > solution, than sum of weights if we can get it working. I’m studying Connor’s > patch set now… The 2 solutions are equivalent AFAICT. With summation: A , B , C , D sleeping, running, running, running - , 1/5 , 3/5 , 1/5 Where we'll treat A as running but donate its bandwidth to C, the mutex owner. With PE: A , B , C , D running, running, running, running 2/5 , 1/5 , 1/5 , 1/5 Where A will donate its execution context to C, the mutex owner. In both cases we should end up with the same distribution as if neither A nor C ever go to sleep because of holding the mutex. I still can't see how B and D fairness will be impacted as the solution to the problem is to never treat a waiter as sleeping and let the owner run for more, but only within the limit of what the waiter is allowed to run for. AFAICS, both solutions maintain this relationship. Thanks -- Qais Yousef