diff options
author | Stefan Eissing <icing@apache.org> | 2022-03-23 09:15:30 +0000 |
---|---|---|
committer | Stefan Eissing <icing@apache.org> | 2022-03-23 09:15:30 +0000 |
commit | 8da00af1c013c93cb2d28270528fa27b57f9d096 (patch) | |
tree | 3e5deb64ffd39b4e491756e3aefeb184074d2815 /modules/http2 | |
parent | 4407147f0239c67fa87cacfba33bae073800f4cf (diff) | |
download | httpd-8da00af1c013c93cb2d28270528fa27b57f9d096.tar.gz |
*) mod_http2: removed extra h2_mplx_worker_c2_done() arg
to retrive another c2 for processing. Just added
complexity without measurable benefits.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899149 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/http2')
-rw-r--r-- | modules/http2/h2_mplx.c | 73 | ||||
-rw-r--r-- | modules/http2/h2_mplx.h | 18 | ||||
-rw-r--r-- | modules/http2/h2_workers.c | 16 |
3 files changed, 38 insertions, 69 deletions
diff --git a/modules/http2/h2_mplx.c b/modules/http2/h2_mplx.c index 28315d76a6..908b58b5bc 100644 --- a/modules/http2/h2_mplx.c +++ b/modules/http2/h2_mplx.c @@ -480,7 +480,6 @@ void h2_mplx_c1_destroy(h2_mplx *m) h2_ihash_iter(m->shold, m_report_stream_iter, m); } } - m->join_wait = NULL; /* 4. With all workers done, all streams should be in spurge */ ap_assert(m->processing_count == 0); @@ -614,20 +613,6 @@ apr_status_t h2_mplx_c1_reprioritize(h2_mplx *m, h2_stream_pri_cmp_fn *cmp, return status; } -static void ms_register_if_needed(h2_mplx *m, int from_master) -{ - if (!m->aborted && !m->is_registered && !h2_iq_empty(m->q)) { - apr_status_t status = h2_workers_register(m->workers, m); - if (status == APR_SUCCESS) { - m->is_registered = 1; - } - else if (from_master) { - ap_log_cerror(APLOG_MARK, APLOG_ERR, status, m->c1, APLOGNO(10021) - "h2_mplx(%ld): register at workers", m->id); - } - } -} - static apr_status_t c1_process_stream(h2_mplx *m, h2_stream *stream, h2_stream_pri_cmp_fn *cmp, @@ -670,17 +655,17 @@ cleanup: return rv; } -apr_status_t h2_mplx_c1_process(h2_mplx *m, - h2_iqueue *ready_to_process, - h2_stream_get_fn *get_stream, - h2_stream_pri_cmp_fn *stream_pri_cmp, - h2_session *session, - int *pstream_count) +void h2_mplx_c1_process(h2_mplx *m, + h2_iqueue *ready_to_process, + h2_stream_get_fn *get_stream, + h2_stream_pri_cmp_fn *stream_pri_cmp, + h2_session *session, + int *pstream_count) { - apr_status_t rv = APR_SUCCESS; + apr_status_t rv; int sid; - H2_MPLX_ENTER(m); + H2_MPLX_ENTER_ALWAYS(m); while ((sid = h2_iq_shift(ready_to_process)) > 0) { h2_stream *stream = get_stream(session, sid); @@ -696,8 +681,18 @@ apr_status_t h2_mplx_c1_process(h2_mplx *m, "h2_stream(%ld-%d): not found to process", m->id, sid); } } - ms_register_if_needed(m, 1); + if (!m->is_registered && !h2_iq_empty(m->q)) { + rv = h2_workers_register(m->workers, m); + if (rv == APR_SUCCESS) { + m->is_registered = 1; + } + else { + ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, m->c1, APLOGNO(10021) + "h2_mplx(%ld): register at workers", m->id); + } + } *pstream_count = (int)h2_ihash_count(m->streams); + #if APR_POOL_DEBUG do { apr_size_t mem_g, mem_m, mem_s, mem_w, mem_c1; @@ -715,7 +710,6 @@ apr_status_t h2_mplx_c1_process(h2_mplx *m, #endif H2_MPLX_LEAVE(m); - return rv; } apr_status_t h2_mplx_c1_fwd_input(h2_mplx *m, struct h2_iqueue *input_pending, @@ -884,11 +878,9 @@ apr_status_t h2_mplx_worker_pop_c2(h2_mplx *m, conn_rec **out_c) *out_c = NULL; ap_assert(m); ap_assert(m->lock); - - if (APR_SUCCESS != (rv = apr_thread_mutex_lock(m->lock))) { - return rv; - } - + + H2_MPLX_ENTER(m); + if (m->aborted) { rv = APR_EOF; } @@ -967,29 +959,18 @@ static void s_c2_done(h2_mplx *m, conn_rec *c2, h2_conn_ctx_t *conn_ctx) } } -void h2_mplx_worker_c2_done(conn_rec *c2, conn_rec **out_c2) +void h2_mplx_worker_c2_done(conn_rec *c2) { h2_conn_ctx_t *conn_ctx = h2_conn_ctx_get(c2); - h2_mplx *m = conn_ctx? conn_ctx->mplx : NULL; - - if (!m) { - if (out_c2) *out_c2 = NULL; - return; - } + h2_mplx *m; + AP_DEBUG_ASSERT(conn_ctx); + m = conn_ctx->mplx; H2_MPLX_ENTER_ALWAYS(m); --m->processing_count; s_c2_done(m, c2, conn_ctx); - - if (m->join_wait) { - apr_thread_cond_signal(m->join_wait); - } - if (out_c2) { - /* caller wants another connection to process */ - *out_c2 = s_next_c2(m); - } - ms_register_if_needed(m, 0); + apr_thread_cond_signal(m->join_wait); H2_MPLX_LEAVE(m); } diff --git a/modules/http2/h2_mplx.h b/modules/http2/h2_mplx.h index 25e0f7450e..b33545fa9c 100644 --- a/modules/http2/h2_mplx.h +++ b/modules/http2/h2_mplx.h @@ -146,12 +146,12 @@ int h2_mplx_c1_stream_is_running(h2_mplx *m, struct h2_stream *stream); * @param cmp the stream priority compare function * @param pstream_count on return the number of streams active in mplx */ -apr_status_t h2_mplx_c1_process(h2_mplx *m, - struct h2_iqueue *read_to_process, - h2_stream_get_fn *get_stream, - h2_stream_pri_cmp_fn *cmp, - struct h2_session *session, - int *pstream_count); +void h2_mplx_c1_process(h2_mplx *m, + struct h2_iqueue *read_to_process, + h2_stream_get_fn *get_stream, + h2_stream_pri_cmp_fn *cmp, + struct h2_session *session, + int *pstream_count); apr_status_t h2_mplx_c1_fwd_input(h2_mplx *m, struct h2_iqueue *input_pending, h2_stream_get_fn *get_stream, @@ -213,12 +213,8 @@ apr_status_t h2_mplx_worker_pop_c2(h2_mplx *m, conn_rec **out_c2); /** * A h2 worker reports a secondary connection processing done. - * If it is will to do more work for this mplx (this c1 connection), - * it provides `out_c`. Otherwise it passes NULL. * @param c2 the secondary connection finished processing - * @param out_c2 NULL or a pointer where to reveive the next - * secondary connection to process. */ -void h2_mplx_worker_c2_done(conn_rec *c2, conn_rec **out_c2); +void h2_mplx_worker_c2_done(conn_rec *c2); #endif /* defined(__mod_h2__h2_mplx__) */ diff --git a/modules/http2/h2_workers.c b/modules/http2/h2_workers.c index 7299a2b0d6..14590f4902 100644 --- a/modules/http2/h2_workers.c +++ b/modules/http2/h2_workers.c @@ -255,18 +255,10 @@ static void* APR_THREAD_FUNC slot_run(apr_thread_t *thread, void *wctx) /* Get the next c2 from mplx to process. */ while (get_next(slot)) { - do { - ap_assert(slot->connection != NULL); - h2_c2_process(slot->connection, thread, slot->id); - if (apr_atomic_read32(&slot->workers->aborted) == 0 && - apr_atomic_read32(&slot->workers->worker_count) < slot->workers->max_workers) { - h2_mplx_worker_c2_done(slot->connection, &slot->connection); - } - else { - h2_mplx_worker_c2_done(slot->connection, NULL); - slot->connection = NULL; - } - } while (slot->connection); + ap_assert(slot->connection != NULL); + h2_c2_process(slot->connection, thread, slot->id); + h2_mplx_worker_c2_done(slot->connection); + slot->connection = NULL; } if (apr_atomic_read32(&slot->timed_out) == 0) { |