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
fe0382d7
Commit
fe0382d7
authored
Dec 16, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrate EXP_Touch() into sml_touch()
parent
6f6bf9db
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
41 deletions
+31
-41
cache.h
bin/varnishd/cache/cache.h
+0
-1
cache_expire.c
bin/varnishd/cache/cache_expire.c
+0
-39
storage_simple.c
bin/varnishd/storage/storage_simple.c
+31
-1
No files found.
bin/varnishd/cache/cache.h
View file @
fe0382d7
...
...
@@ -690,7 +690,6 @@ void EXP_Insert(struct worker *wrk, struct objcore *oc);
void
EXP_Inject
(
struct
worker
*
wrk
,
struct
objcore
*
oc
,
struct
lru
*
lru
);
void
EXP_Rearm
(
struct
objcore
*
,
double
now
,
double
ttl
,
double
grace
,
double
keep
);
void
EXP_Touch
(
struct
objcore
*
oc
,
double
now
);
int
EXP_NukeOne
(
struct
worker
*
wrk
,
struct
lru
*
lru
);
enum
exp_event_e
{
...
...
bin/varnishd/cache/cache_expire.c
View file @
fe0382d7
...
...
@@ -216,45 +216,6 @@ EXP_Insert(struct worker *wrk, struct objcore *oc)
exp_mail_it
(
oc
);
}
/*--------------------------------------------------------------------
* Object was used, move to tail of LRU list.
*
* To avoid the exphdl->mtx becoming a hotspot, we only attempt to move
* objects if they have not been moved recently and if the lock is available.
* This optimization obviously leaves the LRU list imperfectly sorted.
*/
void
EXP_Touch
(
struct
objcore
*
oc
,
double
now
)
{
struct
lru
*
lru
;
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
if
(
oc
->
flags
&
OC_F_INCOMPLETE
)
return
;
if
(
now
-
oc
->
last_lru
<
cache_param
->
lru_interval
)
return
;
lru
=
ObjGetLRU
(
oc
);
CHECK_OBJ_NOTNULL
(
lru
,
LRU_MAGIC
);
if
(
Lck_Trylock
(
&
lru
->
mtx
))
return
;
AN
(
oc
->
exp_flags
&
OC_EF_EXP
);
if
(
!
(
oc
->
exp_flags
&
OC_EF_OFFLRU
))
{
/* Can only touch it while it's actually on the LRU list */
VTAILQ_REMOVE
(
&
lru
->
lru_head
,
oc
,
lru_list
);
VTAILQ_INSERT_TAIL
(
&
lru
->
lru_head
,
oc
,
lru_list
);
VSC_C_main
->
n_lru_moved
++
;
}
oc
->
last_lru
=
now
;
Lck_Unlock
(
&
lru
->
mtx
);
}
/*--------------------------------------------------------------------
* We have changed one or more of the object timers, tell the exp_thread
*
...
...
bin/varnishd/storage/storage_simple.c
View file @
fe0382d7
...
...
@@ -560,10 +560,40 @@ sml_setattr(struct worker *wrk, struct objcore *oc, enum obj_attr attr,
static
void
__match_proto__
(
objtouch_f
)
sml_touch
(
struct
worker
*
wrk
,
struct
objcore
*
oc
,
double
now
)
{
struct
lru
*
lru
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
EXP_Touch
(
oc
,
now
);
/*
* To avoid the exphdl->mtx becoming a hotspot, we only
* attempt to move objects if they have not been moved
* recently and if the lock is available. This optimization
* obviously leaves the LRU list imperfectly sorted.
*/
if
(
oc
->
flags
&
OC_F_INCOMPLETE
)
return
;
if
(
now
-
oc
->
last_lru
<
cache_param
->
lru_interval
)
return
;
lru
=
ObjGetLRU
(
oc
);
CHECK_OBJ_NOTNULL
(
lru
,
LRU_MAGIC
);
if
(
Lck_Trylock
(
&
lru
->
mtx
))
return
;
AN
(
oc
->
exp_flags
&
OC_EF_EXP
);
if
(
!
(
oc
->
exp_flags
&
OC_EF_OFFLRU
))
{
/* Can only touch it while it's actually on the LRU list */
VTAILQ_REMOVE
(
&
lru
->
lru_head
,
oc
,
lru_list
);
VTAILQ_INSERT_TAIL
(
&
lru
->
lru_head
,
oc
,
lru_list
);
VSC_C_main
->
n_lru_moved
++
;
}
oc
->
last_lru
=
now
;
Lck_Unlock
(
&
lru
->
mtx
);
}
const
struct
obj_methods
SML_methods
=
{
...
...
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