Re: [PATCH] Identify LWLocks in tracepoints
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Craig Ringer <craig.ringer@enterprisedb.com>
Cc: Andres Freund <andres@anarazel.de>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>,
David Steele <david@pgmasters.net>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2021-04-14T14:28:59Z
Lists: pgsql-hackers
On Tue, Apr 13, 2021 at 10:42 PM Craig Ringer <craig.ringer@enterprisedb.com> wrote: > I'd really love it if a committer could add an explanatory comment or > two in the area though. I'm happy to draft a comment patch if anyone > agrees my suggestion is sensible. The key things I needed to know when > studying the code were: > > * A LWLock* is always part of a tranche, but locks within a given > tranche are not necessarily co-located in memory, cross referenced or > associated in any way. > * A LWLock tranche does not track how many LWLocks are in the tranche > or where they are in memory. It only groups up LWLocks into categories > and maps the tranche ID to a name. > * Not all LWLocks are part of the main LWLock array; others can be > embedded in shmem structs elsewhere, including in DSM segments. > * LWLocks in DSM segments may not have the same address between > different backends, because the DSM base address can vary, so a > LWLock* cannot be reliably compared between backends unless you know > it's in the main LWLock array or in static shmem. > > Having that info in lwlock.c near the tranche management code or the > tranche and main lwlock arrays would've been very handy. I'm willing to review a comment patch along those lines. > I'm actually inclined to revise the patch I sent in order to *remove* > the LWLock name from the tracepoint argument. At least for the > fast-path tracepoints on start-of-acquire and end-of-acquire. I think > it's probably OK to report it in the lock wait tracepoints, which is > where it's most important to have anyway. So the tracepoint will > always report the LWLock* and tranche ID, but it won't report the > tranche name for the fast-path. I'll add trace events for tranche ID > registration, so trace tools can either remember the tranche ID->name > mappings from there, or capture them from lock wait events and > remember them. > > Reasonable? That way we retain the most important trace functionality, > but we reduce the overheads. Reducing the overheads is good, but I have no opinion on what's important for people doing tracing, because I am not one of those people. -- Robert Haas EDB: http://www.enterprisedb.com
Commits
-
Emit dummy statements for probes.d probes when disabled
- 0d204a4b09f7 13.3 landed
- fa8fbadb934b 14.0 landed
-
Prevent lwlock dtrace probes from unnecessary work
- e48ce7ef0ef8 13.3 landed
- b94409a02f61 14.0 landed
-
doc: Fix typo in logicaldecoding.sgml.
- 5fe83adad9ef 14.0 cited
-
Move lwlock-release probe back where it belongs
- 96ae658e6238 14.0 landed
-
Remove bogus tracepoint
- 09418bed67a7 14.0 landed
-
Simplify LWLock tranche machinery by removing array_base/array_stride.
- 3761fe3c20bb 10.0 cited
-
Improve LWLock scalability.
- ab5194e6f617 9.5.0 cited