public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mateusz Guzik <mjguzik@gmail.com>
To: tglx@linutronix.de, bp@alien8.de, andy@kernel.org,
	akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	Mateusz Guzik <mjguzik@gmail.com>
Subject: [PATCH 0/2] retire bcmp, a redundant wrapper around memcmp
Date: Sat, 23 Nov 2024 10:47:27 +0100	[thread overview]
Message-ID: <20241123094729.1099378-1-mjguzik@gmail.com> (raw)

Reasoning copied from patch 2:
> While architectures could override it thanks to __HAVE_ARCH_BCMP, none
> of them did. Instead it was implemented as a call to memcmp().

> These routines differ in the API contract: memcmp()'s result indicates
> which way the difference goes (making it usable for sorting), whereas
> bcmp()'s result merely states whether the buffers differ in any way.

> This means that a dedicated optimized bcmp() is cheaper to execute than
> memcmp() for differing buffers as there is no need to compute the return
> value.

> However, per the above nobody bothered to write one and it is unclear if
> it makes sense to do it.

> Users which really want to compare stuff may want to handle it
> differently (like e.g., the path lookup).

Mateusz Guzik (2):
  x86/callthunks: s/bcmp/memcmp/
  string: retire bcmp()

 arch/x86/boot/string.c       |  8 --------
 arch/x86/boot/string.h       |  1 -
 arch/x86/kernel/callthunks.c |  6 +++---
 include/linux/string.h       |  3 ---
 lib/Makefile                 |  3 +--
 lib/string.c                 | 19 -------------------
 6 files changed, 4 insertions(+), 36 deletions(-)

-- 
2.43.0


             reply	other threads:[~2024-11-23  9:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-23  9:47 Mateusz Guzik [this message]
2024-11-23  9:47 ` [PATCH 1/2] x86/callthunks: s/bcmp/memcmp/ Mateusz Guzik
2024-11-23  9:47 ` [PATCH 2/2] string: retire bcmp() Mateusz Guzik
2024-11-23 15:13   ` David Laight
2024-11-23 18:31     ` Andy Shevchenko
2024-11-23 19:09     ` Nathan Chancellor
2024-11-23 19:15       ` Mateusz Guzik
2024-11-25  9:02   ` kernel test robot
2024-11-25 11:42   ` kernel test robot

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=20241123094729.1099378-1-mjguzik@gmail.com \
    --to=mjguzik@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andy@kernel.org \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@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