lkml.org 
[lkml]   [2019]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFC PATCH v1 07/25] printk-rb: add functionality required by printk
On Tue, Feb 12, 2019 at 6:30 AM John Ogness <john.ogness@linutronix.de> wrote:
>
> + while (atomic_long_read(&rb->lost)) {
> + atomic_long_dec(&rb->lost);
> + rb->seq++;
> + }

This looks like crazy garbage. It's neither atomic nor sane.

Why isn't it something like

if (atomic_long_read(&rb->lost)) {
long lost = atomic_xchg(&rb->lost, 0);
rb->seq += lost;
}

instead?

Linus

\
 
 \ /
  Last update: 2019-02-12 18:18    [W:1.621 / U:0.616 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site