From patchwork Fri Sep 22 23:05:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Don X-Patchwork-Id: 143763 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:910f:0:b0:403:3b70:6f57 with SMTP id r15csp20404vqg; Fri, 22 Sep 2023 18:19:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG7ji3SzTjppDGAZdZorBfaKuzQtw7CGj/5dcljxG/t4cX4sYCYRPZUORHaso6xmihR/AcZ X-Received: by 2002:a05:6a00:4a04:b0:690:fd48:1aa4 with SMTP id do4-20020a056a004a0400b00690fd481aa4mr5459519pfb.0.1695431940307; Fri, 22 Sep 2023 18:19:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695431940; cv=none; d=google.com; s=arc-20160816; b=xTDx1d0O9UXBsq+QcOM3rnbY2hVQUWCt6q0YkiF3SkW4ITWNsNyJohi8AW2AUzUYJc k+gHZEEwaVCYBdex8+DxYsNKVLQqwWJpWjEQHdziSXuvY1xc06eAur7k3oLyPemgQxIn Z6FCtpSxhhvZovERU1V25s/tOsSxzqaXHdI9E7NRfMaDlecL1mJoPFwFLQAzA36N6elM yQwuKeUTTZNJ7Ug29JVP10INeGK7pBf+eGsNOotQ4Ivbe6M+02O1XKwrbEvzqZcA7YLC 3qFxgMPedqop1GdnKgIIZNCUownpoYCs/lc8dBBxrTBrV8jfZ1lW6/3FRA5fnC1qNTNj UUTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=NHVBmOhheiImvCV9GEh5Xy8qOuiiZvjK42ap36JRWZs=; fh=UiXA54t1odHEprHSYfremupcP9Fl4Cqag0pTl7oSZd4=; b=as0kfvebEVTaJFsjYBN4NXkBDl36Mk7MLtP40PMtkZ0JfXJG39h2fkMrsNe+1QUpcQ Ck0qinKlQ2uEQinl+jyXVBGz5rc1SFxe99VhM0Xzm8bRzNE14vVGZxvjt1MF0luxnCFm XMJpgs1BbPNzzovJG3dg6QsCI5cEMy9AW2PKKVhC8f3v3oD7OAFoDwDIqX1pC6Z3b8rH 8Pby7G5eTJsb2mMKq+kQ75AyAzi2rUE8Z972+FzDTyU7Hote8tCbdQqdA32DSGQV+7Ug rar8Nfn+YaU+wZ7eBILpc9UXMn6lobfcvjou90YKBZcdFPHWQiYrMkeX9k6cOjseziQ9 xaoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=hbGZj91t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id cl3-20020a056a0032c300b00690c0055246si4975605pfb.294.2023.09.22.18.18.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 18:19:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=hbGZj91t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 9E9468218E62; Fri, 22 Sep 2023 16:06:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230224AbjIVXGM (ORCPT + 28 others); Fri, 22 Sep 2023 19:06:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbjIVXGL (ORCPT ); Fri, 22 Sep 2023 19:06:11 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B942198 for ; Fri, 22 Sep 2023 16:06:05 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d81503de9c9so3795372276.3 for ; Fri, 22 Sep 2023 16:06:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695423964; x=1696028764; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=NHVBmOhheiImvCV9GEh5Xy8qOuiiZvjK42ap36JRWZs=; b=hbGZj91tIiL3NZZRYvNp+umzqtIq1gebYrGd624HbNknr9x7AGYp/eXTzbwoHYDkxL O7RKLsa/+BWlVatFm300tpmg0s8qo6q88vWDi/zNRHgzYkiF3Kk5amOTUpzvFdFXU0ar O2lwhyjJ1Wxj+dOSYTKPnQc+S/7aLmhwW4lbuwMR6dTasnjwCpq1G18UFMPwLO2c9g3k cakKgXuLngNcGseirMtS+d/ihZnbdJEdlb2L8rf9OT56QGLy1Z79xvC9S2CCAy3uBr3H xtYTtaEJ3lANOmO5VACGHOLX5PPqeXg18u1Mv12L0rRaWwGDZBHWXkEYlvuyq1FVPfkL vIYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695423964; x=1696028764; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=NHVBmOhheiImvCV9GEh5Xy8qOuiiZvjK42ap36JRWZs=; b=ciFHTuTZuejJqiEnDfok8xKcppiLSaguMvrqS/2kQDg6mE9wk5NYKCvPqB24YEBxZK 79UYIDf1FVbK9D7CjgRfYU18aA9ku4PFC0mUCbZiezrhoAQ8oAWSwksZCNAbYl/oAubX ZtvTvk5np09C9rcOQn/1QwNREki8n6Gkp0g+MuqwPpE5U02ZPgdjPx4UILu377P6Mge+ 996jPoPn1URhoEpeGS1YmgbXDhmkqj1YDhQqgof4vIFs6OE2diCuGQesh+u+HN3bHOXn Yf30kz4E7+7EkgMzZAc66qwiJfdktrfGeybXapFpFWGgSWywrCA6ru11qmCo7OaViDCQ V5LA== X-Gm-Message-State: AOJu0YxGdo2iB7HKJpJbQFL28vEEo0HxJ3ebaKwBrLj/3xuGTFlFUBkp DDM0DLtZCy5ot2sq3bsbc+fIuXnzP+Rn X-Received: from joshdon-desktop.svl.corp.google.com ([2620:15c:2a3:200:7ebc:6ddc:e08c:7b19]) (user=joshdon job=sendgmr) by 2002:a05:6902:161c:b0:d0e:e780:81b3 with SMTP id bw28-20020a056902161c00b00d0ee78081b3mr7454ybb.2.1695423964289; Fri, 22 Sep 2023 16:06:04 -0700 (PDT) Date: Fri, 22 Sep 2023 16:05:34 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog Message-ID: <20230922230535.296350-1-joshdon@google.com> Subject: [PATCH 1/2] sched: make cfs_rq->throttled_csd_list available on !SMP From: Josh Don To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot Cc: Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel@vger.kernel.org, Josh Don X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 22 Sep 2023 16:06:17 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777789242407522874 X-GMAIL-MSGID: 1777789242407522874 This makes the following patch cleaner by avoiding extra CONFIG_SMP conditionals on the availability of throttled_csd_list. Signed-off-by: Josh Don --- kernel/sched/fair.c | 4 ---- kernel/sched/sched.h | 2 -- 2 files changed, 6 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 384900bf87eb..8f4e63fc8900 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5765,11 +5765,9 @@ static bool distribute_cfs_runtime(struct cfs_bandwidth *cfs_b) if (!cfs_rq_throttled(cfs_rq)) goto next; -#ifdef CONFIG_SMP /* Already queued for async unthrottle */ if (!list_empty(&cfs_rq->throttled_csd_list)) goto next; -#endif /* By the above checks, this should never be true */ SCHED_WARN_ON(cfs_rq->runtime_remaining > 0); @@ -6136,9 +6134,7 @@ static void init_cfs_rq_runtime(struct cfs_rq *cfs_rq) { cfs_rq->runtime_enabled = 0; INIT_LIST_HEAD(&cfs_rq->throttled_list); -#ifdef CONFIG_SMP INIT_LIST_HEAD(&cfs_rq->throttled_csd_list); -#endif } void start_cfs_bandwidth(struct cfs_bandwidth *cfs_b) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 68768f47ccb7..8f6a6b693d10 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -644,9 +644,7 @@ struct cfs_rq { int throttled; int throttle_count; struct list_head throttled_list; -#ifdef CONFIG_SMP struct list_head throttled_csd_list; -#endif #endif /* CONFIG_CFS_BANDWIDTH */ #endif /* CONFIG_FAIR_GROUP_SCHED */ }; From patchwork Fri Sep 22 23:05:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Don X-Patchwork-Id: 143764 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:910f:0:b0:403:3b70:6f57 with SMTP id r15csp20876vqg; Fri, 22 Sep 2023 18:20:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH7xqdvnDbyboXnJvLYY60TqwE+Wq2jkYYFpaoIHamcRLrlfbNtGcSXLlSzbW268iB57WOQ X-Received: by 2002:a05:6a20:2589:b0:15a:f4e:620d with SMTP id k9-20020a056a20258900b0015a0f4e620dmr1115944pzd.4.1695432023836; Fri, 22 Sep 2023 18:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695432023; cv=none; d=google.com; s=arc-20160816; b=dO4ZKqHIxgAtmi4SDFqVdO73Lff6JWGCFDFCn7Kf1Ny78g0o/kQxYnNrXAj9DOnuEW Nk6zdSD87lW0E/5yA6rKmeoBiuNiRP/5vx8zsasmD0rfGk/ToMrKElVGjJwM6aFCzW0K KxWSyEmcspExkR+qHrEhnRA7CJmmS4q25Amu5B0jpuGzE6N2JXnPgSqC3OABgqMOGB0l owraop0qzPRguE5fDkQFlZmkpsIS3tRR8j5cwa05t19UAx6AXNoEPnjAXHSlPuH6HkUS xYUSuGpAd0brF0nbjpgoycXOmV3wxDJlU3HfvYbbVipS8rDqLNpW3Ei/BIHmuQGTsw78 LlpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=zmlqYz9WKUrhwswwMcsvKjyR0oZwkHXZs3sw/VMeqy4=; fh=UiXA54t1odHEprHSYfremupcP9Fl4Cqag0pTl7oSZd4=; b=GxRuieBVL7mdwCeFlGeGmgTPJGhH1ErHyHS5+oLIODirpWqH/2BPiQI0mBDj9oXb1I hjSLRNUbxMK6peekeIg4mm1Jb8GzfDTobX2k4uif7nhS5j2toBtTYHdoZQZkdIu+kEqJ N4dO3a5w6PDNIoz+4gmnepTeyoSvJsgsaNF5DGUsOX8w7a9iKxWmGKjeOAUXwoJaaXSG 2ZYIiy6ZhY7ACTNuorUBAnWp57PSR6juw7Sa13U2qJ4lytTsFridWg3ckJB1g/7yErTX CPqIYEmRPjAst3AStFTcmP7n7/JtIyGBzefJAv1sFHHP5O+jReJr+Owf1Kus6NP2DO2G QCAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XC40Tihl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id y18-20020a056a00181200b00690a75a318asi5431553pfa.67.2023.09.22.18.20.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 18:20:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XC40Tihl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A034D8385469; Fri, 22 Sep 2023 16:06:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230264AbjIVXGS (ORCPT + 28 others); Fri, 22 Sep 2023 19:06:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbjIVXGO (ORCPT ); Fri, 22 Sep 2023 19:06:14 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95552198 for ; Fri, 22 Sep 2023 16:06:08 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-d85fc6261ffso3182753276.1 for ; Fri, 22 Sep 2023 16:06:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695423968; x=1696028768; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=zmlqYz9WKUrhwswwMcsvKjyR0oZwkHXZs3sw/VMeqy4=; b=XC40TihlJLHaKjpTuUsz/63rJMIPQUORV/d7F0v7hvpNxUJAFi+3G5SfOk/xcVrgDk ZZ1yp8PIk5fotfkSFY1G/z1fbYzDCiLbqz/4x9xUznBqe5lqTl9WSxj+K0B0Nzy1In9b al5BSPVJ8CpoiQn5V8iwKp8K7cOrqO4ByrIoEbTTIFRdvRM+1s7ZMY8ceix03JbQLsZC OBRX25t3gBhtGv3G0Z8V6VpBhQLSqfXhb4xwISaSb/Q6A1jY2uSDcVjHR8y92OL3x/5E zJArcVMmqw6aZd9r0bSe7X2YDAkl5tKItRXho9zJmN45NVc86QIq7POwiAEMbV+fvzYe Uoyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695423968; x=1696028768; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zmlqYz9WKUrhwswwMcsvKjyR0oZwkHXZs3sw/VMeqy4=; b=gEqrvApKYU7NKhZrQ526q08WCt5oRu7qlGgxXc+WUkVER3b7h7jFsMNvO6hyZaLXBY g/ANo9RZvwP7MzIH+mvSMzPcSxMm7yLtHAbNuAwrop79dlCTVeU9NfYz9WlzokWIqEU4 FY9b7aXbSKqhEvSOPvXuCnsAGa8MLvh0u05t9OuAChrBl/gt88poPi4Dwz8pCHPn3jHr wbLWlnO/zX19716htHVe8SJigcFRL6QrvIuOOI4fzWjj+uC4lQ75cnmSe4snw/H1j9vq HZBJDmRQ4YSVsX9vqBr+t7wDI2CpqHSZCCOsdBNUrnoGxeW/oVT8s7Uul6Qo7knYCMS6 Q70w== X-Gm-Message-State: AOJu0YwsF1JavMJfxWKARkpWD1mJMv6jhg/JONGXwELKXRsk+y+l4sc/ RWsOZ/+T8+goQneMKCmZ1cyt1ykUPT0N X-Received: from joshdon-desktop.svl.corp.google.com ([2620:15c:2a3:200:7ebc:6ddc:e08c:7b19]) (user=joshdon job=sendgmr) by 2002:a05:6902:160c:b0:d85:aa2f:5715 with SMTP id bw12-20020a056902160c00b00d85aa2f5715mr7438ybb.10.1695423967818; Fri, 22 Sep 2023 16:06:07 -0700 (PDT) Date: Fri, 22 Sep 2023 16:05:35 -0700 In-Reply-To: <20230922230535.296350-1-joshdon@google.com> Mime-Version: 1.0 References: <20230922230535.296350-1-joshdon@google.com> X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog Message-ID: <20230922230535.296350-2-joshdon@google.com> Subject: [PATCH 2/2] sched: fix warning in bandwidth distribution From: Josh Don To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot Cc: Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel@vger.kernel.org, Josh Don X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 22 Sep 2023 16:06:36 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777789329820240392 X-GMAIL-MSGID: 1777789329820240392 We've observed the following warning being hit in distribute_cfs_runtime(): SCHED_WARN_ON(cfs_rq->runtime_remaining > 0) We have the following race: - cpu0: running bandwidth distribution (distribute_cfs_runtime). Inspects the local cfs_rq and makes its runtime_remaining positive. However, we defer unthrottling the local cfs_rq until after considering all remote cfs_rq's. - cpu1: starts running bandwidth distribution from the slack timer. When it finds the cfs_rq for cpu 0 on the throttled list, it observers the that the cfs_rq is throttled, yet is not on the CSD list, and has a positive runtime_remaining, thus triggering the warning in distribute_cfs_runtime. To fix this, we can rework the local unthrottling logic to put the local cfs_rq on a local list, so that any future bandwidth distributions will realize that the cfs_rq is about to be unthrottled. Signed-off-by: Josh Don --- kernel/sched/fair.c | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 8f4e63fc8900..de002dab28cf 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5743,13 +5743,13 @@ static void unthrottle_cfs_rq_async(struct cfs_rq *cfs_rq) static bool distribute_cfs_runtime(struct cfs_bandwidth *cfs_b) { - struct cfs_rq *local_unthrottle = NULL; int this_cpu = smp_processor_id(); u64 runtime, remaining = 1; bool throttled = false; - struct cfs_rq *cfs_rq; + struct cfs_rq *cfs_rq, *tmp; struct rq_flags rf; struct rq *rq; + LIST_HEAD(local_unthrottle); rcu_read_lock(); list_for_each_entry_rcu(cfs_rq, &cfs_b->throttled_cfs_rq, @@ -5784,11 +5784,17 @@ static bool distribute_cfs_runtime(struct cfs_bandwidth *cfs_b) /* we check whether we're throttled above */ if (cfs_rq->runtime_remaining > 0) { - if (cpu_of(rq) != this_cpu || - SCHED_WARN_ON(local_unthrottle)) + if (cpu_of(rq) != this_cpu) { unthrottle_cfs_rq_async(cfs_rq); - else - local_unthrottle = cfs_rq; + } else { + /* + * We currently only expect to be unthrottling + * a single cfs_rq locally. + */ + SCHED_WARN_ON(!list_empty(&local_unthrottle)); + list_add_tail(&cfs_rq->throttled_csd_list, + &local_unthrottle); + } } else { throttled = true; } @@ -5796,15 +5802,23 @@ static bool distribute_cfs_runtime(struct cfs_bandwidth *cfs_b) next: rq_unlock_irqrestore(rq, &rf); } - rcu_read_unlock(); - if (local_unthrottle) { - rq = cpu_rq(this_cpu); + list_for_each_entry_safe(cfs_rq, tmp, &local_unthrottle, + throttled_csd_list) { + struct rq *rq = rq_of(cfs_rq); + rq_lock_irqsave(rq, &rf); - if (cfs_rq_throttled(local_unthrottle)) - unthrottle_cfs_rq(local_unthrottle); + + list_del_init(&cfs_rq->throttled_csd_list); + + if (cfs_rq_throttled(cfs_rq)) + unthrottle_cfs_rq(cfs_rq); + rq_unlock_irqrestore(rq, &rf); } + SCHED_WARN_ON(!list_empty(&local_unthrottle)); + + rcu_read_unlock(); return throttled; }