public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: linux-kernel@vger.kernel.org, Uros Bizjak <ubizjak@gmail.com>,
	linux-block@vger.kernel.org
Subject: Re: [PATCH RESEND v2] sbitmap: Use atomic_long_try_cmpxchg in __sbitmap_queue_get_batch
Date: Thu, 08 Sep 2022 09:23:03 -0600	[thread overview]
Message-ID: <166265058355.492758.3474516202964637778.b4-ty@kernel.dk> (raw)
In-Reply-To: <20220908151200.9993-1-ubizjak@gmail.com>

On Thu, 8 Sep 2022 17:12:00 +0200, Uros Bizjak wrote:
> Use atomic_long_try_cmpxchg instead of
> atomic_long_cmpxchg (*ptr, old, new) == old in __sbitmap_queue_get_batch.
> x86 CMPXCHG instruction returns success in ZF flag, so this change
> saves a compare after cmpxchg (and related move instruction in front
> of cmpxchg).
> 
> Also, atomic_long_cmpxchg implicitly assigns old *ptr value to "old"
> when cmpxchg fails, enabling further code simplifications, e.g.
> an extra memory read can be avoided in the loop.
> 
> [...]

Applied, thanks!

[1/1] sbitmap: Use atomic_long_try_cmpxchg in __sbitmap_queue_get_batch
      commit: c35227d4e8cbc70a6622cc7cc5f8c3bff513f1fa

Best regards,
-- 
Jens Axboe



      reply	other threads:[~2022-09-08 15:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08 15:12 [PATCH RESEND v2] sbitmap: Use atomic_long_try_cmpxchg in __sbitmap_queue_get_batch Uros Bizjak
2022-09-08 15:23 ` Jens Axboe [this message]

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=166265058355.492758.3474516202964637778.b4-ty@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ubizjak@gmail.com \
    /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