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
cb7c4704
Commit
cb7c4704
authored
Dec 16, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move LRU Nuking into the stevedores, while preserving the current
stevedore selection algorithm exactly.
parent
18082164
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
18 deletions
+38
-18
stevedore.c
bin/varnishd/storage/stevedore.c
+3
-7
storage_persistent.c
bin/varnishd/storage/storage_persistent.c
+18
-4
storage_simple.c
bin/varnishd/storage/storage_simple.c
+17
-7
No files found.
bin/varnishd/storage/stevedore.c
View file @
cb7c4704
...
...
@@ -142,7 +142,7 @@ STV_NewObject(struct worker *wrk, struct objcore *oc,
const
char
*
hint
,
unsigned
wsl
)
{
struct
stevedore
*
stv
,
*
stv0
;
int
i
,
j
;
int
j
;
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
...
...
@@ -158,13 +158,9 @@ STV_NewObject(struct worker *wrk, struct objcore *oc,
j
=
stv
->
allocobj
(
wrk
,
stv
,
oc
,
wsl
,
0
);
}
while
(
j
==
0
&&
stv
!=
stv0
);
}
if
(
j
==
0
)
{
if
(
j
==
0
&&
cache_param
->
nuke_limit
>
0
)
{
/* no luck; try to free some space and keep trying */
for
(
i
=
0
;
j
==
0
&&
i
<
cache_param
->
nuke_limit
;
i
++
)
{
if
(
EXP_NukeOne
(
wrk
,
stv
->
lru
)
==
-
1
)
break
;
j
=
stv
->
allocobj
(
wrk
,
stv
,
oc
,
wsl
,
0
);
}
j
=
stv
->
allocobj
(
wrk
,
stv
,
oc
,
wsl
,
cache_param
->
nuke_limit
);
}
if
(
j
==
0
)
...
...
bin/varnishd/storage/storage_persistent.c
View file @
cb7c4704
...
...
@@ -517,8 +517,8 @@ smp_allocobj(struct worker *wrk, const struct stevedore *stv,
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
(
void
)
really
;
CAST_OBJ_NOTNULL
(
sc
,
stv
->
priv
,
SMP_SC_MAGIC
);
assert
(
really
>=
0
);
/* Don't entertain already dead objects */
if
((
oc
->
exp
.
ttl
+
oc
->
exp
.
grace
+
oc
->
exp
.
keep
)
<=
0
.)
...
...
@@ -527,10 +527,24 @@ smp_allocobj(struct worker *wrk, const struct stevedore *stv,
ltot
=
sizeof
(
struct
object
)
+
PRNDUP
(
wsl
);
ltot
=
IRNUP
(
sc
,
ltot
);
st
=
smp_allocx
(
stv
,
ltot
,
ltot
,
&
so
,
&
objidx
,
&
sg
);
if
(
st
==
NULL
)
return
(
0
);
while
(
1
)
{
if
(
really
>
0
)
{
if
(
EXP_NukeOne
(
wrk
,
stv
->
lru
)
==
-
1
)
return
(
0
);
really
--
;
}
st
=
smp_allocx
(
stv
,
ltot
,
ltot
,
&
so
,
&
objidx
,
&
sg
);
if
(
st
!=
NULL
&&
st
->
space
<
ltot
)
{
stv
->
free
(
st
);
// NOP
st
=
NULL
;
}
if
(
st
!=
NULL
)
break
;
if
(
!
really
)
return
(
0
);
}
AN
(
st
);
assert
(
st
->
space
>=
ltot
);
o
=
SML_MkObject
(
stv
,
oc
,
st
->
ptr
);
...
...
bin/varnishd/storage/storage_simple.c
View file @
cb7c4704
...
...
@@ -84,15 +84,25 @@ SML_allocobj(struct worker *wrk, const struct stevedore *stv,
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
(
void
)
really
;
assert
(
really
>=
0
)
;
ltot
=
sizeof
(
struct
object
)
+
PRNDUP
(
wsl
);
st
=
stv
->
alloc
(
stv
,
ltot
);
if
(
st
==
NULL
)
return
(
0
);
if
(
st
->
space
<
ltot
)
{
stv
->
free
(
st
);
return
(
0
);
while
(
1
)
{
if
(
really
>
0
)
{
if
(
EXP_NukeOne
(
wrk
,
stv
->
lru
)
==
-
1
)
return
(
0
);
really
--
;
}
st
=
stv
->
alloc
(
stv
,
ltot
);
if
(
st
!=
NULL
&&
st
->
space
<
ltot
)
{
stv
->
free
(
st
);
st
=
NULL
;
}
if
(
st
!=
NULL
)
break
;
if
(
!
really
)
return
(
0
);
}
AN
(
st
);
o
=
SML_MkObject
(
stv
,
oc
,
st
->
ptr
);
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
st
->
len
=
sizeof
(
*
o
);
...
...
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