[RFC,2/6] mcheck: Microoptimize

Message ID 20230515144815.3939017-3-bugaevc@gmail.com
State New
Headers
Series .text.subsections for some questionable benefit |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Sergey Bugaev May 15, 2023, 2:48 p.m. UTC
  We can't mark the abortfunc pointer as __COLD, so instead just tell the
compiler that this branch is unlikely to be taken.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
---
 malloc/mcheck-impl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/malloc/mcheck-impl.c b/malloc/mcheck-impl.c
index 1625e63f..fe35873c 100644
--- a/malloc/mcheck-impl.c
+++ b/malloc/mcheck-impl.c
@@ -91,7 +91,7 @@  checkhdr (const struct hdr *hdr)
 	status = MCHECK_OK;
       break;
     }
-  if (status != MCHECK_OK)
+  if (__glibc_unlikely (status != MCHECK_OK))
     {
       mcheck_used = 0;
       (*abortfunc) (status);