Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
747f35b7
Commit
747f35b7
authored
May 31, 2021
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use VCL_BYTES for size-accounting.
parent
68684fec
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
storage_malloc.c
bin/varnishd/storage/storage_malloc.c
+8
-8
No files found.
bin/varnishd/storage/storage_malloc.c
View file @
747f35b7
...
...
@@ -50,8 +50,8 @@ struct sma_sc {
unsigned
magic
;
#define SMA_SC_MAGIC 0x1ac8a345
struct
lock
sma_mtx
;
size_t
sma_max
;
size_t
sma_alloc
;
VCL_BYTES
sma_max
;
VCL_BYTES
sma_alloc
;
struct
VSC_sma
*
stats
;
};
...
...
@@ -83,7 +83,7 @@ sma_alloc(const struct stevedore *st, size_t size)
sma_sc
->
stats
->
c_bytes
+=
size
;
sma_sc
->
stats
->
g_alloc
++
;
sma_sc
->
stats
->
g_bytes
+=
size
;
if
(
sma_sc
->
sma_max
!=
SIZE
_MAX
)
if
(
sma_sc
->
sma_max
!=
VRT_INTEGER
_MAX
)
sma_sc
->
stats
->
g_space
-=
size
;
}
Lck_Unlock
(
&
sma_sc
->
sma_mtx
);
...
...
@@ -117,7 +117,7 @@ sma_alloc(const struct stevedore *st, size_t size)
sma_sc
->
stats
->
c_bytes
-=
size
;
sma_sc
->
stats
->
g_alloc
--
;
sma_sc
->
stats
->
g_bytes
-=
size
;
if
(
sma_sc
->
sma_max
!=
SIZE
_MAX
)
if
(
sma_sc
->
sma_max
!=
VRT_INTEGER
_MAX
)
sma_sc
->
stats
->
g_space
+=
size
;
Lck_Unlock
(
&
sma_sc
->
sma_mtx
);
return
(
NULL
);
...
...
@@ -146,7 +146,7 @@ sma_free(struct storage *s)
sma_sc
->
stats
->
g_alloc
--
;
sma_sc
->
stats
->
g_bytes
-=
sma
->
sz
;
sma_sc
->
stats
->
c_freed
+=
sma
->
sz
;
if
(
sma_sc
->
sma_max
!=
SIZE
_MAX
)
if
(
sma_sc
->
sma_max
!=
VRT_INTEGER
_MAX
)
sma_sc
->
stats
->
g_space
+=
sma
->
sz
;
Lck_Unlock
(
&
sma_sc
->
sma_mtx
);
free
(
sma
->
s
.
ptr
);
...
...
@@ -181,8 +181,8 @@ sma_init(struct stevedore *parent, int ac, char * const *av)
ASSERT_MGT
();
ALLOC_OBJ
(
sc
,
SMA_SC_MAGIC
);
AN
(
sc
);
sc
->
sma_max
=
SIZE
_MAX
;
assert
(
sc
->
sma_max
==
SIZE
_MAX
);
sc
->
sma_max
=
VRT_INTEGER
_MAX
;
assert
(
sc
->
sma_max
==
VRT_INTEGER
_MAX
);
parent
->
priv
=
sc
;
AZ
(
av
[
ac
]);
...
...
@@ -216,7 +216,7 @@ sma_open(struct stevedore *st)
CAST_OBJ_NOTNULL
(
sma_sc
,
st
->
priv
,
SMA_SC_MAGIC
);
Lck_New
(
&
sma_sc
->
sma_mtx
,
lck_sma
);
sma_sc
->
stats
=
VSC_sma_New
(
NULL
,
NULL
,
st
->
ident
);
if
(
sma_sc
->
sma_max
!=
SIZE
_MAX
)
if
(
sma_sc
->
sma_max
!=
VRT_INTEGER
_MAX
)
sma_sc
->
stats
->
g_space
=
sma_sc
->
sma_max
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment