x86: optimize lock prefix switching to run less frequently