Skip to contentSkip to conversation

x86-64 TIF flags for debug regs and io bitmap in ctxsw

PATCH Mikael Pettersson 2 participants 2 messages Jul 4, 2006

lore
Share & tools
lore
#0 lore raw
Quoted 11 lines · Stephane Eranian
Quoted 10 lines · Arjan van de Ven

Review

Quoted 5 lines
(quoted diff) +3 -2
-		}
-	}
+	if (unlikely((task_thread_info(next_p)->flags & _TIF_WORK_CTXSW))
+	    || test_tsk_thread_flag(prev_p, TIF_IO_BITMAP))
+		__switch_to_xtra(prev_p, next_p, tss);

well isn't this replacing an if() (which isn't cheap but also not expensive, due to unlikely()) with an atomic operation (which *is* expensive) ?

Quoted 2 lines

Andi is right. I double checked the test_tsk_thread_flag() and it does not use atomic ops.

The test_tsk_thread_flag() does not, but what about all the other places in the patch where currently unsychronised loads or stores of ->io_bitmap_ptr or ->debugreg7 get replaced or extended with locked-on-SMP {set,clear}_{tsk_,}thread_flag() operations?

They should all just be plain C bitops (&, |, ^, etc).

#1 lore raw
Quoted 12 lines · Mikael Pettersson
Quoted 11 lines · Stephane Eranian
Quoted 10 lines · Arjan van de Ven

Review

Quoted 5 lines
(quoted diff) +3 -2
-		}
-	}
+	if (unlikely((task_thread_info(next_p)->flags & _TIF_WORK_CTXSW))
+	    || test_tsk_thread_flag(prev_p, TIF_IO_BITMAP))
+		__switch_to_xtra(prev_p, next_p, tss);

well isn't this replacing an if() (which isn't cheap but also not expensive, due to unlikely()) with an atomic operation (which *is* expensive) ?

Quoted 8 lines
Quoted 2 lines

Andi is right. I double checked the test_tsk_thread_flag() and it does not use atomic ops.

The test_tsk_thread_flag() does not, but what about all the other places in the patch where currently unsychronised loads or stores of ->io_bitmap_ptr or ->debugreg7 get replaced or extended with locked-on-SMP {set,clear}_{tsk_,}thread_flag() operations?

They are all slow paths where it doesn't matter.

-Andi