subr_counter.c (95dce07dea8197ff3d7edce34c3ca290f961f7a7) subr_counter.c (ab3059a8e7f382cff93dbe4d1b082adf62f4d849)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2012 Gleb Smirnoff <glebius@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

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

37#include <sys/proc.h>
38#include <sys/sched.h>
39#include <sys/smp.h>
40#include <sys/sysctl.h>
41#include <vm/uma.h>
42
43#define IN_SUBR_COUNTER_C
44#include <sys/counter.h>
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2012 Gleb Smirnoff <glebius@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

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

37#include <sys/proc.h>
38#include <sys/sched.h>
39#include <sys/smp.h>
40#include <sys/sysctl.h>
41#include <vm/uma.h>
42
43#define IN_SUBR_COUNTER_C
44#include <sys/counter.h>
45
45
46static void
47counter_u64_zero_sync(counter_u64_t c)
48{
49 int cpu;
50
51 CPU_FOREACH(cpu)
52 *(uint64_t*)zpcpu_get_cpu(c, cpu) = 0;
53}
54
46void
47counter_u64_zero(counter_u64_t c)
48{
49
50 counter_u64_zero_inline(c);
51}
52
53uint64_t

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

59
60counter_u64_t
61counter_u64_alloc(int flags)
62{
63 counter_u64_t r;
64
65 r = uma_zalloc_pcpu(pcpu_zone_64, flags);
66 if (r != NULL)
55void
56counter_u64_zero(counter_u64_t c)
57{
58
59 counter_u64_zero_inline(c);
60}
61
62uint64_t

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

68
69counter_u64_t
70counter_u64_alloc(int flags)
71{
72 counter_u64_t r;
73
74 r = uma_zalloc_pcpu(pcpu_zone_64, flags);
75 if (r != NULL)
67 counter_u64_zero(r);
76 counter_u64_zero_sync(r);
68
69 return (r);
70}
71
72void
73counter_u64_free(counter_u64_t c)
74{
75

--- 104 unchanged lines hidden ---
77
78 return (r);
79}
80
81void
82counter_u64_free(counter_u64_t c)
83{
84

--- 104 unchanged lines hidden ---