1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-23 11:18:54 +00:00
freebsd/sys
Jonathan T. Looney 5eaa6f01f5 Improve accuracy of PMC sampling frequency
The code tracks a counter which is the number of events until the next
sample. On context switch in, it loads the saved counter. On context
switch out, it tries to calculate a new saved counter.

Problems:

1. The saved counter was shared by all threads in a process. However, this
means that all threads would be initially loaded with the same saved
counter. However, that could result in sampling more often than once every
X number of events.

2. The calculation to determine a new saved counter was backwards. It
added when it should have subtracted, and subtracted when it should have
added. Assume a single-threaded process with a reload count of 1000 events.
Assuming the counter on context switch in was 100 and the counter on context
switch out was 50 (meaning the thread has "consumed" 50 more events), the
code would calculate a new saved counter of 150 (instead of the proper 50).

Fix:

1. As soon as the saved counter is used to initialize a monitor for a
thread on context switch in, set the saved counter to the reload count.
That way, subsequent threads to use the saved counter will get the full
reload count, assuring we sample at least once every X number of events
(across all threads).

2. Change the calculation of the saved counter. Due to the change to the
saved counter in #1, we simply need to add (modulo the reload count) the
remaining counter time we retrieve from the CPU when a thread is context
switched out.

Differential Revision:	https://reviews.freebsd.org/D4122
Approved by:	gnn (mentor)
MFC after:	1 month
Sponsored by:	Juniper Networks
2015-11-16 15:22:15 +00:00
..
amd64 Export various helper variables describing the layout and size of 2015-11-12 22:00:59 +00:00
arm Replace magic numbers for CCGRx registers with more descriptive names 2015-11-14 22:46:50 +00:00
arm64 Fix typo in message from arm64 ITS workaround 2015-11-09 01:49:25 +00:00
boot Add support for the Zybo and similar boards to ZEDBOARD kernel. 2015-11-13 15:36:40 +00:00
bsm
cam Add NULL check to make Coverity happy. 2015-11-14 14:56:01 +00:00
cddl Switch zfs_panic_recover to panic for bad DVA 2015-11-06 20:45:19 +00:00
compat Add assert and note about the size of "unsigned long" inside the 2015-11-13 09:00:39 +00:00
conf Now that the PMU implementation is independent of HWPMC 2015-11-09 17:57:32 +00:00
contrib Fix slots DMA memory handling. It's similar to r290553. 2015-11-10 10:56:52 +00:00
crypto
ddb
dev Improve accuracy of PMC sampling frequency 2015-11-16 15:22:15 +00:00
fs - Consistently use PROC_ASSERT_HELD() to verify that a process' hold count 2015-11-08 01:38:56 +00:00
gdb
geom Fix g_eli error loss conditions 2015-11-05 17:37:35 +00:00
gnu
i386 Export various helper variables describing the layout and size of 2015-11-12 22:00:59 +00:00
isa
kern Speed up rctl operation with large rulesets, by holding the lock 2015-11-15 12:10:51 +00:00
kgssapi
libkern
mips Add QCA9533 to the list of SoCs that require IRQ's be ACKed. 2015-11-16 06:15:01 +00:00
modules Add riotboard DTB to dtb/imx6 2015-11-12 03:37:28 +00:00
net Pass provided af instead of AF_UNSPEC to setwa_f callback. 2015-11-14 18:16:17 +00:00
net80211 net80211: add ieee80211_restart_all() call. 2015-10-27 20:40:57 +00:00
netgraph Move iflladdr_event eventhandler invocation to if_setlladdr. 2015-11-14 13:34:03 +00:00
netinet Revert r290403 2015-11-13 23:14:39 +00:00
netinet6 Bring back the ability of passing cached route via nd6_output_ifp(). 2015-11-15 16:02:22 +00:00
netipsec Use explicitly specified ivsize instead of blocksize when we mean IV size. 2015-11-16 07:10:42 +00:00
netnatm
netpfil Bring back the ability of passing cached route via nd6_output_ifp(). 2015-11-15 16:02:22 +00:00
netsmb
nfs
nfsclient
nfsserver
nlm
ofed Fix integer to pointer of different size conversion warnings when 2015-11-12 10:12:20 +00:00
opencrypto Use explicitly specified ivsize instead of blocksize when we mean IV size. 2015-11-16 07:10:42 +00:00
pc98
powerpc Write 2- and 4-byte aligned values as single writes in ddb(4) 2015-11-06 04:56:52 +00:00
rpc
security
sparc64 Fix an alignment check that is wrong in half the busdma implementations. 2015-11-02 23:37:19 +00:00
sys Change the driver stats to what they really are: unsigned values. 2015-11-16 15:16:09 +00:00
teken
tests Style 9 changes. 2015-11-12 10:31:14 +00:00
tools
ufs Do not perform read-ahead for BA_CLRBUF request when we are low on 2015-10-27 13:44:13 +00:00
vm Rework the test which raises OOM condition. Right now, the code 2015-11-16 06:26:26 +00:00
x86 x86/dma_bounce: rework _bus_dmamap_load_ma implementation 2015-11-09 12:19:58 +00:00
xdr
xen xen/intr: fix the event channel enabled per-cpu mask 2015-11-05 14:33:46 +00:00
Makefile