aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/hwpmc/hwpmc_mod.c
diff options
context:
space:
mode:
authorMatt Macy <mmacy@FreeBSD.org>2018-11-05 08:11:16 +0000
committerMatt Macy <mmacy@FreeBSD.org>2018-11-05 08:11:16 +0000
commitacf50a7f68f4ef56798058f3b74fe0e9e7d166ef (patch)
tree4788b532cf44fc67ff7776c8a84cafe109a50026 /sys/dev/hwpmc/hwpmc_mod.c
parentb465e0bb56278398f6bce2cae6917216e78460b4 (diff)
hwpmc: limit wait for user callchain collection to 1 tick
The hwpmc pcpu sample buffer is prone to head of line blocking when waiting for user process to return to user space and collect a pending callchain. If more than one tick has elapsed between the time the sample entry was marked for collection and the time that the hardclock pmc handler runs to copy the records to a larger temporary buffer, mark the sample entry as not in use. This changes reduces the number of samples marked as not valid when collecting under load from ~99.5% to 5-20%. Reported by: mjg@ MFC after: 3 days
Notes
Notes: svn path=/head/; revision=340149
Diffstat (limited to 'sys/dev/hwpmc/hwpmc_mod.c')
-rw-r--r--sys/dev/hwpmc/hwpmc_mod.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c
index f94f645b2e39..f0c0d41fa2b1 100644
--- a/sys/dev/hwpmc/hwpmc_mod.c
+++ b/sys/dev/hwpmc/hwpmc_mod.c
@@ -4949,8 +4949,11 @@ pmc_process_samples(int cpu, ring_type_t ring)
/* If there is a pending AST wait for completion */
if (ps->ps_nsamples == PMC_USER_CALLCHAIN_PENDING) {
- /* if sample is more than 65 ms old, drop it */
- if (ticks - ps->ps_ticks > (hz >> 4)) {
+ /* if we've been waiting more than 1 tick to
+ * collect a callchain for this record then
+ * drop it and move on.
+ */
+ if (ticks - ps->ps_ticks > 1) {
/*
* track how often we hit this as it will
* preferentially lose user samples