Re: [PATCH] tracing: Fix to avoid wakeup loop in splice read of per-cpu buffer

From: Steven Rostedt
Date: Mon Aug 21 2023 - 11:26:53 EST


On Tue, 22 Aug 2023 00:16:39 +0900
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> wrote:

> BTW, even with this fix, blocking splice still causes a strange behavior.
> If I set '400' to buffer_size_kb (so 100 pages) and '1' to buffer_percent,
> splice always returns 8192 (2 pages) to read. But I expected that should
> return 4096 (1 page). This means splice() waits longer than I thought.
>
> I think the fullfilled percentage calculation will be a bit wrong.

Note, the percentage is when to wake up the task. If between the wakeup and
the read/splice, another ring buffer page gets filled more, then it will
give that as well. The buffer_percent is just how long to wait, not for how
much to read.

Now if you test this with just adding enough to fill one page, and it
doesn't wake up the reader, then that would be a bug.

-- Steve