linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: hev <r@hev.cc>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Rui Wang <wangrui@loongson.cn>,
	Peter Zijlstra <peterz@infradead.org>,
	Will Deacon <will@kernel.org>, Boqun Feng <boqun.feng@gmail.com>,
	linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org
Subject: Re: [RFC PATCH] locking/atomic: arch/mips: Fix atomic{_64,}_sub_if_positive
Date: Thu, 29 Jul 2021 20:31:11 +0800	[thread overview]
Message-ID: <CAHirt9hLATcnSw9HXSo-TZ+buNHJXJvFtJEy56_Bi+mOfckNjw@mail.gmail.com> (raw)
In-Reply-To: <20210729095342.GB8286@alpha.franken.de>

Hi, Thomas,

On Thu, Jul 29, 2021 at 5:53 PM Thomas Bogendoerfer
<tsbogend@alpha.franken.de> wrote:
>
> On Thu, Jul 29, 2021 at 04:25:49PM +0800, Rui Wang wrote:
> > This looks like a typo and that caused atomic64 test failed.
> >
> > Signed-off-by: Rui Wang <wangrui@loongson.cn>
> > Signed-off-by: hev <r@hev.cc>
> > ---
> >  arch/mips/include/asm/atomic.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h
> > index 95e1f7f3597f..a0b9e7c1e4fc 100644
> > --- a/arch/mips/include/asm/atomic.h
> > +++ b/arch/mips/include/asm/atomic.h
> > @@ -206,7 +206,7 @@ ATOMIC_OPS(atomic64, xor, s64, ^=, xor, lld, scd)
> >   * The function returns the old value of @v minus @i.
> >   */
> >  #define ATOMIC_SIP_OP(pfx, type, op, ll, sc)                         \
> > -static __inline__ int arch_##pfx##_sub_if_positive(type i, pfx##_t * v)      \
> > +static __inline__ type arch_##pfx##_sub_if_positive(type i, pfx##_t * v)     \
> >  {                                                                    \
> >       type temp, result;                                              \
> >                                                                       \
>
> sub_if_postive looks unused to me. Could you send a patch removing it
> instead ? riscv also has a sub_if_positive implementation, which looks
> unused.
I found atomic{_64,}_dec_if_postive is based on sub_if_postive, and
used in many places:

kernel/kmod.c:    if (atomic_dec_if_positive(&kmod_concurrent_max) < 0) {
kernel/kmod.c:
atomic_dec_if_positive(&kmod_concurrent_max) >= 0,
kernel/module.c:        ret = atomic_dec_if_positive(&module->refcnt);
...
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c:
atomic64_dec_if_positive(&esw->user_count);
drivers/net/netdevsim/fib.c:        atomic64_dec_if_positive(&entry->num);
drivers/net/netdevsim/fib.c:        atomic64_dec_if_positive(&entry->num);

Are you sure to remove it?

Regards,
Rui

>
> Thomas.
>
> --
> Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
> good idea.                                                [ RFC1925, 2.3 ]

  parent reply	other threads:[~2021-07-29 12:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29  8:25 [RFC PATCH] locking/atomic: arch/mips: Fix atomic{_64,}_sub_if_positive Rui Wang
2021-07-29  9:03 ` Boqun Feng
2021-07-29  9:15   ` hev
2021-07-29  9:53 ` Thomas Bogendoerfer
2021-07-29 11:00   ` hev
2021-07-29 12:31   ` hev [this message]
2021-07-29 14:33     ` Thomas Bogendoerfer
2021-08-04 13:46       ` hev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHirt9hLATcnSw9HXSo-TZ+buNHJXJvFtJEy56_Bi+mOfckNjw@mail.gmail.com \
    --to=r@hev.cc \
    --cc=boqun.feng@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tsbogend@alpha.franken.de \
    --cc=wangrui@loongson.cn \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).