Date: Mon, 5 Nov 2018 08:11:16 +0000 (UTC) From: Matt Macy <mmacy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r340149 - head/sys/dev/hwpmc Message-ID: <201811050811.wA58BGwr007337@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mmacy Date: Mon Nov 5 08:11:16 2018 New Revision: 340149 URL: https://svnweb.freebsd.org/changeset/base/340149 Log: 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 Modified: head/sys/dev/hwpmc/hwpmc_mod.c Modified: head/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mod.c Mon Nov 5 06:59:41 2018 (r340148) +++ head/sys/dev/hwpmc/hwpmc_mod.c Mon Nov 5 08:11:16 2018 (r340149) @@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811050811.wA58BGwr007337>