[PATCH] Fix prb_next_seq() performance issue
Petr Mladek
pmladek at suse.com
Mon Oct 25 06:18:25 PDT 2021
On Mon 2021-10-25 13:51:07, chunlei.wang wrote:
>
> Subject: [PATCH] Fix prb_next_seq() performance issue.
>
> prb_next_seq() function have a performance issue, in bad case it will
> check all the seqs. If log buffer is 256K, the number of while loop
> is 8K, 512K is 16K, 2M is 64K, it will cause performance issue.
> we have a process use do_syslog poll&read method to read kernel log,
> sometime the cpu loading is 50%. So we add old_seq to reduce the
> loop time. It only check new log times.
The patch looks good and probably helps in the described use-case.
But the search might still be quite slow because @clear_seq or
@sysrq_seq might be far behind the last_seq.
I am going to send alternative patch that stores @id of the last
finalized message. It starts the search from there. All the tricks
will be hidden in the ring buffer code, so that it will be
easier to use. Also it should be more reliable.
Best Regards,
Petr
More information about the Linux-mediatek
mailing list