mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Harshit Agarwal" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Harshit Agarwal <harshit@nutanix.com>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Phil Auld <pauld@redhat.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: sched/core] sched: add READ_ONCE to task_on_rq_queued
Date: Mon, 02 Dec 2024 11:14:44 -0000	[thread overview]
Message-ID: <173313808465.412.17164013847284294134.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20241114210812.1836587-1-jon@nutanix.com>

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     59297e2093ceced86393a059a4bd36802311f7bb
Gitweb:        https://git.kernel.org/tip/59297e2093ceced86393a059a4bd36802311f7bb
Author:        Harshit Agarwal <harshit@nutanix.com>
AuthorDate:    Thu, 14 Nov 2024 14:08:11 -07:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Mon, 02 Dec 2024 12:01:30 +01:00

sched: add READ_ONCE to task_on_rq_queued

task_on_rq_queued read p->on_rq without READ_ONCE, though p->on_rq is
set with WRITE_ONCE in {activate|deactivate}_task and smp_store_release
in __block_task, and also read with READ_ONCE in task_on_rq_migrating.

Make all of these accesses pair together by adding READ_ONCE in the
task_on_rq_queued.

Signed-off-by: Harshit Agarwal <harshit@nutanix.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Phil Auld <pauld@redhat.com>
Link: https://lkml.kernel.org/r/20241114210812.1836587-1-jon@nutanix.com
---
 kernel/sched/sched.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 76f5f53..0f6790c 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -2271,7 +2271,7 @@ static inline int task_on_cpu(struct rq *rq, struct task_struct *p)
 
 static inline int task_on_rq_queued(struct task_struct *p)
 {
-	return p->on_rq == TASK_ON_RQ_QUEUED;
+	return READ_ONCE(p->on_rq) == TASK_ON_RQ_QUEUED;
 }
 
 static inline int task_on_rq_migrating(struct task_struct *p)

      parent reply	other threads:[~2024-12-02 11:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-14 21:08 [PATCH v2] " Jon Kohler
2024-11-15  9:50 ` Peter Zijlstra
2024-12-02 11:14 ` tip-bot2 for Harshit Agarwal [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=173313808465.412.17164013847284294134.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=harshit@nutanix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=pauld@redhat.com \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®