Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2572063imm; Mon, 10 Sep 2018 03:19:07 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYF2VOtQpO1yQdU/yGHhSTk9hlm4H/frzgkh//ud+LAQfPVuD0Zej/WKUqJBR0V8BACMvC+ X-Received: by 2002:a17:902:768c:: with SMTP id m12-v6mr13730174pll.56.1536574747658; Mon, 10 Sep 2018 03:19:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536574747; cv=none; d=google.com; s=arc-20160816; b=hJNbzXruBITtxliD5tA9cKSp0sHhke198XTzeew/limaxEZ1QPr38tT3EE4l627gV+ eyNuVodw7qRO9PgssxkYbcBXet3ySKmm9mxD6SY5XtYQJQJAckAqhzcF9P9Rg6+gATQd TYJw4+bNxSZyIyBOoaIjLCmO/OaOniA86NgEXNzeeZk8km6SxVoIh2PAH2C8dWSw0SvG kvFvIH+t46mzodgpTwdPTi0HD3iLJBXmTEix8dRkUbwjFp6iKcGNgwFqQwAikUh1cqUh wWZqZSviE6Gh6wCAzqGwjpumv76rhj9i1QiHYjFo12I4OjM+WYDiwS0XxUAwm0/s3OKr iaPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=jcMrjqW5Rz+Gr7t3H5E/fivmSN56IS+Z2pZrK86QWwk=; b=bS3xXg+dMtQn9KDSJ4RnS/BB6lHzqrc75qCNzDEdI2e+iAnrMyloJm3RtPnhshTCtQ VSRCC2pxQwP+0MOkXluBODRdqvhDk6Xj9FOiLey9ncKxBbpN6MyZHnGSWl2Lzt6Y+HHl hXmOkvV0RXgw/QbpSwHUyz+M3f2o9K3WpWqGa62zcuAvoYFCkeoZ6ZIAdxD+WTQpjJH8 PULMVEmfHWKik6jGIpS/0G4+MmGoauC5Yxs1uzng++Js5Ill6rfzAk9talkrZp7bT7S4 iidvHRLgq97YTA9D6oP/VJST6V3p7OT9uNh7ygcA/ODf0nRmq4NaUolelKPBrLR3TGF/ J/CA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d11-v6si16549795plo.91.2018.09.10.03.18.51; Mon, 10 Sep 2018 03:19:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728121AbeIJPKr (ORCPT + 99 others); Mon, 10 Sep 2018 11:10:47 -0400 Received: from terminus.zytor.com ([198.137.202.136]:40305 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726738AbeIJPKq (ORCPT ); Mon, 10 Sep 2018 11:10:46 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w8AAH4KZ1808323 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 10 Sep 2018 03:17:04 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w8AAH41p1808320; Mon, 10 Sep 2018 03:17:04 -0700 Date: Mon, 10 Sep 2018 03:17:04 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Valentin Schneider Message-ID: Cc: tglx@linutronix.de, torvalds@linux-foundation.org, hpa@zytor.com, morten.rasmussen@arm.com, valentin.schneider@arm.com, peterz@infradead.org, linux-kernel@vger.kernel.org, mingo@kernel.org Reply-To: morten.rasmussen@arm.com, mingo@kernel.org, linux-kernel@vger.kernel.org, peterz@infradead.org, valentin.schneider@arm.com, tglx@linutronix.de, hpa@zytor.com, torvalds@linux-foundation.org In-Reply-To: <1530699470-29808-9-git-send-email-morten.rasmussen@arm.com> References: <1530699470-29808-9-git-send-email-morten.rasmussen@arm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/fair: Wrap rq->rd->overload accesses with READ/WRITE_ONCE() Git-Commit-ID: e90c8fe15a3bf93a23088bcf1a56a0fa391d4e50 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: e90c8fe15a3bf93a23088bcf1a56a0fa391d4e50 Gitweb: https://git.kernel.org/tip/e90c8fe15a3bf93a23088bcf1a56a0fa391d4e50 Author: Valentin Schneider AuthorDate: Wed, 4 Jul 2018 11:17:46 +0100 Committer: Ingo Molnar CommitDate: Mon, 10 Sep 2018 11:05:52 +0200 sched/fair: Wrap rq->rd->overload accesses with READ/WRITE_ONCE() This variable can be read and set locklessly within update_sd_lb_stats(). As such, READ/WRITE_ONCE() are added to make sure nothing terribly wrong can happen because of the compiler. Signed-off-by: Valentin Schneider Signed-off-by: Morten Rasmussen Signed-off-by: Peter Zijlstra (Intel) Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: dietmar.eggemann@arm.com Cc: gaku.inami.xh@renesas.com Cc: vincent.guittot@linaro.org Link: http://lkml.kernel.org/r/1530699470-29808-9-git-send-email-morten.rasmussen@arm.com Signed-off-by: Ingo Molnar --- kernel/sched/fair.c | 6 +++--- kernel/sched/sched.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 23017939ecab..d9c4e97bfebd 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8058,8 +8058,8 @@ next_group: if (!env->sd->parent) { /* update overload indicator if we are at root domain */ - if (env->dst_rq->rd->overload != overload) - env->dst_rq->rd->overload = overload; + if (READ_ONCE(env->dst_rq->rd->overload) != overload) + WRITE_ONCE(env->dst_rq->rd->overload, overload); } } @@ -9502,7 +9502,7 @@ static int idle_balance(struct rq *this_rq, struct rq_flags *rf) rq_unpin_lock(this_rq, rf); if (this_rq->avg_idle < sysctl_sched_migration_cost || - !this_rq->rd->overload) { + !READ_ONCE(this_rq->rd->overload)) { rcu_read_lock(); sd = rcu_dereference_check_sched_domain(this_rq->sd); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 4d181478c5b8..938063639793 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1697,8 +1697,8 @@ static inline void add_nr_running(struct rq *rq, unsigned count) if (prev_nr < 2 && rq->nr_running >= 2) { #ifdef CONFIG_SMP - if (!rq->rd->overload) - rq->rd->overload = 1; + if (!READ_ONCE(rq->rd->overload)) + WRITE_ONCE(rq->rd->overload, 1); #endif }