Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4820076rwb; Mon, 21 Nov 2022 12:21:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf4TtViVMDOnMmHQpWAWU6LfAg1Ux1SQqHo0wgZpQeseBwqQL60Q2T5iMqQi4j/lUdmSFpOR X-Received: by 2002:a17:902:9897:b0:186:a98c:4ab8 with SMTP id s23-20020a170902989700b00186a98c4ab8mr495231plp.118.1669062085074; Mon, 21 Nov 2022 12:21:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669062085; cv=none; d=google.com; s=arc-20160816; b=uR57Tk9qFEdf2ykS6cHM+yho+qRWWopYn7WJ1pKogeyEObkUa3t2twM1aVx/f/loVY y4fxPJp12yxV/gVxZbIbuzI6kP2Ip9qtW5zP7WZx0n3dTu0BSuGoWjIf8Y9eFzES5vWk Iik2K2LnaQvkupD7p14XKY6HmNtQvWQ7zM2RM0DIg6hV/Rxp5Bmgzb4b9X9EglPX+Nh0 CGjOxYbTFgzXYE0gWov+TdgmlcxcbB76JLJy4mck5SGBXb8lKqbX7Y1ZJX9TiwkZCinX xHrRXffihpgI7fWPjYjYScO7/32v5KUH5b4Fxrx3ODu0A4DoXl0473EOt3EWjGWnpdoE vI9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=dvxWSbOGt/q3oX51qgBEOTTPkYmCFByVIpKRWftXbOw=; b=NYPLfVUhjTKaSkjERpWO886A/UT0FE20cErHqwxOQUTmZ15q+rMu92raKCD0mrucTn M6Cn99jMF9ea+43ameAPsI6C3/62UExTCOtCoBSojG8zJPEYt/EWm4EezAGygM/rwgFo 6oxl/OQckHRmziiD2/vIEiwYb8i4W0pNMWE57Eif3IDa4+XcLNQ0hO4kvtj2qYXXsz15 xmqGj45HPCOWoIeBhKekO/MDjvkSctspZY+h5yZm4p7Ax42CCi9DYTYozUCmfaP/oEhb 9PWePeFk59+WbcY5LcG75GwUimMNR+hCJWOlj0i9MPxMljW6RESBWv3k6WFlq+oIj/Fh ayKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=LjdkeOhN; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p17-20020a63c151000000b0046fb2a4b57csi11660269pgi.819.2022.11.21.12.21.13; Mon, 21 Nov 2022 12:21:25 -0800 (PST) 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=@google.com header.s=20210112 header.b=LjdkeOhN; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230482AbiKUThc (ORCPT + 91 others); Mon, 21 Nov 2022 14:37:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230491AbiKUTha (ORCPT ); Mon, 21 Nov 2022 14:37:30 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74622F54 for ; Mon, 21 Nov 2022 11:37:28 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id s8so20343379lfc.8 for ; Mon, 21 Nov 2022 11:37:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=dvxWSbOGt/q3oX51qgBEOTTPkYmCFByVIpKRWftXbOw=; b=LjdkeOhNI7f/79ZCQ+XmzzpIVs+AXL5PcSXhsF5Gh1Wr9uE/nbTm2VUrUhmgr59Gqt l8Bhn4nXWuU2aly5bYpO1/bgwR6O9jGm72xqhYhV9/H5MQjvcqHpFb35wsyAMTBJhv8S O2eE9RgNhVXzeFALIVP/axHlANmE8zU1NyqYqkBzFhFIk5oQOfkP49w1Lv0WcUeGKT7Y tyoglseeJg/2js7XTxd7ZFZWlSmhZU15fdWAtn1TkIgrwhPRMruw7qXdD/cD88l3nCAU /2GJs3tt8X31uNgvkXR4GVn/2Khi01eh1NpY4yyB4yk48Ytk5oiVguPT6CFNsir2GZak YNQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=dvxWSbOGt/q3oX51qgBEOTTPkYmCFByVIpKRWftXbOw=; b=4tFeTcoDlOgXDNIn4wDeLw5TQeZ8Q5GxDnrgW7yCaijqstGqdQiPyLStWsnRDbuwni nM2q5Jy4nQoqT0MFcNAwjZVL2MeNXp3bML++mC56xmy+H4i+QG28daHk97r7xkGZuGod ooEA+hh73Mdo739D9lJ0+2CTpw20qekQJj+yEMSiscyrIswMue0/HN5wtkv0DZV1CHmm VQ0khkBC+tA1Asn4LJLTOpxTUMiuPCBmHS+Vv8PMRwbU9xkDFdlOlUqch+mBGXtVxTGb 3MjlSyC+1cNc8p36bhihEC7ebzIgSqB9g5WtMUZtQDrxIXJt6BXjVC2XYqrdYcmA1+OJ p+qA== X-Gm-Message-State: ANoB5pmiTyXyQIVq2+gpclSXB1YLk0hCoCsmIOqx80+Hk761Tmh4gaGg Y5OtT8y28OVNf2LnzorQYCNWsSGo5/O/VN15oiAjPQ== X-Received: by 2002:a19:6b13:0:b0:4b1:82c6:2959 with SMTP id d19-20020a196b13000000b004b182c62959mr6190678lfa.68.1669059446544; Mon, 21 Nov 2022 11:37:26 -0800 (PST) MIME-Version: 1.0 References: <20221117005418.3499691-1-joshdon@google.com> <094299a3-f039-04c1-d749-2bea0bc14246@linux.dev> In-Reply-To: From: Josh Don Date: Mon, 21 Nov 2022 11:37:14 -0800 Message-ID: Subject: Re: [PATCH v3] sched: async unthrottling for cfs bandwidth To: Peter Zijlstra Cc: Chengming Zhou , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel@vger.kernel.org, Tejun Heo , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Christian Brauner , Zefan Li Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Mon, Nov 21, 2022 at 3:58 AM Peter Zijlstra wrote: > > On Sun, Nov 20, 2022 at 10:22:40AM +0800, Chengming Zhou wrote: > > > + if (cfs_rq->runtime_remaining > 0) { > > > + if (cpu_of(rq) != this_cpu || > > > + SCHED_WARN_ON(local_unthrottle)) { > > > + unthrottle_cfs_rq_async(cfs_rq); > > > + } else { > > > + local_unthrottle = cfs_rq; > > > + } > > > + } else { > > > + throttled = true; > > > + } > > > > Hello, > > > > I don't get the point why local unthrottle is put after all the remote cpus, > > since this list is FIFO? (earliest throttled cfs_rq is at the head) > > Let the local completion time for a CPU be W. Then if we queue a remote > work after the local synchronous work, the lower bound for total > completion is at least 2W. > > OTOH, if we first queue all remote work and then process the local > synchronous work, the lower bound for total completion is W. > > The practical difference is that all relevant CPUs get unthrottled > rougly at the same point in time, unlike with the original case, where > some CPUs have the opportunity to consume W runtime while another is > still throttled. Yep, this tradeoff feels "best", but there are some edge cases where this could potentially disrupt fairness. For example, if we have non-trivial W, a lot of cpus to iterate through for dispatching remote unthrottle, and quota is small. Doesn't help that the timer is pinned so that this will continually hit the same cpu. But as I alluded to, I think the net benefit here is greater with the local unthrottling ordered last.