Re: [RFC PATCH v3 04/10] sched/core: Dont allow to use CPU marked as paravirt

From
K Prateek Nayak <kprateek.nayak@amd.com>
Date
2025-09-11 05:16:27
Also in
lkml
Reply to
Shrikanth Hegde, 2025-09-10
Hello Shrikanth,

On 9/10/2025 11:12 PM, Shrikanth Hegde wrote:
quoted hunk ↗ jump to hunk
@@ -2462,8 +2462,13 @@ static inline bool is_cpu_allowed(struct task_struct *p, int cpu)
 		return cpu_online(cpu);
 
 	/* Non kernel threads are not allowed during either online or offline. */
-	if (!(p->flags & PF_KTHREAD))
-		return cpu_active(cpu);
+	if (!(p->flags & PF_KTHREAD)) {
+		/* A user thread shouldn't be allowed on a paravirt cpu */
+		if (is_cpu_paravirt(cpu))
+			return false;
+		else
nit. redundant "else". I think this can be simplified as:

    return !is_cpu_paravirt(cpu) && cpu_active(cpu);
+			return cpu_active(cpu);
+	}
-- 
Thanks and Regards,
Prateek

Thread (33 messages) 33 messages, 5 authors, last reply 2025-11-10
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help