X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 630E5D1DA3C for ; Wed, 21 Apr 2004 17:47:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 31545-05 for ; Wed, 21 Apr 2004 17:46:59 -0300 (ADT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 72A8BD1D8BF for ; Wed, 21 Apr 2004 17:46:57 -0300 (ADT) Received: (qmail 22072 invoked from network); 21 Apr 2004 20:46:51 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 21 Apr 2004 20:46:51 -0000 Subject: Re: Wierd context-switching issue on Xeon patch for 7.4.1 From: Dave Cramer Reply-To: pg@fastcrypt.com To: Paul Tuckfield Cc: Anjan Dave , Josh Berkus , Neil Conway , Dirk =?ISO-8859-1?Q?Lutzeb=E4ck?= , pgsql-performance@postgresql.org, Tom Lane In-Reply-To: <1082574808.1558.243.camel@localhost.localdomain> References: <4BAFBB6B9CC46F41B2AD7D9F4BBAF78509814A@vt-pe2550-001.vantage.vantage.com> <200404200959.52813.josh@agliodbs.com> <1082515263.1558.214.camel@localhost.localdomain> <78427208-93C0-11D8-BA67-000393BD6C3E@tuckfield.com> <1082574808.1558.243.camel@localhost.localdomain> Content-Type: multipart/mixed; boundary="=-sFlYaGnQ+RAFjH6Z5gg/" Organization: Cramer Consulting Message-Id: <1082580588.13371.260.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Wed, 21 Apr 2004 16:49:48 -0400 X-AntiVirus: scanned for viruses by AMaViS 0.2.1 (http://amavis.org/) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200404/364 X-Sequence-Number: 6664 --=-sFlYaGnQ+RAFjH6Z5gg/ Content-Type: text/plain Content-Transfer-Encoding: 7bit attached. -- Dave Cramer 519 939 0336 ICQ # 14675561 --=-sFlYaGnQ+RAFjH6Z5gg/ Content-Disposition: attachment; filename=spinlock.patch Content-Type: text/x-patch; name=spinlock.patch; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Index: backend/storage/lmgr/s_lock.c =================================================================== RCS file: /usr/local/cvs/pgsql-server/src/backend/storage/lmgr/s_lock.c,v retrieving revision 1.16 diff -c -r1.16 s_lock.c *** backend/storage/lmgr/s_lock.c 8 Aug 2003 21:42:00 -0000 1.16 --- backend/storage/lmgr/s_lock.c 21 Apr 2004 20:27:34 -0000 *************** *** 76,82 **** * The select() delays are measured in centiseconds (0.01 sec) because 10 * msec is a common resolution limit at the OS level. */ ! #define SPINS_PER_DELAY 100 #define NUM_DELAYS 1000 #define MIN_DELAY_CSEC 1 #define MAX_DELAY_CSEC 100 --- 76,82 ---- * The select() delays are measured in centiseconds (0.01 sec) because 10 * msec is a common resolution limit at the OS level. */ ! #define SPINS_PER_DELAY 10 #define NUM_DELAYS 1000 #define MIN_DELAY_CSEC 1 #define MAX_DELAY_CSEC 100 *************** *** 88,93 **** --- 88,94 ---- while (TAS(lock)) { + __asm__ __volatile__ ( "rep;nop": : :"memory"); if (++spins > SPINS_PER_DELAY) { if (++delays > NUM_DELAYS) Index: include/storage/s_lock.h =================================================================== RCS file: /usr/local/cvs/pgsql-server/src/include/storage/s_lock.h,v retrieving revision 1.115.2.1 diff -c -r1.115.2.1 s_lock.h *** include/storage/s_lock.h 4 Nov 2003 09:43:56 -0000 1.115.2.1 --- include/storage/s_lock.h 21 Apr 2004 20:26:25 -0000 *************** *** 103,110 **** register slock_t _res = 1; __asm__ __volatile__( ! " lock \n" " xchgb %0,%1 \n" : "=q"(_res), "=m"(*lock) : "0"(_res)); return (int) _res; --- 103,113 ---- register slock_t _res = 1; __asm__ __volatile__( ! " cmpb $0,%1 \n" ! " jne 1f \n" ! " lock \n" " xchgb %0,%1 \n" + " 1:\n" : "=q"(_res), "=m"(*lock) : "0"(_res)); return (int) _res; --=-sFlYaGnQ+RAFjH6Z5gg/--