[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YfF//E5hUNJKqg2g@alley>
Date: Wed, 26 Jan 2022 18:08:12 +0100
From: Petr Mladek <pmladek@...e.com>
To: John Ogness <john.ogness@...utronix.de>
Cc: Mukesh Ojha <quic_mojha@...cinc.com>, linux-kernel@...r.kernel.org,
senozhatsky@...omium.org, rostedt@...dmis.org
Subject: Re: [PATCH v3] printk: ringbuffer: Improve prb_next_seq() performance
On Fri 2022-01-21 15:14:41, John Ogness wrote:
> Hi Mukesh,
>
> Thanks for pushing this. I think it got lost somewhere. I have a couple
> very minor non-functional change requests.
Yes, thanks for pushing this. I have somehow lost this patch on my radar.
> On 2022-01-21, Mukesh Ojha <quic_mojha@...cinc.com> wrote:
> > From: Petr Mladek <pmladek@...e.com>
> >
> > prb_next_seq() always iterates from the first known sequence number.
> > In the worst case, it might loop 8k times for 256kB buffer,
> > 15k times for 512kB buffer, and 64k times for 2MB buffer.
> >
> > It was reported that pooling and reading using syslog interface
>
> ^^^^^^^ polling
>
> > might occupy 50% of CPU.
> >
> > Speedup the search by storing @id of the last finalized descriptor.
> >
> > The loop is still needed because the @id is stored and read in the best
> > effort way. An atomic variable is used to keep the @id consistent.
> > But the stores and reads are not serialized against each other.
> > The descriptor could get reused in the meantime. The related sequence
> > number will be used only when it is still valid.
> >
> > An invalid value should be read _only_ when there is a flood of messages
> > and the ringbuffer is rapidly reused. The performance is the least
> > problem in this case.
> >
> > Link: https://lore.kernel.org/lkml/YXlddJxLh77DKfIO@alley/T/#m43062e8b2a17f8dbc8c6ccdb8851fb0dbaabbb14
> > Reported-by: Chunlei Wang <chunlei.wang@...iatek.com>
> > Signed-off-by: Petr Mladek <pmladek@...e.com>
> > Signed-off-by: Mukesh Ojha <quic_mojha@...cinc.com>
> > ---
> > Changes against v2:
> > Added the hunk suggested by John
> >
> Petr can probably just make the changes when committing. I am not
> requesting a v4.
>
> @Petr: Feel free to add:
>
> Reviewed-by: John Ogness <john.ogness@...utronix.de>
I made the changes suggested by John. Also I have reverted few more
formatting changes. The result is basically v2 + the hunk suggested
by John.
The patch is committed in printk/linux.git, branch
rework/fast-next-seq. I am going to queue it for 5.18.
Best Regards,
Petr
Powered by blists - more mailing lists