aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/filesystems/gfs2-glocks.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/filesystems/gfs2-glocks.txt')
-rw-r--r--Documentation/filesystems/gfs2-glocks.txt119
1 files changed, 118 insertions, 1 deletions
diff --git a/Documentation/filesystems/gfs2-glocks.txt b/Documentation/filesystems/gfs2-glocks.txt
index 0494f78d87e..fcc79957be6 100644
--- a/Documentation/filesystems/gfs2-glocks.txt
+++ b/Documentation/filesystems/gfs2-glocks.txt
@@ -61,7 +61,9 @@ go_unlock | Called on the final local unlock of a lock
61go_dump | Called to print content of object for debugfs file, or on 61go_dump | Called to print content of object for debugfs file, or on
62 | error to dump glock to the log. 62 | error to dump glock to the log.
63go_type | The type of the glock, LM_TYPE_..... 63go_type | The type of the glock, LM_TYPE_.....
64go_min_hold_time | The minimum hold time 64go_callback | Called if the DLM sends a callback to drop this lock
65go_flags | GLOF_ASPACE is set, if the glock has an address space
66 | associated with it
65 67
66The minimum hold time for each lock is the time after a remote lock 68The minimum hold time for each lock is the time after a remote lock
67grant for which we ignore remote demote requests. This is in order to 69grant for which we ignore remote demote requests. This is in order to
@@ -89,6 +91,7 @@ go_demote_ok | Sometimes | Yes
89go_lock | Yes | No 91go_lock | Yes | No
90go_unlock | Yes | No 92go_unlock | Yes | No
91go_dump | Sometimes | Yes 93go_dump | Sometimes | Yes
94go_callback | Sometimes (N/A) | Yes
92 95
93N.B. Operations must not drop either the bit lock or the spinlock 96N.B. Operations must not drop either the bit lock or the spinlock
94if its held on entry. go_dump and do_demote_ok must never block. 97if its held on entry. go_dump and do_demote_ok must never block.
@@ -111,4 +114,118 @@ itself (locking order as above), and the other, known as the iopen
111glock is used in conjunction with the i_nlink field in the inode to 114glock is used in conjunction with the i_nlink field in the inode to
112determine the lifetime of the inode in question. Locking of inodes 115determine the lifetime of the inode in question. Locking of inodes
113is on a per-inode basis. Locking of rgrps is on a per rgrp basis. 116is on a per-inode basis. Locking of rgrps is on a per rgrp basis.
117In general we prefer to lock local locks prior to cluster locks.
118
119 Glock Statistics
120 ------------------
121
122The stats are divided into two sets: those relating to the
123super block and those relating to an individual glock. The
124super block stats are done on a per cpu basis in order to
125try and reduce the overhead of gathering them. They are also
126further divided by glock type. All timings are in nanoseconds.
127
128In the case of both the super block and glock statistics,
129the same information is gathered in each case. The super
130block timing statistics are used to provide default values for
131the glock timing statistics, so that newly created glocks
132should have, as far as possible, a sensible starting point.
133The per-glock counters are initialised to zero when the
134glock is created. The per-glock statistics are lost when
135the glock is ejected from memory.
136
137The statistics are divided into three pairs of mean and
138variance, plus two counters. The mean/variance pairs are
139smoothed exponential estimates and the algorithm used is
140one which will be very familiar to those used to calculation
141of round trip times in network code. See "TCP/IP Illustrated,
142Volume 1", W. Richard Stevens, sect 21.3, "Round-Trip Time Measurement",
143p. 299 and onwards. Also, Volume 2, Sect. 25.10, p. 838 and onwards.
144Unlike the TCP/IP Illustrated case, the mean and variance are
145not scaled, but are in units of integer nanoseconds.
146
147The three pairs of mean/variance measure the following
148things:
149
150 1. DLM lock time (non-blocking requests)
151 2. DLM lock time (blocking requests)
152 3. Inter-request time (again to the DLM)
153
154A non-blocking request is one which will complete right
155away, whatever the state of the DLM lock in question. That
156currently means any requests when (a) the current state of
157the lock is exclusive, i.e. a lock demotion (b) the requested
158state is either null or unlocked (again, a demotion) or (c) the
159"try lock" flag is set. A blocking request covers all the other
160lock requests.
161
162There are two counters. The first is there primarily to show
163how many lock requests have been made, and thus how much data
164has gone into the mean/variance calculations. The other counter
165is counting queuing of holders at the top layer of the glock
166code. Hopefully that number will be a lot larger than the number
167of dlm lock requests issued.
168
169So why gather these statistics? There are several reasons
170we'd like to get a better idea of these timings:
171
1721. To be able to better set the glock "min hold time"
1732. To spot performance issues more easily
1743. To improve the algorithm for selecting resource groups for
175allocation (to base it on lock wait time, rather than blindly
176using a "try lock")
177
178Due to the smoothing action of the updates, a step change in
179some input quantity being sampled will only fully be taken
180into account after 8 samples (or 4 for the variance) and this
181needs to be carefully considered when interpreting the
182results.
183
184Knowing both the time it takes a lock request to complete and
185the average time between lock requests for a glock means we
186can compute the total percentage of the time for which the
187node is able to use a glock vs. time that the rest of the
188cluster has its share. That will be very useful when setting
189the lock min hold time.
190
191Great care has been taken to ensure that we
192measure exactly the quantities that we want, as accurately
193as possible. There are always inaccuracies in any
194measuring system, but I hope this is as accurate as we
195can reasonably make it.
196
197Per sb stats can be found here:
198/sys/kernel/debug/gfs2/<fsname>/sbstats
199Per glock stats can be found here:
200/sys/kernel/debug/gfs2/<fsname>/glstats
201
202Assuming that debugfs is mounted on /sys/kernel/debug and also
203that <fsname> is replaced with the name of the gfs2 filesystem
204in question.
205
206The abbreviations used in the output as are follows:
207
208srtt - Smoothed round trip time for non-blocking dlm requests
209srttvar - Variance estimate for srtt
210srttb - Smoothed round trip time for (potentially) blocking dlm requests
211srttvarb - Variance estimate for srttb
212sirt - Smoothed inter-request time (for dlm requests)
213sirtvar - Variance estimate for sirt
214dlm - Number of dlm requests made (dcnt in glstats file)
215queue - Number of glock requests queued (qcnt in glstats file)
216
217The sbstats file contains a set of these stats for each glock type (so 8 lines
218for each type) and for each cpu (one column per cpu). The glstats file contains
219a set of these stats for each glock in a similar format to the glocks file, but
220using the format mean/variance for each of the timing stats.
221
222The gfs2_glock_lock_time tracepoint prints out the current values of the stats
223for the glock in question, along with some addition information on each dlm
224reply that is received:
225
226status - The status of the dlm request
227flags - The dlm request flags
228tdiff - The time taken by this specific request
229(remaining fields as per above list)
230
114 231