counter.h (c49761dd572ca667babda4253e14498c7161e21a) counter.h (ab3059a8e7f382cff93dbe4d1b082adf62f4d849)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2012 Konstantin Belousov <kib@FreeBSD.org>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 31 unchanged lines hidden (view full) ---

40#define counter_enter() do {} while (0)
41#define counter_exit() do {} while (0)
42
43#ifdef IN_SUBR_COUNTER_C
44static inline uint64_t
45counter_u64_read_one(uint64_t *p, int cpu)
46{
47
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2012 Konstantin Belousov <kib@FreeBSD.org>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 31 unchanged lines hidden (view full) ---

40#define counter_enter() do {} while (0)
41#define counter_exit() do {} while (0)
42
43#ifdef IN_SUBR_COUNTER_C
44static inline uint64_t
45counter_u64_read_one(uint64_t *p, int cpu)
46{
47
48 return (*(uint64_t *)((char *)p + sizeof(struct pcpu) * cpu));
48 return (*(uint64_t *)((char *)p + UMA_PCPU_ALLOC_SIZE * cpu));
49}
50
51static inline uint64_t
52counter_u64_fetch_inline(uint64_t *p)
53{
54 uint64_t r;
55 int i;
56
57 r = 0;
58 CPU_FOREACH(i)
59 r += counter_u64_read_one((uint64_t *)p, i);
60
61 return (r);
62}
63
64static void
65counter_u64_zero_one_cpu(void *arg)
66{
67
49}
50
51static inline uint64_t
52counter_u64_fetch_inline(uint64_t *p)
53{
54 uint64_t r;
55 int i;
56
57 r = 0;
58 CPU_FOREACH(i)
59 r += counter_u64_read_one((uint64_t *)p, i);
60
61 return (r);
62}
63
64static void
65counter_u64_zero_one_cpu(void *arg)
66{
67
68 *((uint64_t *)((char *)arg + sizeof(struct pcpu) *
68 *((uint64_t *)((char *)arg + UMA_PCPU_ALLOC_SIZE *
69 PCPU_GET(cpuid))) = 0;
70}
71
72static inline void
73counter_u64_zero_inline(counter_u64_t c)
74{
75
76 smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu,

--- 17 unchanged lines hidden ---
69 PCPU_GET(cpuid))) = 0;
70}
71
72static inline void
73counter_u64_zero_inline(counter_u64_t c)
74{
75
76 smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu,

--- 17 unchanged lines hidden ---