]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ring-buffer: Fix bytes_dropped calculation issue
authorFeng Yang <yangfeng@kylinos.cn>
Sun, 23 Feb 2025 07:01:06 +0000 (15:01 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:30:59 +0000 (14:30 +0200)
[ Upstream commit c73f0b69648501978e8b3e8fa7eef7f4197d0481 ]

The calculation of bytes-dropped and bytes_dropped_nested is reversed.
Although it does not affect the final calculation of total_dropped,
it should still be modified.

Link: https://lore.kernel.org/20250223070106.6781-1-yangfeng59949@163.com
Fixes: 6c43e554a2a5 ("ring-buffer: Add ring buffer startup selftest")
Signed-off-by: Feng Yang <yangfeng@kylinos.cn>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/trace/ring_buffer.c

index 9a2c8727b033daabfdbed8774a1861b31331347b..225dbe4a5641321d67df90f4f63ce944f7cfd3fa 100644 (file)
@@ -5768,9 +5768,9 @@ static __init int rb_write_something(struct rb_test_data *data, bool nested)
                /* Ignore dropped events before test starts. */
                if (started) {
                        if (nested)
-                               data->bytes_dropped += len;
-                       else
                                data->bytes_dropped_nested += len;
+                       else
+                               data->bytes_dropped += len;
                }
                return len;
        }