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
fc59c745
Commit
fc59c745
authored
Sep 17, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Give each pool a list of sockets to accept() from
parent
738cafa0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
5 deletions
+32
-5
cache_pool.c
bin/varnishd/cache_pool.c
+32
-5
No files found.
bin/varnishd/cache_pool.c
View file @
fc59c745
...
...
@@ -62,6 +62,13 @@ static void *waiter_priv;
VTAILQ_HEAD
(
workerhead
,
worker
);
struct
poolsock
{
unsigned
magic
;
#define POOLSOCK_MAGIC 0x1b0a2d38
VTAILQ_ENTRY
(
poolsock
)
list
;
int
sock
;
};
/* Number of work requests queued in excess of worker threads available */
struct
pool
{
...
...
@@ -70,6 +77,7 @@ struct pool {
struct
lock
mtx
;
struct
workerhead
idle
;
VTAILQ_HEAD
(,
sess
)
queue
;
VTAILQ_HEAD
(,
poolsock
)
socks
;
unsigned
nthr
;
unsigned
lqueue
;
unsigned
last_lqueue
;
...
...
@@ -237,6 +245,29 @@ Pool_QueueSession(struct sess *sp)
* Add (more) thread pools
*/
static
struct
pool
*
pool_mkpool
(
void
)
{
struct
pool
*
pp
;
struct
listen_sock
*
ls
;
struct
poolsock
*
ps
;
ALLOC_OBJ
(
pp
,
POOL_MAGIC
);
XXXAN
(
pp
);
Lck_New
(
&
pp
->
mtx
,
lck_wq
);
VTAILQ_INIT
(
&
pp
->
queue
);
VTAILQ_INIT
(
&
pp
->
idle
);
VTAILQ_INIT
(
&
pp
->
socks
);
VTAILQ_FOREACH
(
ls
,
&
heritage
.
socks
,
list
)
{
ALLOC_OBJ
(
ps
,
POOLSOCK_MAGIC
);
XXXAN
(
ps
);
ps
->
sock
=
ls
->
sock
;
VTAILQ_INSERT_TAIL
(
&
pp
->
socks
,
ps
,
list
);
}
return
(
pp
);
}
static
void
wrk_addpools
(
const
unsigned
pools
)
{
...
...
@@ -251,12 +282,8 @@ wrk_addpools(const unsigned pools)
owq
=
wq
;
wq
=
pwq
;
for
(
u
=
nwq
;
u
<
pools
;
u
++
)
{
wq
[
u
]
=
calloc
(
sizeof
*
wq
[
0
],
1
);
wq
[
u
]
=
pool_mkpool
(
);
XXXAN
(
wq
[
u
]);
wq
[
u
]
->
magic
=
POOL_MAGIC
;
Lck_New
(
&
wq
[
u
]
->
mtx
,
lck_wq
);
VTAILQ_INIT
(
&
wq
[
u
]
->
queue
);
VTAILQ_INIT
(
&
wq
[
u
]
->
idle
);
}
(
void
)
owq
;
/* XXX: avoid race, leak it. */
nwq
=
pools
;
...
...
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