diff options
author | Craig Tiller <ctiller@google.com> | 2016-07-13 20:25:13 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-07-13 20:25:13 -0700 |
commit | 2ea0104fc48fc91159ea85c8dc50ec3c9227195b (patch) | |
tree | 03d09b50a92ed24e722bdb6d3b6208b82dd6bcd9 /src/core/ext | |
parent | 6f59a86ae3894349b57ca535f786fa86177e4f3f (diff) |
Add a quick note on the write chain execution\nthis is changed already in a future commit, so this should be enough for now
Diffstat (limited to 'src/core/ext')
-rw-r--r-- | src/core/ext/transport/chttp2/transport/chttp2_transport.c | 19 | ||||
-rw-r--r-- | src/core/ext/transport/chttp2/transport/internal.h | 5 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 554a0f56dc..be8a8f8498 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -802,6 +802,25 @@ void grpc_chttp2_run_with_global_lock(grpc_exec_ctx *exec_ctx, void grpc_chttp2_initiate_write(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_global *transport_global, bool covered_by_poller, const char *reason) { + /* Perform state checks, and transition to a scheduled state if appropriate. + Each time we finish the global lock execution, we check if we need to + write. If we do: + - (if there is a poller surrounding the write) schedule + initiate_writing, which locks and calls initiate_writing_locked to... + - call start_writing, which verifies (under the global lock) that there + are things that need to be written by calling + grpc_chttp2_unlocking_check_writes, and if so schedules writing_action + against the current exec_ctx, to be executed OUTSIDE of the global lock + - eventually writing_action results in grpc_chttp2_terminate_writing being + called, which re-takes the global lock, updates state, checks if we need + to do *another* write immediately, and if so loops back to + start_writing. + + Current problems: + - too much lock entry/exiting + - the writing thread can become stuck indefinitely (punt through the + workqueue periodically to fix) */ + grpc_chttp2_transport *t = TRANSPORT_FROM_GLOBAL(transport_global); switch (t->executor.write_state) { case GRPC_CHTTP2_WRITING_INACTIVE: diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 71517c22f4..e1dcf5262a 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -542,7 +542,10 @@ struct grpc_chttp2_stream { to write. The global lock is dropped and we do the syscall to write. After writing, a follow-up check is made to see if another round of writing - should be performed. */ + should be performed. + + The actual call chain is documented in the implementation of this function. + */ void grpc_chttp2_initiate_write(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_global *transport_global, bool covered_by_poller, const char *reason); |