Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
d0db0a59
Commit
d0db0a59
authored
Feb 09, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of the LRU list sentenniel.
parent
ef2face7
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
29 deletions
+24
-29
cache.h
bin/varnishd/cache.h
+2
-11
cache_expire.c
bin/varnishd/cache_expire.c
+9
-12
stevedore.c
bin/varnishd/stevedore.c
+1
-2
stevedore.h
bin/varnishd/stevedore.h
+10
-0
storage_persistent.c
bin/varnishd/storage_persistent.c
+2
-4
No files found.
bin/varnishd/cache.h
View file @
d0db0a59
...
...
@@ -382,7 +382,7 @@ struct objcore {
#define OC_F_PRIV (1<<5)
/* Stevedore private flag */
unsigned
timer_idx
;
VTAILQ_ENTRY
(
objcore
)
list
;
V
LIST
_ENTRY
(
objcore
)
lru_list
;
V
TAILQ
_ENTRY
(
objcore
)
lru_list
;
VTAILQ_ENTRY
(
objcore
)
ban_list
;
struct
ban
*
ban
;
};
...
...
@@ -416,15 +416,6 @@ oc_getlru(const struct objcore *oc)
return
(
oc
->
methods
->
getlru
(
oc
));
}
/*--------------------------------------------------------------------*/
struct
lru
{
unsigned
magic
;
#define LRU_MAGIC 0x3fec7bb0
VLIST_HEAD
(,
objcore
)
lru_head
;
struct
objcore
senteniel
;
};
/* Object structure --------------------------------------------------*/
VTAILQ_HEAD
(
storagehead
,
storage
);
...
...
@@ -634,7 +625,7 @@ void EXP_Inject(struct objcore *oc, struct lru *lru, double when);
void
EXP_Init
(
void
);
void
EXP_Rearm
(
const
struct
object
*
o
);
void
EXP_Touch
(
struct
object
*
o
,
double
tnow
);
int
EXP_NukeOne
(
const
struct
sess
*
sp
,
const
struct
lru
*
lru
);
int
EXP_NukeOne
(
const
struct
sess
*
sp
,
struct
lru
*
lru
);
/* cache_fetch.c */
struct
storage
*
FetchStorage
(
const
struct
sess
*
sp
,
ssize_t
sz
);
...
...
bin/varnishd/cache_expire.c
View file @
d0db0a59
...
...
@@ -98,7 +98,7 @@ exp_insert(struct objcore *oc, struct lru *lru)
assert
(
oc
->
timer_idx
==
BINHEAP_NOIDX
);
binheap_insert
(
exp_heap
,
oc
);
assert
(
oc
->
timer_idx
!=
BINHEAP_NOIDX
);
V
LIST_INSERT_BEFORE
(
&
lru
->
senteniel
,
oc
,
lru_list
);
V
TAILQ_INSERT_TAIL
(
&
lru
->
lru_head
,
oc
,
lru_list
);
oc
->
flags
|=
OC_F_ONLRU
;
}
...
...
@@ -187,8 +187,8 @@ EXP_Touch(struct object *o, double tnow)
return
;
if
(
oc
->
flags
&
OC_F_ONLRU
)
{
/* XXX ?? */
V
LIST_REMOVE
(
oc
,
lru_list
);
V
LIST_INSERT_BEFORE
(
&
lru
->
senteniel
,
oc
,
lru_list
);
V
TAILQ_REMOVE
(
&
lru
->
lru_head
,
oc
,
lru_list
);
V
TAILQ_INSERT_TAIL
(
&
lru
->
lru_head
,
oc
,
lru_list
);
VSC_main
->
n_lru_moved
++
;
o
->
last_lru
=
tnow
;
}
...
...
@@ -239,6 +239,7 @@ static void * __match_proto__(void *start_routine(void *))
exp_timer
(
struct
sess
*
sp
,
void
*
priv
)
{
struct
objcore
*
oc
;
struct
lru
*
lru
;
double
t
;
(
void
)
priv
;
...
...
@@ -272,7 +273,8 @@ exp_timer(struct sess *sp, void *priv)
/* And from LRU */
if
(
oc
->
flags
&
OC_F_ONLRU
)
{
VLIST_REMOVE
(
oc
,
lru_list
);
lru
=
oc_getlru
(
oc
);
VTAILQ_REMOVE
(
&
lru
->
lru_head
,
oc
,
lru_list
);
oc
->
flags
&=
~
OC_F_ONLRU
;
}
...
...
@@ -293,19 +295,14 @@ exp_timer(struct sess *sp, void *priv)
*/
int
EXP_NukeOne
(
const
struct
sess
*
sp
,
const
struct
lru
*
lru
)
EXP_NukeOne
(
const
struct
sess
*
sp
,
struct
lru
*
lru
)
{
struct
objcore
*
oc
;
struct
object
*
o
;
/* Find the first currently unused object on the LRU. */
Lck_Lock
(
&
exp_mtx
);
VLIST_FOREACH
(
oc
,
&
lru
->
lru_head
,
lru_list
)
{
if
(
oc
==
&
lru
->
senteniel
)
{
AZ
(
VLIST_NEXT
(
oc
,
lru_list
));
oc
=
NULL
;
break
;
}
VTAILQ_FOREACH
(
oc
,
&
lru
->
lru_head
,
lru_list
)
{
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
if
(
oc
->
timer_idx
==
BINHEAP_NOIDX
)
/* exp_timer has it */
continue
;
...
...
@@ -313,7 +310,7 @@ EXP_NukeOne(const struct sess *sp, const struct lru *lru)
break
;
}
if
(
oc
!=
NULL
)
{
V
LIST_REMOVE
(
oc
,
lru_list
);
V
TAILQ_REMOVE
(
&
lru
->
lru_head
,
oc
,
lru_list
);
oc
->
flags
&=
~
OC_F_ONLRU
;
binheap_delete
(
exp_heap
,
oc
->
timer_idx
);
assert
(
oc
->
timer_idx
==
BINHEAP_NOIDX
);
...
...
bin/varnishd/stevedore.c
View file @
d0db0a59
...
...
@@ -70,8 +70,7 @@ LRU_Alloc(void)
ALLOC_OBJ
(
l
,
LRU_MAGIC
);
AN
(
l
);
VLIST_INIT
(
&
l
->
lru_head
);
VLIST_INSERT_HEAD
(
&
l
->
lru_head
,
&
l
->
senteniel
,
lru_list
);
VTAILQ_INIT
(
&
l
->
lru_head
);
return
(
l
);
}
...
...
bin/varnishd/stevedore.h
View file @
d0db0a59
...
...
@@ -50,6 +50,16 @@ typedef void storage_close_f(const struct stevedore *);
#include "vrt_stv_var.h"
#undef VRTSTVTYPE
/*--------------------------------------------------------------------*/
struct
lru
{
unsigned
magic
;
#define LRU_MAGIC 0x3fec7bb0
VTAILQ_HEAD
(,
objcore
)
lru_head
;
};
/*--------------------------------------------------------------------*/
struct
stevedore
{
unsigned
magic
;
#define STEVEDORE_MAGIC 0x4baf43db
...
...
bin/varnishd/storage_persistent.c
View file @
d0db0a59
...
...
@@ -601,10 +601,8 @@ debug_report_silo(struct cli *cli, const struct smp_sc *sc, int objs)
cli_out
(
cli
,
" %u nobj, %u alloc, %u lobjlist, %u fixed
\n
"
,
sg
->
nobj
,
sg
->
nalloc
,
sg
->
p
.
lobjlist
,
sg
->
nfixed
);
if
(
objs
)
{
VLIST_FOREACH
(
oc
,
&
sg
->
lru
->
lru_head
,
lru_list
)
cli_out
(
cli
,
" %s %p
\n
"
,
oc
==
&
sg
->
lru
->
senteniel
?
"senteniel"
:
"OC: "
,
oc
);
VTAILQ_FOREACH
(
oc
,
&
sg
->
lru
->
lru_head
,
lru_list
)
cli_out
(
cli
,
" OC %p
\n
"
,
oc
);
}
}
}
...
...
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