From: | Tsutomu Yamada <tsutomu(at)sraoss(dot)co(dot)jp> |
---|---|
To: | Magnus Hagander <magnus(at)hagander(dot)net> |
Cc: | Tsutomu Yamada <tsutomu(at)sraoss(dot)co(dot)jp>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [PATCH] Windows x64 [repost] |
Date: | 2010-01-05 08:14:23 |
Message-ID: | 23248.1262679263@srapc2360.sra.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> On Fri, Jan 1, 2010 at 20:45, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> > On Fri, Dec 4, 2009 at 11:42, Tsutomu Yamada <tsutomu(at)sraoss(dot)co(dot)jp> wrote:
> >>
> >> 2) use appropriate macro and datatypes for Windows API.
> >> enables more than 32bits shared memory.
> >
> > Are you sure this one should use __noop, and not __nop?
> >
> > __noop: http://msdn.microsoft.com/en-us/library/s6btaxcs.aspx
> > __nop: http://msdn.microsoft.com/en-us/library/aa983381.aspx
> >
> > I think __nop is what we want?
> >
> > Also, that turns it into "nop" and not "rep nop", no?
>
> I did some more research, and __nop() is at least closer than
> __noop(), but it's still not the same.
>
>
> > Should we perhaps instead use __yield, per:
> > http://msdn.microsoft.com/en-us/library/2b2h26kx.aspx
>
> On further reading, __yield() is only available on Itanium.
This spinlock code was came from below.
http://archives.postgresql.org/pgsql-hackers/2008-07/msg00307.php
Sorry, I didn't care which macro was better.
I found 'YieldProcessor' in MSDN.
http://msdn.microsoft.com/en-us/library/ms687419%28VS.85%29.aspx
YieldProcessor was defined in "winnt.h".
The definition changes depending on architecture and compiler version.
__asm { rep nop };
__mm_pause();
__yield();
YieldProcessor become "__mm_pause()" in _AMD64_.
So "__mm_pause()" is better?
// test program
#include <windows.h>
main()
{
YieldProcessor();
}
// end
// cl /E test.c > out.i
// tail out.i
// # I recommend redirecting to file, The output become large.
Tsutomu Yamada
SRA OSS, Inc. Japan
From | Date | Subject | |
---|---|---|---|
Next Message | Stefan Kaltenbrunner | 2010-01-05 08:26:13 | tribble.postgresql.org - planned maintenance downtime |
Previous Message | Oleg Bartunov | 2010-01-05 08:11:42 | Re: KNNGiST for knn-search (WIP) |