Re: [RFC PATCH v1 07/25] printk-rb: add functionality required by printk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 12, 2019 at 6:30 AM John Ogness <john.ogness@xxxxxxxxxxxxx> 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



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux