From mboxrd@z Thu Jan 1 00:00:00 1970 From: adam8157@gmail.com (Adam Lee) Date: Wed, 20 Feb 2013 11:35:42 +0800 Subject: cpu_relax(), rep: nop, and PAUSE In-Reply-To: References: Message-ID: <20130220033542.GA9926@adam-laptop> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Tue, Feb 19, 2013 at 02:20:11PM +0200, David Shwatrz wrote: > Hi, kernel newbies, > > We have: > #define cpu_relax() asm volatile("rep; nop") > in arch/x86/boot/boot.h. > > Why don't we use the PAUSE assembler instruction here ? But rep_nop and pause ought to be the same, why we change it? "If it ain't broke, don't fix it." You can see that by disassembling, they both are "f3 90", "f3" is rep, "90" is nop. > And AFAIK, in spinlocks , PAUSE indeed replaced the rep;nop. Where? I haven't found that. -- Regards, Adam Lee http://adam8157.info