Message ID | 20230920000559.3872416-1-joshdon@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp3834502vqi; Tue, 19 Sep 2023 19:56:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEbmftO3wBVpUxvgNbQf72QXiHYZd4rl4N73ANJ/MqZjvYJ8yGGY5+x+HBexWrijLpSBqVZ X-Received: by 2002:aca:240d:0:b0:3ad:c33a:cea3 with SMTP id n13-20020aca240d000000b003adc33acea3mr1064907oic.49.1695178560525; Tue, 19 Sep 2023 19:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695178560; cv=none; d=google.com; s=arc-20160816; b=mbL29qYBvQKtD60urPZpP2lV7pwD6xWQiiyGHZ/pSE13jlbUd4LJweR1KlyfNtHSP3 Dr8SjDsASyakXOL0TNIHgmNKb5u94rzR0YJWbH2/xB7NhWY9p5zMQRS/Yy+km4XY+iA8 2NoUwMDVWT4CxOePgv9AAbfZUc7/z9MDaElt1QsSTDog5a8wkj1Jl0kzrIhH8X5s83LE Z/DAFRft0Z6h38ZSy+L9swN/WtakPrRfQv1zrQTSmeBGBR8AkYn8p9rCGOXbTWXQpE7L 1eI5GqHGP4lnCKgMuNY7nrm8mF3cLaMEAgDtP/o3UkLprShavydySN9I/H+PjHq1fD8H GqnA== 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=5rd6RU3HRliBkUXGA7dvU4/oAlmDxBiQOYh5+rVz/qQ=; fh=UiXA54t1odHEprHSYfremupcP9Fl4Cqag0pTl7oSZd4=; b=LMDYVXCHxc/z0EPZy32S4uF/BXTaNrKTnO/pkkgbhjGnPxb4dl56XEIswXY7QbiKIk VtnK37HHatdUaoiW4EKaim8GOGA7N5MCiHjoecVYD4p8d2WKVkFTwkU/022KVJhSRxvw Qa2dByDIAV4uor6ZV4nIxfWuVwproK4Zz23jPZAosLw1MKqbaemUHNnquiF6ADQKpbHk mAO7v3B6+RphwhklbsliobDknsQXWUU4L6b+aae7mu+9F2zj+MmTho9BWgM2kRLaI5y2 BEM2JYna5O/kbRizdxjF2NtcWwKt/iABfCRteWeN+QYyF3ETOO2T7/1c9QfdD7I/PD24 0i8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Sw0IzeNc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id fb1-20020a056a002d8100b00690f191430csi421827pfb.56.2023.09.19.19.56.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 19:56:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Sw0IzeNc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 77DF38031AE0; Tue, 19 Sep 2023 17:06:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231598AbjITAGh (ORCPT <rfc822;toshivichauhan@gmail.com> + 26 others); Tue, 19 Sep 2023 20:06:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229690AbjITAGf (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 19 Sep 2023 20:06:35 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3F4795 for <linux-kernel@vger.kernel.org>; Tue, 19 Sep 2023 17:06:28 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-59e758d6236so39605527b3.1 for <linux-kernel@vger.kernel.org>; Tue, 19 Sep 2023 17:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695168388; x=1695773188; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=5rd6RU3HRliBkUXGA7dvU4/oAlmDxBiQOYh5+rVz/qQ=; b=Sw0IzeNcJA2AtfNyV7zxGCxoHcj/0gaWvz4BYe52qWlZ9ZBjtdOcvfhju3HGSutNv8 KoAe8Ank8mwqoWS0MHP8FUfTx55qZg+Sen6Xr0OIkR4n/dgzJgMypgUd3r1vgb9b4bQw bH/dyZbFuQIhvXUK/uGVRPsZQ5XW64lcZPe5w9DJMwDk0Cib0n7jlNtuS+4Z9Tktkrvr yVgzT6z7CEJoeUywdAyIeGBOMp/t1M3EOx35o4EPOKz4J/hP6dVtCb0eEawFkESvnRKp q8f/JGldH2lhcgJ0BY6NBJNci/8CVMYIOqXIaM0nermit6e18KOPtR3szDyDUE4t8dG2 SVdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695168388; x=1695773188; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=5rd6RU3HRliBkUXGA7dvU4/oAlmDxBiQOYh5+rVz/qQ=; b=rMjn5UVKh2qE2Riz2t8BQtsVtkPAYY/5lZdSN4ixSq1K+/ruHznTUkzQkVf/zzhvjx TJL4XB9b2S5WmCFM3vfpH7IZNpdo4MTdNYTTLdnjtuYcrDB2/HFhcE2ARUbVhXCN1LuB BpB5U2+q748wCRrpNfgqVc5ovX0PuwxfsY9oU2BUQSBd5IVx+tXFX0zazC8GZG9H/zpQ y4pQoUwLWVe2wr5tDVfW1MXaDeo2X1UFOFZB89jY4qtwkKAU9TPRnd+knAt9QgiHFPU1 suQ0r1z0cQD8dha7RKA/DRd7z3+1Kfyfsb2mLHoSdgPKJFjMzzPXsktF+NjkQsUADa5b yKZA== X-Gm-Message-State: AOJu0YzSQZLJI28Z2QobZYhB9XsgDJRoKerQTCWdBFG47TigVutKqXUO Ebo8epx6PmnZFIxKJ61zkQ2MpMm+vQ0C X-Received: from joshdon-desktop.svl.corp.google.com ([2620:15c:2a3:200:abfd:1a0d:38de:e671]) (user=joshdon job=sendgmr) by 2002:a81:b656:0:b0:59b:f493:813c with SMTP id h22-20020a81b656000000b0059bf493813cmr15081ywk.9.1695168388169; Tue, 19 Sep 2023 17:06:28 -0700 (PDT) Date: Tue, 19 Sep 2023 17:05:59 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.42.0.459.ge4e396fd5e-goog Message-ID: <20230920000559.3872416-1-joshdon@google.com> Subject: [PATCH] sched: fix warning in bandwidth distribution From: Josh Don <joshdon@google.com> To: Ingo Molnar <mingo@redhat.com>, Peter Zijlstra <peterz@infradead.org>, Juri Lelli <juri.lelli@redhat.com>, Vincent Guittot <vincent.guittot@linaro.org> Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>, Steven Rostedt <rostedt@goodmis.org>, Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>, Daniel Bristot de Oliveira <bristot@redhat.com>, Valentin Schneider <vschneid@redhat.com>, linux-kernel@vger.kernel.org, Josh Don <joshdon@google.com> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 19 Sep 2023 17:06:56 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777523223370864573 X-GMAIL-MSGID: 1777523553802745266 |
Series |
sched: fix warning in bandwidth distribution
|
|
Commit Message
Josh Don
Sept. 20, 2023, 12:05 a.m. UTC
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 <joshdon@google.com>
---
kernel/sched/fair.c | 36 +++++++++++++++++++++++++-----------
1 file changed, 25 insertions(+), 11 deletions(-)
Comments
Hi Josh, kernel test robot noticed the following build errors: [auto build test ERROR on tip/sched/core] [also build test ERROR on tip/master tip/auto-latest linus/master v6.6-rc2 next-20230920] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Josh-Don/sched-fix-warning-in-bandwidth-distribution/20230920-080712 base: tip/sched/core patch link: https://lore.kernel.org/r/20230920000559.3872416-1-joshdon%40google.com patch subject: [PATCH] sched: fix warning in bandwidth distribution config: arm-bcm2835_defconfig (https://download.01.org/0day-ci/archive/20230921/202309210339.XihTnzE3-lkp@intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230921/202309210339.XihTnzE3-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202309210339.XihTnzE3-lkp@intel.com/ All errors (new ones prefixed by >>): kernel/sched/fair.c: In function 'distribute_cfs_runtime': kernel/sched/fair.c:5808:56: error: 'struct cfs_rq' has no member named 'throttled_csd_list'; did you mean 'throttled_list'? 5808 | list_add_tail(&cfs_rq->throttled_csd_list, | ^~~~~~~~~~~~~~~~~~ | throttled_list In file included from include/linux/container_of.h:5, from include/linux/kernel.h:21, from include/linux/cpumask.h:10, from include/linux/energy_model.h:4, from kernel/sched/fair.c:23: kernel/sched/fair.c:5820:34: error: 'struct cfs_rq' has no member named 'throttled_csd_list'; did you mean 'throttled_list'? 5820 | throttled_csd_list) { | ^~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert' 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) | ^~~~ include/linux/container_of.h:20:9: note: in expansion of macro 'static_assert' 20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~~~ include/linux/container_of.h:20:23: note: in expansion of macro '__same_type' 20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~ include/linux/list.h:601:9: note: in expansion of macro 'container_of' 601 | container_of(ptr, type, member) | ^~~~~~~~~~~~ include/linux/list.h:612:9: note: in expansion of macro 'list_entry' 612 | list_entry((ptr)->next, type, member) | ^~~~~~~~~~ include/linux/list.h:857:20: note: in expansion of macro 'list_first_entry' 857 | for (pos = list_first_entry(head, typeof(*pos), member), \ | ^~~~~~~~~~~~~~~~ kernel/sched/fair.c:5819:9: note: in expansion of macro 'list_for_each_entry_safe' 5819 | list_for_each_entry_safe(cfs_rq, tmp, &local_unthrottle, | ^~~~~~~~~~~~~~~~~~~~~~~~ >> include/linux/compiler_types.h:366:27: error: expression in static assertion is not an integer 366 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert' 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) | ^~~~ include/linux/container_of.h:20:9: note: in expansion of macro 'static_assert' 20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~~~ include/linux/container_of.h:20:23: note: in expansion of macro '__same_type' 20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~ include/linux/list.h:601:9: note: in expansion of macro 'container_of' 601 | container_of(ptr, type, member) | ^~~~~~~~~~~~ include/linux/list.h:612:9: note: in expansion of macro 'list_entry' 612 | list_entry((ptr)->next, type, member) | ^~~~~~~~~~ include/linux/list.h:857:20: note: in expansion of macro 'list_first_entry' 857 | for (pos = list_first_entry(head, typeof(*pos), member), \ | ^~~~~~~~~~~~~~~~ kernel/sched/fair.c:5819:9: note: in expansion of macro 'list_for_each_entry_safe' 5819 | list_for_each_entry_safe(cfs_rq, tmp, &local_unthrottle, | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from include/uapi/linux/posix_types.h:5, from include/uapi/linux/types.h:14, from include/linux/types.h:6, from include/linux/limits.h:6, from include/linux/kernel.h:16, from include/linux/cpumask.h:10, from include/linux/energy_model.h:4, from kernel/sched/fair.c:23: kernel/sched/fair.c:5820:34: error: 'struct cfs_rq' has no member named 'throttled_csd_list'; did you mean 'throttled_list'? 5820 | throttled_csd_list) { | ^~~~~~~~~~~~~~~~~~ include/linux/stddef.h:16:58: note: in definition of macro 'offsetof' 16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER) | ^~~~~~ include/linux/list.h:601:9: note: in expansion of macro 'container_of' 601 | container_of(ptr, type, member) | ^~~~~~~~~~~~ include/linux/list.h:612:9: note: in expansion of macro 'list_entry' 612 | list_entry((ptr)->next, type, member) | ^~~~~~~~~~ include/linux/list.h:857:20: note: in expansion of macro 'list_first_entry' 857 | for (pos = list_first_entry(head, typeof(*pos), member), \ | ^~~~~~~~~~~~~~~~ kernel/sched/fair.c:5819:9: note: in expansion of macro 'list_for_each_entry_safe' 5819 | list_for_each_entry_safe(cfs_rq, tmp, &local_unthrottle, | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from include/linux/kernel.h:21, from include/linux/cpumask.h:10, from include/linux/energy_model.h:4, from kernel/sched/fair.c:23: kernel/sched/fair.c:5820:34: error: 'struct cfs_rq' has no member named 'throttled_csd_list'; did you mean 'throttled_list'? 5820 | throttled_csd_list) { | ^~~~~~~~~~~~~~~~~~ include/linux/container_of.h:19:33: note: in definition of macro 'container_of' 19 | void *__mptr = (void *)(ptr); \ | ^~~ include/linux/list.h:645:9: note: in expansion of macro 'list_entry' 645 | list_entry((pos)->member.next, typeof(*(pos)), member) | ^~~~~~~~~~ include/linux/list.h:858:21: note: in expansion of macro 'list_next_entry' 858 | n = list_next_entry(pos, member); \ | ^~~~~~~~~~~~~~~ kernel/sched/fair.c:5819:9: note: in expansion of macro 'list_for_each_entry_safe' 5819 | list_for_each_entry_safe(cfs_rq, tmp, &local_unthrottle, | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from include/linux/container_of.h:5, from include/linux/kernel.h:21, from include/linux/cpumask.h:10, from include/linux/energy_model.h:4, from kernel/sched/fair.c:23: kernel/sched/fair.c:5820:34: error: 'struct cfs_rq' has no member named 'throttled_csd_list'; did you mean 'throttled_list'? 5820 | throttled_csd_list) { | ^~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert' 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) | ^~~~ include/linux/container_of.h:20:9: note: in expansion of macro 'static_assert' 20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~~~ include/linux/container_of.h:20:23: note: in expansion of macro '__same_type' 20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~ include/linux/list.h:601:9: note: in expansion of macro 'container_of' 601 | container_of(ptr, type, member) | ^~~~~~~~~~~~ include/linux/list.h:645:9: note: in expansion of macro 'list_entry' 645 | list_entry((pos)->member.next, typeof(*(pos)), member) | ^~~~~~~~~~ include/linux/list.h:858:21: note: in expansion of macro 'list_next_entry' 858 | n = list_next_entry(pos, member); \ | ^~~~~~~~~~~~~~~ kernel/sched/fair.c:5819:9: note: in expansion of macro 'list_for_each_entry_safe' 5819 | list_for_each_entry_safe(cfs_rq, tmp, &local_unthrottle, | ^~~~~~~~~~~~~~~~~~~~~~~~ kernel/sched/fair.c:5820:34: error: 'struct cfs_rq' has no member named 'throttled_csd_list'; did you mean 'throttled_list'? 5820 | throttled_csd_list) { | ^~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert' 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) | ^~~~ include/linux/container_of.h:20:9: note: in expansion of macro 'static_assert' 20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~~~ include/linux/container_of.h:20:23: note: in expansion of macro '__same_type' 20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~ include/linux/list.h:601:9: note: in expansion of macro 'container_of' 601 | container_of(ptr, type, member) | ^~~~~~~~~~~~ include/linux/list.h:645:9: note: in expansion of macro 'list_entry' 645 | list_entry((pos)->member.next, typeof(*(pos)), member) | ^~~~~~~~~~ include/linux/list.h:858:21: note: in expansion of macro 'list_next_entry' 858 | n = list_next_entry(pos, member); \ | ^~~~~~~~~~~~~~~ kernel/sched/fair.c:5819:9: note: in expansion of macro 'list_for_each_entry_safe' 5819 | list_for_each_entry_safe(cfs_rq, tmp, &local_unthrottle, | ^~~~~~~~~~~~~~~~~~~~~~~~ kernel/sched/fair.c:5820:34: error: 'struct cfs_rq' has no member named 'throttled_csd_list'; did you mean 'throttled_list'? 5820 | throttled_csd_list) { | ^~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert' 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) | ^~~~ include/linux/container_of.h:20:9: note: in expansion of macro 'static_assert' 20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~~~ include/linux/container_of.h:21:23: note: in expansion of macro '__same_type' 21 | __same_type(*(ptr), void), \ | ^~~~~~~~~~~ include/linux/list.h:601:9: note: in expansion of macro 'container_of' 601 | container_of(ptr, type, member) | ^~~~~~~~~~~~ include/linux/list.h:645:9: note: in expansion of macro 'list_entry' 645 | list_entry((pos)->member.next, typeof(*(pos)), member) | ^~~~~~~~~~ include/linux/list.h:858:21: note: in expansion of macro 'list_next_entry' 858 | n = list_next_entry(pos, member); \ | ^~~~~~~~~~~~~~~ kernel/sched/fair.c:5819:9: note: in expansion of macro 'list_for_each_entry_safe' 5819 | list_for_each_entry_safe(cfs_rq, tmp, &local_unthrottle, | ^~~~~~~~~~~~~~~~~~~~~~~~ >> include/linux/compiler_types.h:366:27: error: expression in static assertion is not an integer 366 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert' 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) | ^~~~ include/linux/container_of.h:20:9: note: in expansion of macro 'static_assert' 20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~~~ include/linux/container_of.h:20:23: note: in expansion of macro '__same_type' 20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~ include/linux/list.h:601:9: note: in expansion of macro 'container_of' 601 | container_of(ptr, type, member) | ^~~~~~~~~~~~ include/linux/list.h:645:9: note: in expansion of macro 'list_entry' 645 | list_entry((pos)->member.next, typeof(*(pos)), member) | ^~~~~~~~~~ include/linux/list.h:858:21: note: in expansion of macro 'list_next_entry' 858 | n = list_next_entry(pos, member); \ | ^~~~~~~~~~~~~~~ kernel/sched/fair.c:5819:9: note: in expansion of macro 'list_for_each_entry_safe' 5819 | list_for_each_entry_safe(cfs_rq, tmp, &local_unthrottle, | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from include/uapi/linux/posix_types.h:5, from include/uapi/linux/types.h:14, from include/linux/types.h:6, from include/linux/limits.h:6, from include/linux/kernel.h:16, from include/linux/cpumask.h:10, from include/linux/energy_model.h:4, from kernel/sched/fair.c:23: kernel/sched/fair.c:5820:34: error: 'struct cfs_rq' has no member named 'throttled_csd_list'; did you mean 'throttled_list'? 5820 | throttled_csd_list) { | ^~~~~~~~~~~~~~~~~~ include/linux/stddef.h:16:58: note: in definition of macro 'offsetof' 16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER) | ^~~~~~ include/linux/list.h:601:9: note: in expansion of macro 'container_of' 601 | container_of(ptr, type, member) | ^~~~~~~~~~~~ include/linux/list.h:645:9: note: in expansion of macro 'list_entry' 645 | list_entry((pos)->member.next, typeof(*(pos)), member) | ^~~~~~~~~~ include/linux/list.h:858:21: note: in expansion of macro 'list_next_entry' 858 | n = list_next_entry(pos, member); \ | ^~~~~~~~~~~~~~~ kernel/sched/fair.c:5819:9: note: in expansion of macro 'list_for_each_entry_safe' 5819 | list_for_each_entry_safe(cfs_rq, tmp, &local_unthrottle, | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from include/linux/rculist.h:10, from include/linux/pid.h:5, from include/linux/sched.h:14, from include/linux/ratelimit.h:6, from include/linux/dev_printk.h:16, from include/linux/device.h:15, from include/linux/energy_model.h:5, from kernel/sched/fair.c:23: include/linux/list.h:857:64: warning: left-hand operand of comma expression has no effect [-Wunused-value] 857 | for (pos = list_first_entry(head, typeof(*pos), member), \ | ^ kernel/sched/fair.c:5819:9: note: in expansion of macro 'list_for_each_entry_safe' 5819 | list_for_each_entry_safe(cfs_rq, tmp, &local_unthrottle, | ^~~~~~~~~~~~~~~~~~~~~~~~ kernel/sched/fair.c:5820:34: error: 'struct cfs_rq' has no member named 'throttled_csd_list'; did you mean 'throttled_list'? 5820 | throttled_csd_list) { | ^~~~~~~~~~~~~~~~~~ include/linux/list.h:761:16: note: in definition of macro 'list_entry_is_head' 761 | (&pos->member == (head)) | ^~~~~~ kernel/sched/fair.c:5819:9: note: in expansion of macro 'list_for_each_entry_safe' 5819 | list_for_each_entry_safe(cfs_rq, tmp, &local_unthrottle, | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from include/linux/kernel.h:21, from include/linux/cpumask.h:10, from include/linux/energy_model.h:4, from kernel/sched/fair.c:23: kernel/sched/fair.c:5820:34: error: 'struct cfs_rq' has no member named 'throttled_csd_list'; did you mean 'throttled_list'? 5820 | throttled_csd_list) { | ^~~~~~~~~~~~~~~~~~ include/linux/container_of.h:19:33: note: in definition of macro 'container_of' 19 | void *__mptr = (void *)(ptr); \ | ^~~ include/linux/list.h:645:9: note: in expansion of macro 'list_entry' 645 | list_entry((pos)->member.next, typeof(*(pos)), member) | ^~~~~~~~~~ include/linux/list.h:860:27: note: in expansion of macro 'list_next_entry' 860 | pos = n, n = list_next_entry(n, member)) | ^~~~~~~~~~~~~~~ kernel/sched/fair.c:5819:9: note: in expansion of macro 'list_for_each_entry_safe' 5819 | list_for_each_entry_safe(cfs_rq, tmp, &local_unthrottle, | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from include/linux/container_of.h:5, from include/linux/kernel.h:21, from include/linux/cpumask.h:10, from include/linux/energy_model.h:4, from kernel/sched/fair.c:23: kernel/sched/fair.c:5820:34: error: 'struct cfs_rq' has no member named 'throttled_csd_list'; did you mean 'throttled_list'? 5820 | throttled_csd_list) { | ^~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert' 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) | ^~~~ include/linux/container_of.h:20:9: note: in expansion of macro 'static_assert' 20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~~~ include/linux/container_of.h:20:23: note: in expansion of macro '__same_type' 20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~ include/linux/list.h:601:9: note: in expansion of macro 'container_of' 601 | container_of(ptr, type, member) | ^~~~~~~~~~~~ include/linux/list.h:645:9: note: in expansion of macro 'list_entry' 645 | list_entry((pos)->member.next, typeof(*(pos)), member) | ^~~~~~~~~~ include/linux/list.h:860:27: note: in expansion of macro 'list_next_entry' 860 | pos = n, n = list_next_entry(n, member)) | ^~~~~~~~~~~~~~~ kernel/sched/fair.c:5819:9: note: in expansion of macro 'list_for_each_entry_safe' 5819 | list_for_each_entry_safe(cfs_rq, tmp, &local_unthrottle, | ^~~~~~~~~~~~~~~~~~~~~~~~ kernel/sched/fair.c:5820:34: error: 'struct cfs_rq' has no member named 'throttled_csd_list'; did you mean 'throttled_list'? 5820 | throttled_csd_list) { | ^~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert' 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) | ^~~~ include/linux/container_of.h:20:9: note: in expansion of macro 'static_assert' 20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~~~ include/linux/container_of.h:20:23: note: in expansion of macro '__same_type' 20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~ include/linux/list.h:601:9: note: in expansion of macro 'container_of' 601 | container_of(ptr, type, member) | ^~~~~~~~~~~~ include/linux/list.h:645:9: note: in expansion of macro 'list_entry' 645 | list_entry((pos)->member.next, typeof(*(pos)), member) | ^~~~~~~~~~ include/linux/list.h:860:27: note: in expansion of macro 'list_next_entry' 860 | pos = n, n = list_next_entry(n, member)) | ^~~~~~~~~~~~~~~ kernel/sched/fair.c:5819:9: note: in expansion of macro 'list_for_each_entry_safe' 5819 | list_for_each_entry_safe(cfs_rq, tmp, &local_unthrottle, | ^~~~~~~~~~~~~~~~~~~~~~~~ kernel/sched/fair.c:5820:34: error: 'struct cfs_rq' has no member named 'throttled_csd_list'; did you mean 'throttled_list'? 5820 | throttled_csd_list) { | ^~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert' 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) | ^~~~ include/linux/container_of.h:20:9: note: in expansion of macro 'static_assert' 20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~~~ include/linux/container_of.h:21:23: note: in expansion of macro '__same_type' 21 | __same_type(*(ptr), void), \ | ^~~~~~~~~~~ include/linux/list.h:601:9: note: in expansion of macro 'container_of' 601 | container_of(ptr, type, member) | ^~~~~~~~~~~~ include/linux/list.h:645:9: note: in expansion of macro 'list_entry' 645 | list_entry((pos)->member.next, typeof(*(pos)), member) | ^~~~~~~~~~ include/linux/list.h:860:27: note: in expansion of macro 'list_next_entry' 860 | pos = n, n = list_next_entry(n, member)) | ^~~~~~~~~~~~~~~ kernel/sched/fair.c:5819:9: note: in expansion of macro 'list_for_each_entry_safe' 5819 | list_for_each_entry_safe(cfs_rq, tmp, &local_unthrottle, | ^~~~~~~~~~~~~~~~~~~~~~~~ >> include/linux/compiler_types.h:366:27: error: expression in static assertion is not an integer 366 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert' 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) | ^~~~ include/linux/container_of.h:20:9: note: in expansion of macro 'static_assert' 20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~~~ include/linux/container_of.h:20:23: note: in expansion of macro '__same_type' 20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~ include/linux/list.h:601:9: note: in expansion of macro 'container_of' 601 | container_of(ptr, type, member) | ^~~~~~~~~~~~ include/linux/list.h:645:9: note: in expansion of macro 'list_entry' 645 | list_entry((pos)->member.next, typeof(*(pos)), member) | ^~~~~~~~~~ include/linux/list.h:860:27: note: in expansion of macro 'list_next_entry' 860 | pos = n, n = list_next_entry(n, member)) | ^~~~~~~~~~~~~~~ kernel/sched/fair.c:5819:9: note: in expansion of macro 'list_for_each_entry_safe' 5819 | list_for_each_entry_safe(cfs_rq, tmp, &local_unthrottle, | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from include/uapi/linux/posix_types.h:5, from include/uapi/linux/types.h:14, from include/linux/types.h:6, from include/linux/limits.h:6, from include/linux/kernel.h:16, from include/linux/cpumask.h:10, from include/linux/energy_model.h:4, from kernel/sched/fair.c:23: kernel/sched/fair.c:5820:34: error: 'struct cfs_rq' has no member named 'throttled_csd_list'; did you mean 'throttled_list'? 5820 | throttled_csd_list) { | ^~~~~~~~~~~~~~~~~~ include/linux/stddef.h:16:58: note: in definition of macro 'offsetof' 16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER) | ^~~~~~ include/linux/list.h:601:9: note: in expansion of macro 'container_of' 601 | container_of(ptr, type, member) | ^~~~~~~~~~~~ include/linux/list.h:645:9: note: in expansion of macro 'list_entry' 645 | list_entry((pos)->member.next, typeof(*(pos)), member) | ^~~~~~~~~~ include/linux/list.h:860:27: note: in expansion of macro 'list_next_entry' 860 | pos = n, n = list_next_entry(n, member)) | ^~~~~~~~~~~~~~~ kernel/sched/fair.c:5819:9: note: in expansion of macro 'list_for_each_entry_safe' 5819 | list_for_each_entry_safe(cfs_rq, tmp, &local_unthrottle, | ^~~~~~~~~~~~~~~~~~~~~~~~ kernel/sched/fair.c:5825:40: error: 'struct cfs_rq' has no member named 'throttled_csd_list'; did you mean 'throttled_list'? 5825 | list_del_init(&cfs_rq->throttled_csd_list); | ^~~~~~~~~~~~~~~~~~ | throttled_list vim +366 include/linux/compiler_types.h eb111869301e15 Rasmus Villemoes 2019-09-13 364 d15155824c5014 Will Deacon 2017-10-24 365 /* Are two types/vars the same type (ignoring qualifiers)? */ d15155824c5014 Will Deacon 2017-10-24 @366 #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) d15155824c5014 Will Deacon 2017-10-24 367
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 384900bf87eb..509bc74262ad 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, @@ -5786,11 +5786,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; } @@ -5798,15 +5804,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; }