mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] retire bcmp, a redundant wrapper around memcmp
@ 2024-11-23  9:47 Mateusz Guzik
  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
  0 siblings, 2 replies; 9+ messages in thread
From: Mateusz Guzik @ 2024-11-23  9:47 UTC (permalink / raw)
  To: tglx, bp, andy, akpm; +Cc: linux-kernel, x86, Mateusz Guzik

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-11-25 11:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-23  9:47 [PATCH 0/2] retire bcmp, a redundant wrapper around memcmp Mateusz Guzik
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®