Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvdp-pesi
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
uplex-varnish
libvdp-pesi
Commits
f5c724ee
Unverified
Commit
f5c724ee
authored
Jan 26, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename task head struct to what it is
parent
656cd656
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
104 additions
and
104 deletions
+104
-104
bytes_tree.cocci
misc/coccinelle/archive/bytes_tree.cocci
+4
-4
Makefile.am
src/Makefile.am
+3
-3
pesi.c
src/pesi.c
+26
-26
pesi.h
src/pesi.h
+4
-4
pesi_tasks.h
src/pesi_tasks.h
+3
-3
task_fini_race.vtc
src/tests/task_fini_race.vtc
+3
-3
vdp_pesi.c
src/vdp_pesi.c
+58
-58
vdp_pesi.h
src/vdp_pesi.h
+1
-1
vmod_pesi.c
src/vmod_pesi.c
+2
-2
No files found.
misc/coccinelle/archive/bytes_tree.cocci
View file @
f5c724ee
@@
struct pesi_t
ree
*ptr;
struct pesi_t
asks
*ptr;
@@
- ptr->tree
...
...
@@ -9,11 +9,11 @@ struct pesi_tree *ptr;
struct pesi *pesi;
@@
- pesi->pesi_t
ree
->tree
+ pesi->pesi_t
ree
->bytes_tree
- pesi->pesi_t
asks
->tree
+ pesi->pesi_t
asks
->bytes_tree
@@
struct pesi_t
ree
val;
struct pesi_t
asks
val;
@@
- val.tree
...
...
src/Makefile.am
View file @
f5c724ee
...
...
@@ -16,7 +16,7 @@ libvmod_pesi_la_SOURCES = \
misc.c
\
pesi.h
\
pesi_flags.h
\
pesi_t
ree
.h
\
pesi_t
asks
.h
\
pesi.c
\
node.h
\
node_assert.h
\
...
...
@@ -55,13 +55,13 @@ vmod_pesi.lo: vcc_pesi_if.h VSC_pesi.c VSC_pesi.h misc.h node_mempool.h \
pesi_flags.h vdp_pesi.h tbl_set_parameter.h
vdp_pesi.lo
:
debug.h vdp_pesi.h node.h node_assert.h pesi.h pesi_flags.h
\
pesi_t
ree
.h misc.h
pesi_t
asks
.h misc.h
misc.lo
:
misc.h debug.h
node.lo
:
debug.h node.h node_assert.h node_mempool.h pesi.h misc.h vcc_pesi_if.h
pesi.lo
:
debug.h VSC_pesi.h pesi_t
ree
.h pesi_flags.h pesi.h
pesi.lo
:
debug.h VSC_pesi.h pesi_t
asks
.h pesi_flags.h pesi.h
vcc_pesi_if.h vmod_pesi.rst vmod_pesi.man.rst
:
vcc_pesi_if.c
...
...
src/pesi.c
View file @
f5c724ee
...
...
@@ -40,7 +40,7 @@
#include "VSC_pesi.h"
#include "pesi_t
ree
.h"
#include "pesi_t
asks
.h"
#include "pesi_flags.h"
#include "node_head.h"
#include "pesi.h"
...
...
@@ -67,7 +67,7 @@ struct VSC_pesi *stats = NULL;
* - otherwise, pesi gets destroyed before the task
*/
struct
pesi
*
pesi_new
(
struct
ws
*
ws
,
struct
pesi_t
ree
*
pesi_tree
)
pesi_new
(
struct
ws
*
ws
,
struct
pesi_t
asks
*
pesi_tasks
)
{
struct
pesi
*
pesi
;
...
...
@@ -77,16 +77,16 @@ pesi_new(struct ws *ws, struct pesi_tree *pesi_tree)
INIT_OBJ
(
pesi
,
PESI_MAGIC
);
pesi
->
pecx
->
magic
=
PECX_MAGIC
;
pesi
->
pesi_t
ree
=
pesi_tree
;
pesi
->
pesi_t
asks
=
pesi_tasks
;
pesi
->
flags
=
PF_HAS_TASK
|
PF_CFG_DEFAULT
;
node_init_nodestock
(
&
pesi
->
nodestock
);
Lck_Lock
(
&
pesi_t
ree
->
task_lock
);
VTAILQ_INSERT_TAIL
(
&
pesi_t
ree
->
task_head
,
pesi
,
list
);
assert
(
pesi_t
ree
->
task_running
>=
0
);
pesi_t
ree
->
task_running
++
;
Lck_Unlock
(
&
pesi_t
ree
->
task_lock
);
Lck_Lock
(
&
pesi_t
asks
->
task_lock
);
VTAILQ_INSERT_TAIL
(
&
pesi_t
asks
->
task_head
,
pesi
,
list
);
assert
(
pesi_t
asks
->
task_running
>=
0
);
pesi_t
asks
->
task_running
++
;
Lck_Unlock
(
&
pesi_t
asks
->
task_lock
);
return
(
pesi
);
}
...
...
@@ -94,7 +94,7 @@ pesi_new(struct ws *ws, struct pesi_tree *pesi_tree)
* shutting down a pesi request is a two stage process, because Req_Cleanup() in
* req_fini() called from vped_task() zeroes the workspace including our
* per-request struct pesi, so removing the registration from
* pesi_t
ree
->task_head need to happen before Req_Cleanup().
* pesi_t
asks
->task_head need to happen before Req_Cleanup().
*
* But notification of the topreq needs to happen after Req_Cleanup(), because
* it still references topreq and sp, thus the topreq may not finish until all
...
...
@@ -118,11 +118,11 @@ void
pesi_destroy
(
struct
pesi
**
pesip
)
{
struct
pesi
*
pesi
;
struct
pesi_t
ree
*
pesi_tree
;
struct
pesi_t
asks
*
pesi_tasks
;
TAKE_OBJ_NOTNULL
(
pesi
,
pesip
,
PESI_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi
->
pecx
,
PECX_MAGIC
);
TAKE_OBJ_NOTNULL
(
pesi_t
ree
,
&
pesi
->
pesi_tree
,
PESI_TREE_MAGIC
);
TAKE_OBJ_NOTNULL
(
pesi_t
asks
,
&
pesi
->
pesi_tasks
,
PESI_TREE_MAGIC
);
if
(
pesi
->
no_thread
!=
0
)
{
Lck_Lock
(
&
stats_lock
);
...
...
@@ -131,36 +131,36 @@ pesi_destroy(struct pesi **pesip)
Lck_Unlock
(
&
stats_lock
);
}
Lck_Lock
(
&
pesi_t
ree
->
task_lock
);
VTAILQ_REMOVE
(
&
pesi_t
ree
->
task_head
,
pesi
,
list
);
Lck_Lock
(
&
pesi_t
asks
->
task_lock
);
VTAILQ_REMOVE
(
&
pesi_t
asks
->
task_head
,
pesi
,
list
);
assert
(
pesi_t
ree
->
task_running
>=
0
);
assert
(
pesi_t
asks
->
task_running
>=
0
);
if
(
pesi
->
flags
&
PF_HAS_TASK
)
pesi_t
ree
->
task_finishing
++
;
Lck_Unlock
(
&
pesi_t
ree
->
task_lock
);
pesi_t
asks
->
task_finishing
++
;
Lck_Unlock
(
&
pesi_t
asks
->
task_lock
);
memset
(
pesi
,
0
,
sizeof
*
pesi
);
}
void
task_fini
(
struct
pesi_t
ree
*
pesi_tree
,
struct
pesi
*
pesi
)
task_fini
(
struct
pesi_t
asks
*
pesi_tasks
,
struct
pesi
*
pesi
)
{
Lck_Lock
(
&
pesi_t
ree
->
task_lock
);
assert
(
pesi_t
ree
->
task_running
>
0
);
Lck_Lock
(
&
pesi_t
asks
->
task_lock
);
assert
(
pesi_t
asks
->
task_running
>
0
);
if
(
pesi
==
NULL
)
{
assert
(
pesi_t
ree
->
task_finishing
>
0
);
pesi_t
ree
->
task_finishing
--
;
assert
(
pesi_t
asks
->
task_finishing
>
0
);
pesi_t
asks
->
task_finishing
--
;
}
else
{
AN
(
pesi
->
flags
&
PF_HAS_TASK
);
pesi
->
flags
&=
~
PF_HAS_TASK
;
}
pesi_t
ree
->
task_running
--
;
if
(
pesi_t
ree
->
task_running
==
0
)
{
AZ
(
pesi_t
ree
->
task_finishing
);
AZ
(
pthread_cond_signal
(
&
pesi_t
ree
->
task_cond
));
pesi_t
asks
->
task_running
--
;
if
(
pesi_t
asks
->
task_running
==
0
)
{
AZ
(
pesi_t
asks
->
task_finishing
);
AZ
(
pthread_cond_signal
(
&
pesi_t
asks
->
task_cond
));
}
Lck_Unlock
(
&
pesi_t
ree
->
task_lock
);
Lck_Unlock
(
&
pesi_t
asks
->
task_lock
);
}
src/pesi.h
View file @
f5c724ee
...
...
@@ -29,11 +29,11 @@
* PESI per request state
*/
struct
pesi_t
ree
;
struct
pesi_t
asks
;
struct
pesi
*
pesi_new
(
struct
ws
*
ws
,
struct
pesi_t
ree
*
pesi_tree
);
struct
pesi
*
pesi_new
(
struct
ws
*
ws
,
struct
pesi_t
asks
*
pesi_tasks
);
void
pesi_destroy
(
struct
pesi
**
pesip
);
void
task_fini
(
struct
pesi_t
ree
*
pesi_tree
,
struct
pesi
*
pesi
);
void
task_fini
(
struct
pesi_t
asks
*
pesi_tasks
,
struct
pesi
*
pesi
);
/*
* per request state
...
...
@@ -58,7 +58,7 @@ struct pesi {
#define PESI_MAGIC 0xa6ba54a0
unsigned
flags
;
struct
pesi_t
ree
*
pesi_tree
;
struct
pesi_t
asks
*
pesi_tasks
;
struct
worker
*
wrk
;
struct
node
*
node
;
int
woken
;
...
...
src/pesi_t
ree
.h
→
src/pesi_t
asks
.h
View file @
f5c724ee
...
...
@@ -26,12 +26,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* pesi_t
ree
is a global context for the entire ESI tree started at level 0.
* pesi_t
asks
is a global context for the entire ESI tree started at level 0.
*
* XXX merge pesi_t
ree
with bytes_tree ?
* XXX merge pesi_t
asks
with bytes_tree ?
*/
struct
pesi_t
ree
{
struct
pesi_t
asks
{
unsigned
magic
;
#define PESI_TREE_MAGIC 0xe8ce8adb
struct
bytes_tree
*
bytes_tree
;
...
...
src/tests/task_fini_race.vtc
View file @
f5c724ee
...
...
@@ -8,12 +8,12 @@ varnishtest "subreq.done race #2"
# +++ b/src/vdp_pesi.c
# @@ -232,6 +232,7 @@ vped_task(struct worker *wrk, void *priv)
# assert(pesi == req->transport_priv);
# Lck_Lock(
&pesi_t
ree
->tree->tree_lock);
# task_fini(pesi_t
ree
, pesi);
# Lck_Lock(
&pesi_t
asks
->tree->tree_lock);
# task_fini(pesi_t
asks
, pesi);
# + sleep(1);
# node->subreq.done = 1;
# AZ(pthread_cond_signal(
&node->subreq.cond));
# Lck_Unlock(
&pesi_t
ree
->tree->tree_lock);
# Lck_Unlock(
&pesi_t
asks
->tree->tree_lock);
server s1 {
rxreq
...
...
src/vdp_pesi.c
View file @
f5c724ee
...
...
@@ -56,7 +56,7 @@
#include "node_assert.h"
#include "pesi.h"
#include "pesi_flags.h"
#include "pesi_t
ree
.h"
#include "pesi_t
asks
.h"
#include "misc.h"
...
...
@@ -92,7 +92,7 @@ static void vped_close_vdp(struct req *, int, const struct vdp *);
static
void
assert_vdp_next_not
(
struct
req
*
,
const
struct
vdp
*
);
/* shared with vmod code */
struct
VSC_lck
*
lck_bytes_tree
,
*
lck_pesi_t
ree
;
struct
VSC_lck
*
lck_bytes_tree
,
*
lck_pesi_t
asks
;
extern
struct
mempool
*
mempool
;
struct
mempool
*
mempool
=
NULL
;
...
...
@@ -140,7 +140,7 @@ vped_task(struct worker *wrk, void *priv)
struct
req
*
req
;
struct
sess
*
sp
;
struct
pesi
*
pesi
;
struct
pesi_t
ree
*
pesi_tree
;
struct
pesi_t
asks
*
pesi_tasks
;
struct
node
*
node
;
enum
req_fsm_nxt
s
;
...
...
@@ -165,12 +165,12 @@ vped_task(struct worker *wrk, void *priv)
sp
=
req
->
sp
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
CAST_OBJ_NOTNULL
(
pesi
,
req
->
transport_priv
,
PESI_MAGIC
);
pesi_t
ree
=
pesi
->
pesi_tree
;
CHECK_OBJ_NOTNULL
(
pesi_t
ree
,
PESI_TREE_MAGIC
);
pesi_t
asks
=
pesi
->
pesi_tasks
;
CHECK_OBJ_NOTNULL
(
pesi_t
asks
,
PESI_TREE_MAGIC
);
pesi
->
wrk
=
wrk
;
node
=
pesi
->
node
;
CHECK_OBJ_NOTNULL
(
node
,
NODE_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi_t
ree
->
bytes_tree
,
BYTES_TREE_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi_t
asks
->
bytes_tree
,
BYTES_TREE_MAGIC
);
THR_SetRequest
(
req
);
VSLb_ts_req
(
req
,
"Start"
,
W_TIM_real
(
wrk
));
...
...
@@ -226,15 +226,15 @@ vped_task(struct worker *wrk, void *priv)
pesi_destroy
(
&
pesi
);
req_fini
(
&
req
,
wrk
);
AZ
(
pesi
);
task_fini
(
pesi_t
ree
,
pesi
);
task_fini
(
pesi_t
asks
,
pesi
);
break
;
case
T_SUBREQ
:
assert
(
pesi
==
req
->
transport_priv
);
Lck_Lock
(
&
pesi_t
ree
->
bytes_tree
->
tree_lock
);
task_fini
(
pesi_t
ree
,
pesi
);
Lck_Lock
(
&
pesi_t
asks
->
bytes_tree
->
tree_lock
);
task_fini
(
pesi_t
asks
,
pesi
);
node
->
subreq
.
done
=
1
;
AZ
(
pthread_cond_signal
(
&
node
->
subreq
.
cond
));
Lck_Unlock
(
&
pesi_t
ree
->
bytes_tree
->
tree_lock
);
Lck_Unlock
(
&
pesi_t
asks
->
bytes_tree
->
tree_lock
);
break
;
case
T_NEXUS
:
assert
(
node
->
nexus
.
req
==
req
);
...
...
@@ -250,11 +250,11 @@ vped_task(struct worker *wrk, void *priv)
AZ
(
req
->
transport_priv
);
pesi
=
NULL
;
Lck_Lock
(
&
pesi_t
ree
->
bytes_tree
->
tree_lock
);
set_closed
(
pesi_t
ree
->
bytes_tree
,
node
,
wrk
);
Lck_Unlock
(
&
pesi_t
ree
->
bytes_tree
->
tree_lock
);
Lck_Lock
(
&
pesi_t
asks
->
bytes_tree
->
tree_lock
);
set_closed
(
pesi_t
asks
->
bytes_tree
,
node
,
wrk
);
Lck_Unlock
(
&
pesi_t
asks
->
bytes_tree
->
tree_lock
);
AZ
(
pesi
);
task_fini
(
pesi_t
ree
,
pesi
);
task_fini
(
pesi_t
asks
,
pesi
);
break
;
}
...
...
@@ -286,14 +286,14 @@ vped_task(struct worker *wrk, void *priv)
req_fini
(
&
node
->
nexus
.
req
,
wrk
);
/* turn into T_DATA node */
node_mutate_prep
(
pesi_t
ree
->
bytes_tree
,
node
);
node_mutate_prep
(
pesi_t
asks
->
bytes_tree
,
node
);
memset
(
&
node
->
data
,
0
,
sizeof
node
->
data
);
node_mutate_lock
(
pesi_t
ree
->
bytes_tree
,
node
,
node_mutate_lock
(
pesi_t
asks
->
bytes_tree
,
node
,
T_DATA
,
ST_DATA
);
node_mutate_unlock
(
pesi_t
ree
->
bytes_tree
);
node_mutate_unlock
(
pesi_t
asks
->
bytes_tree
);
task_fini
(
pesi_t
ree
,
pesi
);
task_fini
(
pesi_t
asks
,
pesi
);
break
;
default:
INCOMPL
();
...
...
@@ -310,7 +310,7 @@ vped_include(struct req *preq, const char *src, const char *host,
{
struct
worker
*
wrk
;
struct
sess
*
sp
;
struct
pesi_t
ree
*
pesi_tree
;
struct
pesi_t
asks
*
pesi_tasks
;
struct
req
*
req
;
struct
bytes_tree
*
tree
;
struct
pesi
*
pesi2
;
...
...
@@ -321,9 +321,9 @@ vped_include(struct req *preq, const char *src, const char *host,
sp
=
preq
->
sp
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi
,
PESI_MAGIC
);
pesi_t
ree
=
pesi
->
pesi_tree
;
CHECK_OBJ_NOTNULL
(
pesi_t
ree
,
PESI_TREE_MAGIC
);
tree
=
pesi_t
ree
->
bytes_tree
;
pesi_t
asks
=
pesi
->
pesi_tasks
;
CHECK_OBJ_NOTNULL
(
pesi_t
asks
,
PESI_TREE_MAGIC
);
tree
=
pesi_t
asks
->
bytes_tree
;
CHECK_OBJ_NOTNULL
(
tree
,
BYTES_TREE_MAGIC
);
CHECK_OBJ_NOTNULL
(
node
,
NODE_MAGIC
);
wrk
=
preq
->
wrk
;
...
...
@@ -406,7 +406,7 @@ vped_include(struct req *preq, const char *src, const char *host,
req
->
transport
=
&
VPED_transport
;
pesi2
=
pesi_new
(
req
->
ws
,
pesi_t
ree
);
pesi2
=
pesi_new
(
req
->
ws
,
pesi_t
asks
);
if
(
pesi2
==
NULL
)
{
VSLb
(
req
->
vsl
,
SLT_Error
,
"Cannot allocate workspace for parallel ESI data"
);
...
...
@@ -524,8 +524,8 @@ pesi_buf_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
unsigned
refok
;
CAST_OBJ_NOTNULL
(
pesi
,
*
priv
,
PESI_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi
->
pesi_t
ree
,
PESI_TREE_MAGIC
);
tree
=
pesi
->
pesi_t
ree
->
bytes_tree
;
CHECK_OBJ_NOTNULL
(
pesi
->
pesi_t
asks
,
PESI_TREE_MAGIC
);
tree
=
pesi
->
pesi_t
asks
->
bytes_tree
;
CHECK_OBJ_NOTNULL
(
tree
,
BYTES_TREE_MAGIC
);
if
(
tree
->
retval
||
ptr
==
NULL
||
len
==
0
)
...
...
@@ -731,7 +731,7 @@ vdp_pesi_init(VRT_CTX, struct vdp_ctx *vdc, void **priv, struct objcore *oc)
struct
req
*
req
;
struct
pesi
*
pesi
;
struct
pecx
*
pecx
;
struct
pesi_t
ree
*
pesi_tree
;
struct
pesi_t
asks
*
pesi_tasks
;
struct
node
*
root_node
;
CHECK_OBJ_NOTNULL
(
vdc
,
VDP_CTX_MAGIC
);
...
...
@@ -765,27 +765,27 @@ vdp_pesi_init(VRT_CTX, struct vdp_ctx *vdc, void **priv, struct objcore *oc)
AZ
(
req
->
esi_level
);
if
((
pesi_t
ree
=
WS_Alloc
(
req
->
ws
,
sizeof
(
*
pesi_tree
)))
==
NULL
)
{
if
((
pesi_t
asks
=
WS_Alloc
(
req
->
ws
,
sizeof
(
*
pesi_tasks
)))
==
NULL
)
{
VSLb
(
req
->
vsl
,
SLT_Error
,
"insufficient workspace for "
"global parallel ESI data"
);
return
(
-
1
);
}
INIT_OBJ
(
pesi_t
ree
,
PESI_TREE_MAGIC
);
INIT_OBJ
(
pesi_t
asks
,
PESI_TREE_MAGIC
);
if
((
pesi_t
ree
->
bytes_tree
=
WS_Alloc
(
req
->
ws
,
sizeof
(
*
pesi_tree
->
bytes_tree
)))
if
((
pesi_t
asks
->
bytes_tree
=
WS_Alloc
(
req
->
ws
,
sizeof
(
*
pesi_tasks
->
bytes_tree
)))
==
NULL
)
{
VSLb
(
req
->
vsl
,
SLT_Error
,
"insufficient workspace for "
"parallel ESI tree data"
);
return
(
-
1
);
}
Lck_New
(
&
pesi_t
ree
->
task_lock
,
lck_pesi_tree
);
AZ
(
pthread_cond_init
(
&
pesi_t
ree
->
task_cond
,
NULL
));
VTAILQ_INIT
(
&
pesi_t
ree
->
task_head
);
AZ
(
pesi_t
ree
->
task_running
);
Lck_New
(
&
pesi_t
asks
->
task_lock
,
lck_pesi_tasks
);
AZ
(
pthread_cond_init
(
&
pesi_t
asks
->
task_cond
,
NULL
));
VTAILQ_INIT
(
&
pesi_t
asks
->
task_head
);
AZ
(
pesi_t
asks
->
task_running
);
pesi
=
pesi_new
(
req
->
ws
,
pesi_t
ree
);
pesi
=
pesi_new
(
req
->
ws
,
pesi_t
asks
);
if
(
pesi
==
NULL
)
{
VSLb
(
req
->
vsl
,
SLT_Error
,
"Cannot allocate workspace for parallel ESI data"
);
...
...
@@ -800,7 +800,7 @@ vdp_pesi_init(VRT_CTX, struct vdp_ctx *vdc, void **priv, struct objcore *oc)
root_node
=
node_alloc
(
pesi
);
root_node_init
(
root_node
,
req
);
bytes_tree_init
(
pesi_t
ree
->
bytes_tree
,
root_node
);
bytes_tree_init
(
pesi_t
asks
->
bytes_tree
,
root_node
);
pesi
->
node
=
root_node
;
AZ
(
pecx
->
state
);
...
...
@@ -818,15 +818,15 @@ vdp_pesi_fini(struct vdp_ctx *vdc, void **priv)
{
struct
req
*
req
;
struct
pesi
*
pesi
;
struct
pesi_t
ree
*
pesi_tree
;
struct
pesi_t
asks
*
pesi_tasks
;
struct
node
*
node
;
CHECK_OBJ_NOTNULL
(
vdc
,
VDP_CTX_MAGIC
);
AN
(
priv
);
CAST_OBJ_NOTNULL
(
pesi
,
*
priv
,
PESI_MAGIC
);
pesi_t
ree
=
pesi
->
pesi_tree
;
CHECK_OBJ_NOTNULL
(
pesi_t
ree
,
PESI_TREE_MAGIC
);
pesi_t
asks
=
pesi
->
pesi_tasks
;
CHECK_OBJ_NOTNULL
(
pesi_t
asks
,
PESI_TREE_MAGIC
);
node
=
pesi
->
node
;
CHECK_OBJ_NOTNULL
(
node
,
NODE_MAGIC
);
...
...
@@ -863,11 +863,11 @@ vdp_pesi_fini(struct vdp_ctx *vdc, void **priv)
assert
(
req
->
transport_priv
==
NULL
||
*
(
unsigned
*
)
req
->
transport_priv
!=
PESI_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi_t
ree
,
PESI_TREE_MAGIC
);
assert
(
pesi_t
ree
==
pesi
->
pesi_tree
);
CHECK_OBJ_NOTNULL
(
pesi_t
asks
,
PESI_TREE_MAGIC
);
assert
(
pesi_t
asks
==
pesi
->
pesi_tasks
);
pesi_destroy
(
&
pesi
);
task_fini
(
pesi_t
ree
,
pesi
);
task_fini
(
pesi_t
asks
,
pesi
);
/*
* ensure that all tasks are done
...
...
@@ -875,20 +875,20 @@ vdp_pesi_fini(struct vdp_ctx *vdc, void **priv)
* there can be at most one signal ever being posted on task_cond, so,
* deliberately, this is if (...) not while (...)
*/
if
(
pesi_t
ree
->
task_running
>
0
)
{
Lck_Lock
(
&
pesi_t
ree
->
task_lock
);
if
(
pesi_t
ree
->
task_running
>
0
)
AZ
(
Lck_CondWait
(
&
pesi_t
ree
->
task_cond
,
&
pesi_t
ree
->
task_lock
));
Lck_Unlock
(
&
pesi_t
ree
->
task_lock
);
if
(
pesi_t
asks
->
task_running
>
0
)
{
Lck_Lock
(
&
pesi_t
asks
->
task_lock
);
if
(
pesi_t
asks
->
task_running
>
0
)
AZ
(
Lck_CondWait
(
&
pesi_t
asks
->
task_cond
,
&
pesi_t
asks
->
task_lock
));
Lck_Unlock
(
&
pesi_t
asks
->
task_lock
);
}
bytes_tree_fini
(
pesi_t
ree
->
bytes_tree
,
req
->
vdc
);
bytes_tree_fini
(
pesi_t
asks
->
bytes_tree
,
req
->
vdc
);
AZ
(
pesi_t
ree
->
task_running
);
assert
(
VTAILQ_EMPTY
(
&
pesi_t
ree
->
task_head
));
Lck_Delete
(
&
pesi_t
ree
->
task_lock
);
AZ
(
pthread_cond_destroy
(
&
pesi_t
ree
->
task_cond
));
AZ
(
pesi_t
asks
->
task_running
);
assert
(
VTAILQ_EMPTY
(
&
pesi_t
asks
->
task_head
));
Lck_Delete
(
&
pesi_t
asks
->
task_lock
);
AZ
(
pthread_cond_destroy
(
&
pesi_t
asks
->
task_cond
));
*
priv
=
NULL
;
return
(
0
);
...
...
@@ -947,10 +947,10 @@ vdp_pesi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
AN
(
priv
);
CAST_OBJ_NOTNULL
(
pesi
,
*
priv
,
PESI_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi
->
pecx
,
PECX_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi
->
pesi_t
ree
,
PESI_TREE_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi
->
pesi_t
ree
->
bytes_tree
,
BYTES_TREE_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi
->
pesi_t
asks
,
PESI_TREE_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi
->
pesi_t
asks
->
bytes_tree
,
BYTES_TREE_MAGIC
);
pecx
=
pesi
->
pecx
;
tree
=
pesi
->
pesi_t
ree
->
bytes_tree
;
tree
=
pesi
->
pesi_t
asks
->
bytes_tree
;
node
=
pesi
->
node
;
CHECK_OBJ_NOTNULL
(
node
,
NODE_MAGIC
);
...
...
@@ -1321,9 +1321,9 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody)
CHECK_OBJ_NOTNULL
(
req
->
objcore
,
OBJCORE_MAGIC
);
CAST_OBJ_NOTNULL
(
pesi
,
req
->
transport_priv
,
PESI_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi
->
pesi_t
ree
,
PESI_TREE_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi
->
pesi_t
ree
->
bytes_tree
,
BYTES_TREE_MAGIC
);
tree
=
pesi
->
pesi_t
ree
->
bytes_tree
;
CHECK_OBJ_NOTNULL
(
pesi
->
pesi_t
asks
,
PESI_TREE_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi
->
pesi_t
asks
->
bytes_tree
,
BYTES_TREE_MAGIC
);
tree
=
pesi
->
pesi_t
asks
->
bytes_tree
;
node
=
pesi
->
node
;
parent
=
node
->
parent
;
...
...
src/vdp_pesi.h
View file @
f5c724ee
...
...
@@ -29,7 +29,7 @@
* interfaces shared between vdp_pesi.c and vmod_pesi.c
*/
extern
struct
VSC_lck
*
lck_bytes_tree
,
*
lck_pesi_t
ree
;
extern
struct
VSC_lck
*
lck_bytes_tree
,
*
lck_pesi_t
asks
;
extern
const
struct
vdp
VDP_pesi
;
/* ------------------------------------------------------------
...
...
src/vmod_pesi.c
View file @
f5c724ee
...
...
@@ -350,10 +350,10 @@ vmod_event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
if
(
loadcnt
++
==
0
)
{
AZ
(
vsc_seg
);
lck_bytes_tree
=
Lck_CreateClass
(
&
vsc_seg
,
"pesi.buf"
);
lck_pesi_t
ree
=
Lck_CreateClass
(
&
vsc_seg
,
"pesi.tasks"
);
lck_pesi_t
asks
=
Lck_CreateClass
(
&
vsc_seg
,
"pesi.tasks"
);
lck_stats
=
Lck_CreateClass
(
&
vsc_seg
,
"pesi.stats"
);
AN
(
lck_bytes_tree
);
AN
(
lck_pesi_t
ree
);
AN
(
lck_pesi_t
asks
);
AZ
(
pesi_vsc_seg
);
stats
=
VSC_pesi_New
(
NULL
,
&
pesi_vsc_seg
,
""
);
AN
(
stats
);
...
...
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