lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 7 Oct 2014 21:50:46 +0200
From:	Oleg Nesterov <>
To:	Ingo Molnar <>,
	Peter Zijlstra <>
Cc:	Steven Rostedt <>,
Subject: [PATCH 0/1] sched: fix the PREEMPT_ACTIVE check in

And note that another caller of task_preempt_count(), set_cpu(), is
fine but it doesn't really need this helper.

And afaics we do not need ->saved_preempt_count at all, the trivial
patch below makes it unnecessary, we can kill it and all its users.

Not only this will simplify the code, this will make (well, almost)
the per-cpu preempt counter arch-agnostic.

Or I missed something?

Do you think this makes sense? If yes, I'll try to make the patches.


I mean.

(this depends on !__ARCH_WANT_UNLOCKED_CTXSW, but it was already removed
 and x86 doesn't use it anyway).

--- x/kernel/sched/core.c
+++ x/kernel/sched/core.c
@@ -2279,6 +2279,7 @@ asmlinkage __visible void schedule_tail(struct task_struct *prev)
 	struct rq *rq = this_rq();
+	preempt_count_set(PREEMPT_DISABLED);
 	finish_task_switch(rq, prev);
@@ -2304,6 +2305,7 @@ context_switch(struct rq *rq, struct task_struct *prev,
 	       struct task_struct *next)
 	struct mm_struct *mm, *oldmm;
+	int pc;
 	prepare_task_switch(rq, prev, next);
@@ -2338,10 +2340,13 @@ context_switch(struct rq *rq, struct task_struct *prev,
 	context_tracking_task_switch(prev, next);
 	/* Here we just switch the register state and the stack. */
+	pc = this_cpu_read(__preempt_count);
 	switch_to(prev, next, prev);
+	preempt_count_set(pc);
 	 * this_rq must be evaluated again because prev may have moved
 	 * CPUs since it called schedule(), thus the 'rq' on its stack

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists