Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp174940rwi; Wed, 2 Nov 2022 10:34:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6HmxI/8N/G0fbRyXpZkdzKR1UI5HevoJojwaGhJEMo6QS02hHNr37OBInHYIznTWxSmKYZ X-Received: by 2002:a17:90a:748c:b0:213:854f:f78a with SMTP id p12-20020a17090a748c00b00213854ff78amr26055115pjk.41.1667410455371; Wed, 02 Nov 2022 10:34:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667410455; cv=none; d=google.com; s=arc-20160816; b=ycUZYLpGISReJv5SNV8QeLZh6HzLG/v73uxzJUZ/BNpN/U3UX+hGIEk60e8ToqKgkt 0Q04VHLYwKfnNLHmA8orAjzsMU36VRP6V+RQc4xT4Fq0lqjd239Bvm9S0PsyLaGk0vJu 8aZ3Cp66GonNclDioZ4/qv7eCb+8fLlFHnwmIuFWrHQULzQsAyR35vLJHBACa+I2OiBt WLcJ+wPZwT6Jrp60lJZpK5/tRhQVSbf7CQcBqkzMrkwZSLXXV4vEyyxyJYSqLt91fHy3 Oph6gGg97GQlCDvjUGA15N6+gCqnD6nB5mvNfWFBiiuzUa1NrZBBsnbzb0w7Wt1EyYd5 rmzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=5ah+k1HHHyy0taWg599acxl3PDtcC8v9M4mgXqN3XA0=; b=AiVHJKaxmLhTbbPq3RtxUPoDJsaFfMIvPNZag9GgrYIAD1gFU1aaKa/nlSU5tDv91N wCWbYhMty4jvh3fPt0fOG6k+LeQMYqMuXGAVsBqIXL6ljBGBcYOBsyvmgsSUAhTRfD2m 6dy8P5cpc0pUf6vJYFqA1VdyGY9NqErFMkRRwsq0s5+wtZ4ZfM8iiIaZrTv+nDp1bP03 M6H7nabg7umsxSdvSjz8WnxL56D1/wbL3GamUf9vri/8KIm2s5VlgprHyOpbcHj7IGJe twkeMlajZlcLqXnp9IPsJpwHzhKBnQYzyD/JPHYUkkuC6sDIm7ojpxDXKwgFJ79BjVJ9 jSMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=fKQs0AHx; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lb12-20020a17090b4a4c00b00201d6d4cc79si3501069pjb.113.2022.11.02.10.34.01; Wed, 02 Nov 2022 10:34:15 -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=@suse.com header.s=susede1 header.b=fKQs0AHx; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230507AbiKBQ72 (ORCPT + 98 others); Wed, 2 Nov 2022 12:59:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229650AbiKBQ70 (ORCPT ); Wed, 2 Nov 2022 12:59:26 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36248BC24 for ; Wed, 2 Nov 2022 09:59:25 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id C8247229BE; Wed, 2 Nov 2022 16:59:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1667408363; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5ah+k1HHHyy0taWg599acxl3PDtcC8v9M4mgXqN3XA0=; b=fKQs0AHxKdE+or9pFOABc0yBQnpBBJfDIvfYJFv/pm3Y28tCFjUz18A7v35WTcjRLdpmpW TzRfwLGA05WSbCMPlncbJX3pcq8GRTdeyxGeNYMcP4Sy2OUyVY+CodcD40H5jik5FFWROe IjA3JVkTfxxq44x7GhoXLbvrsOGwl30= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 899DC13AE0; Wed, 2 Nov 2022 16:59:23 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id i3rIIOuhYmMZMwAAMHmgww (envelope-from ); Wed, 02 Nov 2022 16:59:23 +0000 Date: Wed, 2 Nov 2022 17:59:22 +0100 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: Josh Don Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] sched: async unthrottling for cfs bandwidth Message-ID: <20221102165922.GA31833@blackbody.suse.cz> References: <20221026224449.214839-1-joshdon@google.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="0OAP2g/MAC+5xKAE" Content-Disposition: inline In-Reply-To: <20221026224449.214839-1-joshdon@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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 --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello. On Wed, Oct 26, 2022 at 03:44:49PM -0700, Josh Don wrote: > To fix this, we can instead unthrottle cfs_rq's asynchronously via a > CSD. Each cpu is responsible for unthrottling itself, thus sharding the > total work more fairly across the system, and avoiding hard lockups. FIFO behavior of the cfs_b->throttled_cfs_rq is quite important to ensure fairness of throttling (historically when it FIFO wasn't honored, it caused some cfs_rq starving issues). Despite its name, distribute_cfs_runtime() doesn't distribute the runtime, the time is pulled inside assign_cfs_rq_runtime() (but that's already on target cpu). Currently, it's all synchronized under cfs_b->lock but with your change, throttled cfs_rq would be dissolved among cpus that'd run concurrently (assign_cfs_rq_runtime() still takes cfs_b->lock but it won't be necessarily in the unthrottling order). Have you observed any such fairness issues? [1][2] > +static inline void __unthrottle_cfs_rq_async(struct cfs_rq *cfs_rq) > [...] > + if (rq == this_rq()) { > + unthrottle_cfs_rq(cfs_rq); > + return; > + } It was pointed out to me that generic_exec_single() does something similar. Wouldn't the flow bandwidth control code be simpler relying on that? Also, can a particular cfs_rq be on both cfs_b->throttled_csd_list and cfs_b->throttled_cfs_rq lists at any moment? I wonder if having a single list_head node in cfs_rq would be feasible (and hence enforcing this constraint in data). Regards, Michal [1] I'm not familiar with IPIs, just to illustrate the concurrency: the fairness could be skewed towards CPUs that are on same "NUMA" node as the timer callback if closer CPUs received them sooner. [2] Currently, I don't think it's a prohibitive issue because with my reasoning even the current code relies on cfs_b->lock being a queued spinlock to ensure the FIFO of cfs_b->throttled_cfs_rq. --0OAP2g/MAC+5xKAE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQTrXXag4J0QvXXBmkMkDQmsBEOquQUCY2Kh6AAKCRAkDQmsBEOq ufLnAP0QHQBHrtHpOiTgDOBuoI7CM5OCYYXbU2JiLoWaA3qT9gD/aU2v2wLlgHsB wh4R8oXsEXhhmcSKxJvxgGp7izuQcwA= =4UKU -----END PGP SIGNATURE----- --0OAP2g/MAC+5xKAE--