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 44F0FD1D2AA for ; Wed, 21 Apr 2004 15:51:37 -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 82348-09 for ; Wed, 21 Apr 2004 15:51:36 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 53100D1D26C for ; Wed, 21 Apr 2004 15:51:34 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i3LIpV4g014265; Wed, 21 Apr 2004 14:51:31 -0400 (EDT) To: Paul Tuckfield Cc: pg@fastcrypt.com, Anjan Dave , Josh Berkus , Neil Conway , =?ISO-8859-1?Q?Dirk_Lutzeb=E4ck?= , pgsql-performance@postgresql.org Subject: Re: Wierd context-switching issue on Xeon In-reply-to: <78427208-93C0-11D8-BA67-000393BD6C3E@tuckfield.com> 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> Comments: In-reply-to Paul Tuckfield message dated "Wed, 21 Apr 2004 11:19:46 -0700" Date: Wed, 21 Apr 2004 14:51:31 -0400 Message-ID: <14264.1082573491@sss.pgh.pa.us> From: Tom Lane 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/359 X-Sequence-Number: 6659 Paul Tuckfield writes: > I wonder do the threads stall so badly when pinging cache lines back > and forth, that the kernel sees it as an opportunity to put the > process to sleep? or do these worst case misses cause an interrupt? No; AFAICS the kernel could not even be aware of that behavior. The context swap storm is happening because of contention at the next level up (LWLocks rather than spinlocks). It could be an independent issue that just happens to be triggered by the same sort of access pattern. I put forward a hypothesis that the cache miss storm caused by the test-and-set ops induces the context swap storm by making the code more likely to be executing in certain places at certain times ... but it's only a hypothesis. Yesterday evening I had pretty well convinced myself that they were indeed independent issues: profiling on a single-CPU machine was telling me that the test case I proposed spends over 10% of its time inside ReadBuffer, which certainly seems like enough to explain a high rate of contention on the BufMgrLock, without any assumptions about funny behavior at the hardware level. However, your report and Dave's suggest that there really is some linkage. So I'm still confused. regards, tom lane