mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-05 22:56:57 +02:00
MEDIUM: dynbuf/stream: do not allocate the buffers in the callback
One of the problematic designs with the buffer_wait mechanism is that the callbacks pre-allocate the buffers and stay in the run queue for a while, resulting in all of the few buffers being assigned to waiting tasks instead of being all available to one task that needs them all at once. Here we simply stop doing this, the callback clears the waiting flags and wakes the task up so that it has a chance of still finding some buffers.
This commit is contained in:
parent
db21062881
commit
9a27d7aa6f
@ -320,14 +320,11 @@ int stream_buf_available(void *arg)
|
|||||||
{
|
{
|
||||||
struct stream *s = arg;
|
struct stream *s = arg;
|
||||||
|
|
||||||
if (!s->req.buf.size && !sc_ep_have_ff_data(s->scb) && s->scf->flags & SC_FL_NEED_BUFF &&
|
if (!s->req.buf.size && !sc_ep_have_ff_data(s->scb) && s->scf->flags & SC_FL_NEED_BUFF)
|
||||||
b_alloc(&s->req.buf, DB_CHANNEL))
|
|
||||||
sc_have_buff(s->scf);
|
sc_have_buff(s->scf);
|
||||||
else if (!s->res.buf.size && !sc_ep_have_ff_data(s->scf) && s->scb->flags & SC_FL_NEED_BUFF &&
|
|
||||||
b_alloc(&s->res.buf, DB_CHANNEL))
|
if (!s->res.buf.size && !sc_ep_have_ff_data(s->scf) && s->scb->flags & SC_FL_NEED_BUFF)
|
||||||
sc_have_buff(s->scb);
|
sc_have_buff(s->scb);
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
task_wakeup(s->task, TASK_WOKEN_RES);
|
task_wakeup(s->task, TASK_WOKEN_RES);
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user