MDEV-23855, I introduced a log_flush_task with the reasoning that invoking a single large log write for every page write batch could be faster than invoking log_write_up_to() for every individual page that is to be written.
wlad pointed out that the wait for the task could actually reduce performance. Quick benchmarks suggest that removing the log_flush_task could slightly improve performance in the typical case. (In a pathological worst case, I suspect that it could reduce performance, but I suppose that such cases are unlikely.)
When the doublewrite buffer is being used, we can write potentially "future" pages to it. Only before writing pages to the final location we must not adhere to the write-ahead-logging protocol. Thus, in many cases, a log write could meanwhile have happened for other reasons (such as making a transaction commit durable) before we actually get to the final write of the page.