Skip to contentSkip to conversation

__down_common: use signal_pending_state()

PATCH Applied Oleg Nesterov 3 participants 5 messages Jun 4, 2008 – Jun 9, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 __down_common: use signal_pending_state()

Cleanup. __down_common() can use the new signal_pending_state() helper.

kernel/semaphore.c renamed from kernel/semaphore.c~2_SEM_USE_HELPER +1 -3
@@ -211,9 +211,7 @@ static inline int __sched __down_common(
 	waiter.up = 0;
 
 	for (;;) {
-		if (state == TASK_INTERRUPTIBLE && signal_pending(task))
-			goto interrupted;
-		if (state == TASK_KILLABLE && fatal_signal_pending(task))
+		if (signal_pending_state(state, task))
 			goto interrupted;
 		if (timeout <= 0)
 			goto timed_out;
#1 lore raw
Quoted 1 line · Oleg Nesterov

Cleanup. __down_common() can use the new signal_pending_state() helper.

This is a bad optimisation. __down_common gets inlined and the constant 'state' versions are optimised away for the versions which don't apply.

NAK this patch.

Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
#2 lore raw
Quoted 8 lines · Matthew Wilcox
Quoted 1 line · Oleg Nesterov

Cleanup. __down_common() can use the new signal_pending_state() helper.

This is a bad optimisation. __down_common gets inlined and the constant 'state' versions are optimised away for the versions which don't apply.

NAK this patch.

OK.

But this was not optimisation, just code re-use.

Actually, I don't understand why __down_common/__mutex_lock_common are inlines, perhaps it is better to shrink .text instead.

For example, "size kernel/mutex.o" reports

	2715       0      12    2727     aa7 kernel/mutex.o

with __mutex_lock_common() uninlined, we have

	1565       0      12    1577     629 kernel/mutex.o

the difference is more than K.

Oleg.

#3 lore raw
Quoted 2 lines · Oleg Nesterov

Actually, I don't understand why __down_common/__mutex_lock_common are inlines, perhaps it is better to shrink .text instead.

I believe Ingo did extensive benchmarking to determine that the current situation with mutex_lock_common is the best one. I didn't, I assumed that following Ingo's lead would be the best idea.

Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
#4 lore raw
In reply to Matthew Wilcox
Quoted 8 lines · Matthew Wilcox
Quoted 1 line · Oleg Nesterov

Cleanup. __down_common() can use the new signal_pending_state() helper.

This is a bad optimisation. __down_common gets inlined and the constant 'state' versions are optimised away for the versions which don't apply.

NAK this patch.

well but we had a schedule() bug around this whole topic of TASK_KILLABLE, so i'd say robustness trumps micro-optimizations. Is this really a big issue? The dual-ness of TASK_KILLABLE checks is a bit ugly, and it led to a bug as well.

Ingo