diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-08-22 14:59:50 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-09-21 10:29:41 +0200 |
commit | 3489e3b6396ee9944a6a2e19e675ca54c36993b4 (patch) | |
tree | cd55cfac1c96ff4b888a9606fd6a0d8eb65bb446 /freebsd/sys/kern/subr_counter.c | |
parent | ck: Define CK_MD_PPC32_LWSYNC if available (diff) | |
download | rtems-libbsd-3489e3b6396ee9944a6a2e19e675ca54c36993b4.tar.bz2 |
Update to FreeBSD head 2018-09-17
Git mirror commit 6c2192b1ef8c50788c751f878552526800b1e319.
Update #3472.
Diffstat (limited to 'freebsd/sys/kern/subr_counter.c')
-rw-r--r-- | freebsd/sys/kern/subr_counter.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/freebsd/sys/kern/subr_counter.c b/freebsd/sys/kern/subr_counter.c index e4c98fae..66cda02b 100644 --- a/freebsd/sys/kern/subr_counter.c +++ b/freebsd/sys/kern/subr_counter.c @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); #define IN_SUBR_COUNTER_C #include <sys/counter.h> - + void counter_u64_zero(counter_u64_t c) { @@ -62,20 +62,15 @@ counter_u64_fetch(counter_u64_t c) counter_u64_t counter_u64_alloc(int flags) { - counter_u64_t r; - - r = uma_zalloc(pcpu_zone_64, flags); - if (r != NULL) - counter_u64_zero(r); - return (r); + return (uma_zalloc_pcpu(pcpu_zone_64, flags | M_ZERO)); } void counter_u64_free(counter_u64_t c) { - uma_zfree(pcpu_zone_64, c); + uma_zfree_pcpu(pcpu_zone_64, c); } int @@ -142,7 +137,7 @@ counter_ratecheck(struct counter_rate *cr, int64_t limit) val = cr->cr_over; now = ticks; - if (now - cr->cr_ticks >= hz) { + if ((u_int)(now - cr->cr_ticks) >= hz) { /* * Time to clear the structure, we are in the next second. * First try unlocked read, and then proceed with atomic. @@ -153,7 +148,7 @@ counter_ratecheck(struct counter_rate *cr, int64_t limit) * Check if other thread has just went through the * reset sequence before us. */ - if (now - cr->cr_ticks >= hz) { + if ((u_int)(now - cr->cr_ticks) >= hz) { val = counter_u64_fetch(cr->cr_rate); counter_u64_zero(cr->cr_rate); cr->cr_over = 0; |