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
d232d7f6
Commit
d232d7f6
authored
Feb 26, 2016
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce cost of HSH_Insert by one oh->mtx lock/unlock by grabbing
the refcount adjecent to the call.
parent
44108468
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
cache_expire.c
bin/varnishd/cache/cache_expire.c
+1
-2
cache_hash.c
bin/varnishd/cache/cache_hash.c
+9
-2
No files found.
bin/varnishd/cache/cache_expire.c
View file @
d232d7f6
...
...
@@ -124,12 +124,11 @@ EXP_Insert(struct worker *wrk, struct objcore *oc)
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
assert
(
oc
->
refcnt
>=
2
);
AZ
(
oc
->
exp_flags
&
(
OC_EF_INSERT
|
OC_EF_MOVE
));
AZ
(
oc
->
flags
&
OC_F_DYING
);
HSH_Ref
(
oc
);
ObjSendEvent
(
wrk
,
oc
,
OEV_INSERT
);
exp_mail_it
(
oc
,
OC_EF_INSERT
|
OC_EF_EXP
|
OC_EF_MOVE
);
}
...
...
bin/varnishd/cache/cache_hash.c
View file @
d232d7f6
...
...
@@ -263,7 +263,9 @@ HSH_Insert(struct worker *wrk, const void *digest, struct objcore *oc,
AN
(
digest
);
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
AN
(
ban
);
AN
(
oc
->
flags
&
OC_F_BUSY
);
AZ
(
oc
->
flags
&
OC_F_PRIVATE
);
assert
(
oc
->
refcnt
==
1
);
hsh_prealloc
(
wrk
);
...
...
@@ -275,9 +277,9 @@ HSH_Insert(struct worker *wrk, const void *digest, struct objcore *oc,
/* Mark object busy and insert (precreated) objcore in
objecthead. The new object inherits our objhead reference. */
oc
->
flags
|=
OC_F_BUSY
;
oc
->
objhead
=
oh
;
VTAILQ_INSERT_TAIL
(
&
oh
->
objcs
,
oc
,
hsh_list
);
oc
->
refcnt
++
;
// For EXP_Insert
Lck_Unlock
(
&
oh
->
mtx
);
BAN_RefBan
(
oc
,
ban
);
...
...
@@ -662,16 +664,19 @@ HSH_Unbusy(struct worker *wrk, struct objcore *oc)
AN
(
oc
->
stobj
->
stevedore
);
AN
(
oc
->
flags
&
OC_F_BUSY
);
assert
(
oh
->
refcnt
>
0
);
assert
(
oc
->
refcnt
>
0
);
if
(
!
(
oc
->
flags
&
OC_F_PRIVATE
))
{
BAN_NewObjCore
(
oc
);
AN
(
oc
->
ban
);
EXP_Insert
(
wrk
,
oc
);
}
/* XXX: pretouch neighbors on oh->objcs to prevent page-on under mtx */
Lck_Lock
(
&
oh
->
mtx
);
assert
(
oh
->
refcnt
>
0
);
assert
(
oc
->
refcnt
>
0
);
if
(
!
(
oc
->
flags
&
OC_F_PRIVATE
))
oc
->
refcnt
++
;
// For EXP_Insert
/* XXX: strictly speaking, we should sort in Date: order. */
VTAILQ_REMOVE
(
&
oh
->
objcs
,
oc
,
hsh_list
);
VTAILQ_INSERT_HEAD
(
&
oh
->
objcs
,
oc
,
hsh_list
);
...
...
@@ -679,6 +684,8 @@ HSH_Unbusy(struct worker *wrk, struct objcore *oc)
if
(
!
VTAILQ_EMPTY
(
&
oh
->
waitinglist
))
hsh_rush
(
wrk
,
oh
);
Lck_Unlock
(
&
oh
->
mtx
);
if
(
!
(
oc
->
flags
&
OC_F_PRIVATE
))
EXP_Insert
(
wrk
,
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