Introduce cooperative multitasking module which allows us to interleave important processing with long running tasks while avoiding the additional resource consumption of threads and complexity of asynchronous state machines.
We will use this module to ensure long running processing in the OVSDB server does not interfere with stable maintenance of the RAFT cluster in subsequent patches. Relevant discussion: https://mail.openvswitch.org/pipermail/ovs-discuss/2022-December/052140.html https://mail.openvswitch.org/pipermail/ovs-dev/2023-December/410262.html v1 -> v2: * Address review feedback. * Drop json_serialized_object_with_yield(), not needed. * Create OVS private header for json library and update the include guard of the public header to be consistent with other public headers. * Drop patch that reorders execution in ovsdb-server main loop. v2 -> v3: * Address review feedback. * Shift yield threshold for RAFT to avoid premature yields when idle (thanks to Ilya for the suggestion). * Reintroduce json_serialized_object_with_yield() with yield at the appropriate places (thanks, Ilya!). Frode Nordahl (5): timeval: Add internal timewarp interface. lib: Introduce cooperative multitasking module. ovsdb raft: Enable cooperative multitasking. json: Add yielding json create/destroy functions. ovsdb-server: Make use of cooperative multitasking. NEWS | 2 + include/openvswitch/json.h | 10 +- lib/automake.mk | 4 + lib/cooperative-multitasking-private.h | 33 +++ lib/cooperative-multitasking.c | 157 +++++++++++++ lib/cooperative-multitasking.h | 115 +++++++++ lib/json.c | 58 ++++- lib/json.h | 32 +++ lib/timeval.c | 28 ++- lib/timeval.h | 3 + ovsdb/file.c | 3 + ovsdb/jsonrpc-server.c | 3 + ovsdb/monitor.c | 15 +- ovsdb/ovsdb-server.c | 2 + ovsdb/raft.c | 23 +- ovsdb/trigger.c | 3 + tests/automake.mk | 1 + tests/library.at | 10 + tests/ovsdb-server.at | 1 + tests/test-cooperative-multitasking.c | 307 +++++++++++++++++++++++++ 20 files changed, 787 insertions(+), 23 deletions(-) create mode 100644 lib/cooperative-multitasking-private.h create mode 100644 lib/cooperative-multitasking.c create mode 100644 lib/cooperative-multitasking.h create mode 100644 lib/json.h create mode 100644 tests/test-cooperative-multitasking.c -- 2.34.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
