From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 22C2A175D3E for ; Mon, 12 Aug 2024 12:14:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723464874; cv=none; b=C9ztteFSi2q2LCJfkpjGz8KEzm9ICGxy19f4oMSR0UpeovifNJOqpkhNXRFVrhafZ/vl4gKgXmOOJ7EefDZ5VCi47jKSVWxZdfHZUDmQ6GnWhX4jXbolrwk6UpMKRfoBSmJ2Di4KOHSqvnTaI+G6DedHEoR3D+KO3i9V19tr3X0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723464874; c=relaxed/simple; bh=0IciOj3aL9t3bh/S/8r4lIZhcYwsqzv8e4St3DWK7cM=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=V0HaUzw4U9WcTIc8enri8ewqs6id85s+X2GBeXv1T4Oe6IPjg5FkL2toBEFntJxbVClsK3r2FzpRngHQY9jGjJwLHhSto9+/1cKlfDJmugOhEjvEm3kHB0uDZBWDisNqPrO8UEKA7nmkDZd6XATRzknJlpvkWdWhnoVAsrmdGjU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=CD3NB9RQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="CD3NB9RQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DC5BC32782; Mon, 12 Aug 2024 12:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1723464874; bh=0IciOj3aL9t3bh/S/8r4lIZhcYwsqzv8e4St3DWK7cM=; h=Subject:To:Cc:From:Date:From; b=CD3NB9RQ/tpxkEWTx5RWjdtUU2ZagcXarmzhiZb9M5OrZm86LM+vFr40j+rDaqYfr MJegRv73OREF5wfQ112UCS76/4B369AIyoC/fTx0hiJroK8xAcfvJV4h1pxLfXtNps l1azgVN7nqKLrW2DCU+7YMSxB7Xbkc5H7Vj8yG1U= Subject: FAILED: patch "[PATCH] sched/core: Introduce sched_set_rq_on/offline() helper" failed to apply to 5.15-stable tree To: yangyingliang@huawei.com,peterz@infradead.org Cc: From: Date: Mon, 12 Aug 2024 14:14:20 +0200 Message-ID: <2024081219-gloating-stinging-278a@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.15-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y git checkout FETCH_HEAD git cherry-pick -x 2f027354122f58ee846468a6f6b48672fff92e9b # git commit -s git send-email --to '' --in-reply-to '2024081219-gloating-stinging-278a@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^.. Possible dependencies: 2f027354122f ("sched/core: Introduce sched_set_rq_on/offline() helper") cab3ecaed5cd ("sched/core: Fixed missing rq clock update before calling set_rq_offline()") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 2f027354122f58ee846468a6f6b48672fff92e9b Mon Sep 17 00:00:00 2001 From: Yang Yingliang Date: Wed, 3 Jul 2024 11:16:09 +0800 Subject: [PATCH] sched/core: Introduce sched_set_rq_on/offline() helper Introduce sched_set_rq_on/offline() helper, so it can be called in normal or error path simply. No functional changed. Cc: stable@kernel.org Signed-off-by: Yang Yingliang Signed-off-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20240703031610.587047-4-yangyingliang@huaweicloud.com diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 949473e414f9..4d119e930beb 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -7845,6 +7845,30 @@ void set_rq_offline(struct rq *rq) } } +static inline void sched_set_rq_online(struct rq *rq, int cpu) +{ + struct rq_flags rf; + + rq_lock_irqsave(rq, &rf); + if (rq->rd) { + BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span)); + set_rq_online(rq); + } + rq_unlock_irqrestore(rq, &rf); +} + +static inline void sched_set_rq_offline(struct rq *rq, int cpu) +{ + struct rq_flags rf; + + rq_lock_irqsave(rq, &rf); + if (rq->rd) { + BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span)); + set_rq_offline(rq); + } + rq_unlock_irqrestore(rq, &rf); +} + /* * used to mark begin/end of suspend/resume: */ @@ -7914,7 +7938,6 @@ static inline void sched_smt_present_dec(int cpu) int sched_cpu_activate(unsigned int cpu) { struct rq *rq = cpu_rq(cpu); - struct rq_flags rf; /* * Clear the balance_push callback and prepare to schedule @@ -7943,12 +7966,7 @@ int sched_cpu_activate(unsigned int cpu) * 2) At runtime, if cpuset_cpu_active() fails to rebuild the * domains. */ - rq_lock_irqsave(rq, &rf); - if (rq->rd) { - BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span)); - set_rq_online(rq); - } - rq_unlock_irqrestore(rq, &rf); + sched_set_rq_online(rq, cpu); return 0; } @@ -7956,7 +7974,6 @@ int sched_cpu_activate(unsigned int cpu) int sched_cpu_deactivate(unsigned int cpu) { struct rq *rq = cpu_rq(cpu); - struct rq_flags rf; int ret; /* @@ -7987,12 +8004,7 @@ int sched_cpu_deactivate(unsigned int cpu) */ synchronize_rcu(); - rq_lock_irqsave(rq, &rf); - if (rq->rd) { - BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span)); - set_rq_offline(rq); - } - rq_unlock_irqrestore(rq, &rf); + sched_set_rq_offline(rq, cpu); /* * When going down, decrement the number of cores with SMT present.