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
6f6bf9db
Commit
6f6bf9db
authored
Dec 16, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move LRU-touching behind a oc->touch method.
This makes it easier for -spersistent to avoid LRU touching
parent
ea95f53a
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
29 additions
and
12 deletions
+29
-12
cache.h
bin/varnishd/cache/cache.h
+1
-3
cache_expire.c
bin/varnishd/cache/cache_expire.c
+0
-7
cache_obj.c
bin/varnishd/cache/cache_obj.c
+15
-0
cache_obj.h
bin/varnishd/cache/cache_obj.h
+2
-0
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+1
-1
storage_persistent.c
bin/varnishd/storage/storage_persistent.c
+1
-0
storage_persistent_silo.c
bin/varnishd/storage/storage_persistent_silo.c
+0
-1
storage_simple.c
bin/varnishd/storage/storage_simple.c
+9
-0
No files found.
bin/varnishd/cache/cache.h
View file @
6f6bf9db
...
@@ -363,9 +363,6 @@ struct lru {
...
@@ -363,9 +363,6 @@ struct lru {
#define LRU_MAGIC 0x3fec7bb0
#define LRU_MAGIC 0x3fec7bb0
VTAILQ_HEAD
(,
objcore
)
lru_head
;
VTAILQ_HEAD
(,
objcore
)
lru_head
;
struct
lock
mtx
;
struct
lock
mtx
;
unsigned
flags
;
#define LRU_F_DONTMOVE (1<<1)
#define LRU_F_CONDEMMED (1<<2)
unsigned
n_objcore
;
unsigned
n_objcore
;
};
};
...
@@ -850,6 +847,7 @@ int ObjIterate(struct worker *, struct objcore *,
...
@@ -850,6 +847,7 @@ int ObjIterate(struct worker *, struct objcore *,
int
ObjGetSpace
(
struct
worker
*
,
struct
objcore
*
,
ssize_t
*
sz
,
uint8_t
**
ptr
);
int
ObjGetSpace
(
struct
worker
*
,
struct
objcore
*
,
ssize_t
*
sz
,
uint8_t
**
ptr
);
void
ObjExtend
(
struct
worker
*
,
struct
objcore
*
,
ssize_t
l
);
void
ObjExtend
(
struct
worker
*
,
struct
objcore
*
,
ssize_t
l
);
void
ObjTrimStore
(
struct
worker
*
,
struct
objcore
*
);
void
ObjTrimStore
(
struct
worker
*
,
struct
objcore
*
);
void
ObjTouch
(
struct
worker
*
wrk
,
struct
objcore
*
oc
,
double
now
);
unsigned
ObjGetXID
(
struct
worker
*
,
struct
objcore
*
);
unsigned
ObjGetXID
(
struct
worker
*
,
struct
objcore
*
);
uint64_t
ObjGetLen
(
struct
worker
*
,
struct
objcore
*
oc
);
uint64_t
ObjGetLen
(
struct
worker
*
,
struct
objcore
*
oc
);
void
ObjUpdateMeta
(
struct
worker
*
,
struct
objcore
*
);
void
ObjUpdateMeta
(
struct
worker
*
,
struct
objcore
*
);
...
...
bin/varnishd/cache/cache_expire.c
View file @
6f6bf9db
...
@@ -240,13 +240,6 @@ EXP_Touch(struct objcore *oc, double now)
...
@@ -240,13 +240,6 @@ EXP_Touch(struct objcore *oc, double now)
lru
=
ObjGetLRU
(
oc
);
lru
=
ObjGetLRU
(
oc
);
CHECK_OBJ_NOTNULL
(
lru
,
LRU_MAGIC
);
CHECK_OBJ_NOTNULL
(
lru
,
LRU_MAGIC
);
/*
* For -spersistent (and possibly other stevedores, we don't move
* objects on the lru list, since LRU doesn't really help much.
*/
if
(
lru
->
flags
&
LRU_F_DONTMOVE
)
return
;
if
(
Lck_Trylock
(
&
lru
->
mtx
))
if
(
Lck_Trylock
(
&
lru
->
mtx
))
return
;
return
;
...
...
bin/varnishd/cache/cache_obj.c
View file @
6f6bf9db
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
* ObjSetAttr Set attr now
* ObjSetAttr Set attr now
* ObjGetAttr Get attr no
* ObjGetAttr Get attr no
* ObjRelease Done with attr ptr
* ObjRelease Done with attr ptr
* ObjTouch Object was used
*/
*/
#include "config.h"
#include "config.h"
...
@@ -246,6 +247,20 @@ ObjSetattr(struct worker *wrk, struct objcore *oc, enum obj_attr attr,
...
@@ -246,6 +247,20 @@ ObjSetattr(struct worker *wrk, struct objcore *oc, enum obj_attr attr,
return
(
om
->
objsetattr
(
wrk
,
oc
,
attr
,
len
,
ptr
));
return
(
om
->
objsetattr
(
wrk
,
oc
,
attr
,
len
,
ptr
));
}
}
/*====================================================================
* ObjTouch()
*/
void
ObjTouch
(
struct
worker
*
wrk
,
struct
objcore
*
oc
,
double
now
)
{
const
struct
obj_methods
*
om
=
obj_getmethods
(
oc
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
if
(
om
->
objtouch
!=
NULL
)
om
->
objtouch
(
wrk
,
oc
,
now
);
}
/*====================================================================
/*====================================================================
* Utility functions which work on top of the previous ones
* Utility functions which work on top of the previous ones
*/
*/
...
...
bin/varnishd/cache/cache_obj.h
View file @
6f6bf9db
...
@@ -49,6 +49,7 @@ typedef void *objgetattr_f(struct worker *, struct objcore *,
...
@@ -49,6 +49,7 @@ typedef void *objgetattr_f(struct worker *, struct objcore *,
typedef
void
*
objsetattr_f
(
struct
worker
*
,
struct
objcore
*
,
typedef
void
*
objsetattr_f
(
struct
worker
*
,
struct
objcore
*
,
enum
obj_attr
attr
,
ssize_t
len
,
const
void
*
ptr
);
enum
obj_attr
attr
,
ssize_t
len
,
const
void
*
ptr
);
typedef
uint64_t
objgetlen_f
(
struct
worker
*
,
struct
objcore
*
);
typedef
uint64_t
objgetlen_f
(
struct
worker
*
,
struct
objcore
*
);
typedef
void
objtouch_f
(
struct
worker
*
,
struct
objcore
*
,
double
now
);
struct
obj_methods
{
struct
obj_methods
{
objfree_f
*
objfree
;
objfree_f
*
objfree
;
...
@@ -65,4 +66,5 @@ struct obj_methods {
...
@@ -65,4 +66,5 @@ struct obj_methods {
objslim_f
*
objslim
;
objslim_f
*
objslim
;
objgetattr_f
*
objgetattr
;
objgetattr_f
*
objgetattr
;
objsetattr_f
*
objsetattr
;
objsetattr_f
*
objsetattr
;
objtouch_f
*
objtouch
;
};
};
bin/varnishd/cache/cache_req_fsm.c
View file @
6f6bf9db
...
@@ -126,7 +126,7 @@ cnt_deliver(struct worker *wrk, struct req *req)
...
@@ -126,7 +126,7 @@ cnt_deliver(struct worker *wrk, struct req *req)
assert
(
req
->
objcore
->
refcnt
>
0
);
assert
(
req
->
objcore
->
refcnt
>
0
);
if
(
req
->
objcore
->
exp_flags
&
OC_EF_EXP
)
if
(
req
->
objcore
->
exp_flags
&
OC_EF_EXP
)
EXP_Touch
(
req
->
objcore
,
req
->
t_prev
);
ObjTouch
(
req
->
wrk
,
req
->
objcore
,
req
->
t_prev
);
HTTP_Setup
(
req
->
resp
,
req
->
ws
,
req
->
vsl
,
SLT_RespMethod
);
HTTP_Setup
(
req
->
resp
,
req
->
ws
,
req
->
vsl
,
SLT_RespMethod
);
if
(
HTTP_Decode
(
req
->
resp
,
if
(
HTTP_Decode
(
req
->
resp
,
...
...
bin/varnishd/storage/storage_persistent.c
View file @
6f6bf9db
...
@@ -708,6 +708,7 @@ SMP_Init(void)
...
@@ -708,6 +708,7 @@ SMP_Init(void)
smp_oc_realmethods
.
objupdatemeta
=
smp_oc_methods
.
objupdatemeta
;
smp_oc_realmethods
.
objupdatemeta
=
smp_oc_methods
.
objupdatemeta
;
smp_oc_realmethods
.
objfree
=
smp_oc_methods
.
objfree
;
smp_oc_realmethods
.
objfree
=
smp_oc_methods
.
objfree
;
smp_oc_realmethods
.
objgetlru
=
smp_oc_methods
.
objgetlru
;
smp_oc_realmethods
.
objgetlru
=
smp_oc_methods
.
objgetlru
;
smp_oc_realmethods
.
objtouch
=
NULL
;
}
}
/*--------------------------------------------------------------------
/*--------------------------------------------------------------------
...
...
bin/varnishd/storage/storage_persistent_silo.c
View file @
6f6bf9db
...
@@ -225,7 +225,6 @@ smp_new_seg(struct smp_sc *sc)
...
@@ -225,7 +225,6 @@ smp_new_seg(struct smp_sc *sc)
*
sg
=
tmpsg
;
*
sg
=
tmpsg
;
sg
->
lru
=
LRU_Alloc
();
sg
->
lru
=
LRU_Alloc
();
CHECK_OBJ_NOTNULL
(
sg
->
lru
,
LRU_MAGIC
);
CHECK_OBJ_NOTNULL
(
sg
->
lru
,
LRU_MAGIC
);
sg
->
lru
->
flags
|=
LRU_F_DONTMOVE
;
sg
->
p
.
offset
=
IRNUP
(
sc
,
sg
->
p
.
offset
);
sg
->
p
.
offset
=
IRNUP
(
sc
,
sg
->
p
.
offset
);
sg
->
p
.
length
-=
sg
->
p
.
offset
-
tmpsg
.
p
.
offset
;
sg
->
p
.
length
-=
sg
->
p
.
offset
-
tmpsg
.
p
.
offset
;
...
...
bin/varnishd/storage/storage_simple.c
View file @
6f6bf9db
...
@@ -557,6 +557,14 @@ sml_setattr(struct worker *wrk, struct objcore *oc, enum obj_attr attr,
...
@@ -557,6 +557,14 @@ sml_setattr(struct worker *wrk, struct objcore *oc, enum obj_attr attr,
return
(
retval
);
return
(
retval
);
}
}
static
void
__match_proto__
(
objtouch_f
)
sml_touch
(
struct
worker
*
wrk
,
struct
objcore
*
oc
,
double
now
)
{
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
EXP_Touch
(
oc
,
now
);
}
const
struct
obj_methods
SML_methods
=
{
const
struct
obj_methods
SML_methods
=
{
.
objfree
=
sml_objfree
,
.
objfree
=
sml_objfree
,
...
@@ -569,4 +577,5 @@ const struct obj_methods SML_methods = {
...
@@ -569,4 +577,5 @@ const struct obj_methods SML_methods = {
.
objslim
=
sml_slim
,
.
objslim
=
sml_slim
,
.
objgetattr
=
sml_getattr
,
.
objgetattr
=
sml_getattr
,
.
objsetattr
=
sml_setattr
,
.
objsetattr
=
sml_setattr
,
.
objtouch
=
sml_touch
,
};
};
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