Module Name:    src
Committed By:   ad
Date:           Sat Oct 14 19:37:24 UTC 2023

Modified Files:
        src/lib/libc/stdlib: jemalloc.c

Log Message:
Cherry pick a fix from FreeBSD:

commit 52d7a117c0fe8bd0226d964f4272131700035f12
Author: Jason Evans <jas...@freebsd.org>
Date:   Thu Aug 14 17:03:29 2008 +0000

    Re-order the terms of an expression in arena_run_reg_dalloc() to correctly
    detect whether the integer division table is large enough to handle the
    divisor.  Before this change, the last two table elements were never used,
    thus causing the slow path to be used for those divisors.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/lib/libc/stdlib/jemalloc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/stdlib/jemalloc.c
diff -u src/lib/libc/stdlib/jemalloc.c:1.60 src/lib/libc/stdlib/jemalloc.c:1.61
--- src/lib/libc/stdlib/jemalloc.c:1.60	Sat Oct 14 19:36:17 2023
+++ src/lib/libc/stdlib/jemalloc.c	Sat Oct 14 19:37:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: jemalloc.c,v 1.60 2023/10/14 19:36:17 ad Exp $	*/
+/*	$NetBSD: jemalloc.c,v 1.61 2023/10/14 19:37:24 ad Exp $	*/
 
 /*-
  * Copyright (C) 2006,2007 Jason Evans <jas...@freebsd.org>.
@@ -111,7 +111,7 @@
 
 #include <sys/cdefs.h>
 /* __FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.147 2007/06/15 22:00:16 jasone Exp $"); */
-__RCSID("$NetBSD: jemalloc.c,v 1.60 2023/10/14 19:36:17 ad Exp $");
+__RCSID("$NetBSD: jemalloc.c,v 1.61 2023/10/14 19:37:24 ad Exp $");
 
 #include "namespace.h"
 #include <sys/mman.h>
@@ -1685,8 +1685,8 @@ arena_run_reg_dalloc(arena_run_t *run, a
 			 */
 			regind = (unsigned)(diff / size);
 		}
-	} else if (size <= ((sizeof(size_invs) / sizeof(unsigned))
-	    << QUANTUM_2POW_MIN) + 2) {
+	} else if (size <= (((sizeof(size_invs) / sizeof(unsigned)) + 2)
+	    << QUANTUM_2POW_MIN)) {
 		regind = size_invs[(size >> QUANTUM_2POW_MIN) - 3] * diff;
 		regind >>= SIZE_INV_SHIFT;
 	} else {

Reply via email to