Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp336777lqh; Thu, 28 Mar 2024 03:47:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXxYlRHdvZp4k5nsqb94KbZb/5VoP2dP/ivIrLEX21weqFJeV4OQBBwLmoCJ9ocLOI3b+ECE2aSvGdMs0MzDYCx+pTL03MMWEE89/HHNg== X-Google-Smtp-Source: AGHT+IFtI6kaPrI1t0m6QcOQmDsGca2Dcvl8dcIQltxzw/T6UqU4n10KAAEfq2P/mIQJYiHSKTJu X-Received: by 2002:a05:6808:24f:b0:3c3:74fb:18e6 with SMTP id m15-20020a056808024f00b003c374fb18e6mr2394200oie.49.1711622874605; Thu, 28 Mar 2024 03:47:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711622874; cv=pass; d=google.com; s=arc-20160816; b=yqTlcgsKOCPZeGnVnbHGCzLkQFNJN4FjlkJhncRLD2vg6YyPPQDyubtG7IOc39CmJn WGtT8wsxwqPm0Uf7TE6H5ZTbwUrEIjoYVgaWzHct9Bx7XWPVWwT4gBrFFL15YWTG2cgN sS92FxhmrmaGhb63VLxz9tNpTlhSOhS4bD6mstMNxFHywqbB645/ftFUA6OXRoXSUtdz YuQ/Ipm4B3o9BIpwnFckYgaR4vHDgRFN18IsDRtcbfpDKldnz2BGrBb40I7MFdIKcexm NY6OQe5olGXqHwYlnhyDmiAPI5Xdc2t82KAEHvHcUCrb/XTnQE59m8sYaA4qHpWh8UOT HpVA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=wwgDV4oV1M7lwRW7xJmWs3ZsANnNq1v+IZybUanyPQ4=; fh=eNMzRYp32ghhzSuHFJf+u7VrSOE3hEiuQpEr36v54AY=; b=X1vr/Pu+MPmz56L6kZ1CBTPwqz2dGqjTrKyFOBLhcarUYER7xKdmyuolbSHjH7mwrN m4iKYu7LczzhWn9ePQo55zSP7VmpPY0d5nGuvpmQWlc37c+QuqdtsD0d9WoxEd7kE+SW 41T2281qyyK82nJU+kWbXJritcNVtqtzbYm7Sw6UO+pO4iA7l6+Aoac1VcU+Budlkqr5 OyJI3xpvSSQQYj/tpb3wN/tMF6P2OUS7vm11K/hRZT6Z3dhpCi/c8NxPRIGtkmBwQDUo ysRTZZ/B0BoNoWSr8EQX/T/d9ZyGfKlB9LrlAnQOYHx2dYvI29PgcjYN0W7A+zWhWOpM tCpQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=oEk4sk8o; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=C4fBBf7S; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-122793-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122793-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d3-20020a05622a100300b004310a041b3esi1057065qte.406.2024.03.28.03.47.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 03:47:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-122793-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=oEk4sk8o; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=C4fBBf7S; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-122793-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122793-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 77EF91C23A87 for ; Thu, 28 Mar 2024 10:47:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 836CF7D3FE; Thu, 28 Mar 2024 10:47:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="oEk4sk8o"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="C4fBBf7S" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1481754737; Thu, 28 Mar 2024 10:47:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711622859; cv=none; b=Qs20FZ3ZA8sBp9mlFDfEZs1ykzMpfk7aExa4DOoB4oa81iB2uFyn5Lxr5jYGhsc20tXhLJi0VFs3OR/BI/oaQnCggHzeNppZWiPJZxkeLQUnsncPfUVkINu32Ph+b9AGGuhtUhlfT5HwjXdme97aAOO5wpvCvOEPFptUhbvdxok= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711622859; c=relaxed/simple; bh=2vQco+yJ0y/o5C/0p+dH62rurW30gI6ZQUTv0qzcj+s=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=j1/gFDu4eivqAhwbvL1RirOXjyG4KxC7l3MQ5nLKNz/J9U4A86gj6v0xyw8h+5vdJ3fvJ/pY9hZffo4bgOeV69uyqvwBqnaNl9wrmHf33opr/HSfFwbi3TzknE7lvHJezaqAn0TLN8T5ds15rDiAoEj4MCtu/8aZYSMhNWbyJv8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=oEk4sk8o; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=C4fBBf7S; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Thu, 28 Mar 2024 10:47:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1711622856; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wwgDV4oV1M7lwRW7xJmWs3ZsANnNq1v+IZybUanyPQ4=; b=oEk4sk8o1U0+RyIGXg5jLOAcUsC2G8O0gTwSysnpxKWmKgZzy8i9saXifSXOryPkjfZy0i UOYI2Zo314f3NfmjYy6n2weZMwP6dk62wPS5jVqsoQl800dKkcOSmvYzsoRjb9yv67OZyw dBpB9pDY8wLTQO/4DrliWEksg6tugyutKbyVNN6tiw3dbJDmUKHzb/t2+svixn7YYnAhEb XcrOP/OVD16QkjBEPq7LfKY8GRBCbrDn4B2iiGuiosC15I7g6GLQBG1ndEOk+t9Jz2Zl9E 2csBX9N3AzSpMwu2v8SBxcrB41Fl+w1NTRfgxjCxgAastdk2EPVNS/8dph4VUQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1711622856; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wwgDV4oV1M7lwRW7xJmWs3ZsANnNq1v+IZybUanyPQ4=; b=C4fBBf7S6ALnOdCssbKAoK/Qg+gLLFjT/7Pb/riLuL/zJL6nf3FiOSzwa2yGv0KQYTQ5qr oIM5Op2Tga6KIyCA== From: "tip-bot2 for Shrikanth Hegde" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/fair: Use helper functions to access root_domain::overload Cc: Qais Yousef , Shrikanth Hegde , Ingo Molnar , Vincent Guittot , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240325054505.201995-3-sshegde@linux.ibm.com> References: <20240325054505.201995-3-sshegde@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171162285539.10875.9756096436718882314.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the sched/core branch of tip: Commit-ID: caac6291728ed5493d8a53f4b086c270849ce0c4 Gitweb: https://git.kernel.org/tip/caac6291728ed5493d8a53f4b086c270849ce0c4 Author: Shrikanth Hegde AuthorDate: Mon, 25 Mar 2024 11:15:05 +05:30 Committer: Ingo Molnar CommitterDate: Thu, 28 Mar 2024 11:30:13 +01:00 sched/fair: Use helper functions to access root_domain::overload Introduce two helper functions to access & set the root_domain::overload flag: get_rd_overload() set_rd_overload() To make sure code is always following READ_ONCE()/WRITE_ONCE() access methods. No change in functionality intended. [ mingo: Renamed the accessors to get_/set_rd_overload(), tidied up the changelog. ] Suggested-by: Qais Yousef Signed-off-by: Shrikanth Hegde Signed-off-by: Ingo Molnar Reviewed-by: Qais Yousef Reviewed-by: Vincent Guittot Link: https://lore.kernel.org/r/20240325054505.201995-3-sshegde@linux.ibm.com --- kernel/sched/fair.c | 5 ++--- kernel/sched/sched.h | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 600fdde..0cc0582 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -10657,8 +10657,7 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd if (!env->sd->parent) { /* update overload indicator if we are at root domain */ - if (READ_ONCE(env->dst_rq->rd->overload) != (sg_status & SG_OVERLOAD)) - WRITE_ONCE(env->dst_rq->rd->overload, sg_status & SG_OVERLOAD); + set_rd_overload(env->dst_rq->rd, sg_status & SG_OVERLOAD); /* Update over-utilization (tipping point, U >= 0) indicator */ set_rd_overutilized_status(env->dst_rq->rd, @@ -12391,7 +12390,7 @@ static int sched_balance_newidle(struct rq *this_rq, struct rq_flags *rf) rcu_read_lock(); sd = rcu_dereference_check_sched_domain(this_rq->sd); - if (!READ_ONCE(this_rq->rd->overload) || + if (!get_rd_overload(this_rq->rd) || (sd && this_rq->avg_idle < sd->max_newidle_lb_cost)) { if (sd) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 4f9e952..e86ee26 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -930,6 +930,17 @@ extern void rq_attach_root(struct rq *rq, struct root_domain *rd); extern void sched_get_rd(struct root_domain *rd); extern void sched_put_rd(struct root_domain *rd); +static inline int get_rd_overload(struct root_domain *rd) +{ + return READ_ONCE(rd->overload); +} + +static inline void set_rd_overload(struct root_domain *rd, int status) +{ + if (get_rd_overload(rd) != status) + WRITE_ONCE(rd->overload, status); +} + #ifdef HAVE_RT_PUSH_IPI extern void rto_push_irq_work_func(struct irq_work *work); #endif @@ -2530,8 +2541,7 @@ static inline void add_nr_running(struct rq *rq, unsigned count) #ifdef CONFIG_SMP if (prev_nr < 2 && rq->nr_running >= 2) { - if (!READ_ONCE(rq->rd->overload)) - WRITE_ONCE(rq->rd->overload, 1); + set_rd_overload(rq->rd, SG_OVERLOAD); } #endif