On Fri, Jan 28, 2022 at 04:33:28PM +0100, Alexander Bluhm wrote: > On Sun, Jan 09, 2022 at 02:54:43PM +0100, Otto Moerbeek wrote: > > currently malloc does cache a number of free'ed regions up to 128k in > > size. This cache is indexed by size (in # of pages), so it is very > > quick to check. > > > > Some programs allocate and deallocate larger allocations in a frantic > > way. Accodomate those programs by also keeping a cache of regions > > betwen 128k and 2M, in a cache of variable sized regions. > > > > My test case speeds up about twice. A make build gets a small speedup. > > > > This has been tested by myself on amd64 quite intensively. I am asking > > for more tests, especialy on more "exotic" platforms. I wil do arm64 > > myself soon. Test can be running your favorite programs, doing make > > builds or running tests in regress/lib/libc/malloc. > > I see openssl and tmux crash with this diff. > /usr/src/regress/usr.sbin/openssl reproduces it on arm64, amd64, > i386.
Are you running with any malloc flags? -Otto > > #0 L1 () at /usr/src/lib/libc/arch/amd64/string/memset.S:52 > 52 L1: rep > (gdb) bt > #0 L1 () at /usr/src/lib/libc/arch/amd64/string/memset.S:52 > #1 0x00000fde4ed058d8 in _libc_explicit_bzero (buf=0xfded1f8e000, > len=18446744073709549600) at /usr/src/lib/libc/string/explicit_bzero.c:17 > #2 0x00000fde4ed6f84f in unmap (d=0xfdead893830, p=Variable "p" is not > available. > ) at /usr/src/lib/libc/stdlib/malloc.c:805 > #3 0x00000fde4ed6ceca in ofree (argpool=0x7f7ffffc2268, p=Variable "p" is > not available. > ) at /usr/src/lib/libc/stdlib/malloc.c:1511 > #4 0x00000fde4ed6e4cb in _libc_recallocarray (ptr=0xfded1f8e7e0, > oldnmemb=Variable "oldnmemb" is not available. > ) at /usr/src/lib/libc/stdlib/malloc.c:1908 > #5 0x00000fdbd4787afe in xrecallocarray (ptr=Unhandled dwarf expression > opcode 0xa3 > ) at /usr/src/usr.bin/tmux/xmalloc.c:81 > #6 0x00000fdbd4703ce6 in cmd_parse_build_commands (cmds=Unhandled dwarf > expression opcode 0xa3 > ) at cmd-parse.y:815 > #7 0x00000fdbd4703d47 in cmd_parse_build_commands (cmds=Unhandled dwarf > expression opcode 0xa3 > ) at cmd-parse.y:823 > #8 0x00000fdbd47040f7 in cmd_parse_from_buffer (buf=Unhandled dwarf > expression opcode 0xa3 > ) at cmd-parse.y:1036 > #9 0x00000fdbd4703ffd in cmd_parse_from_string ( > s=0xfdbd46d6522 "bind > { display-menu -xP -yP -T > '#[align=centre]#{pane_index} (#{pane_id})' > '#{?#{m/r:(copy|view)-mode,#{pane_mode}},Go To Top,}' '<' {send -X > history-top} '#{?#{m/r:(copy|view)-mode,#{pane_mode}},G"..., > pi=0x7f7ffffc24a0) at cmd-parse.y:959 > #10 0x00000fdbd473506e in key_bindings_init () at > /usr/src/usr.bin/tmux/key-bindings.c:636 > #11 0x00000fdbd47564c8 in server_start (client=0xfdec1056000, > flags=402653184, base=0xfdec103f400, lockfd=5, lockfile=0xfdec1041b80 > "/tmp/tmux-0/default.lock") > at /usr/src/usr.bin/tmux/server.c:210 > #12 0x00000fdbd46f8788 in client_main (base=0xfdec103f400, argc=Unhandled > dwarf expression opcode 0xa3 > ) at /usr/src/usr.bin/tmux/client.c:165 > #13 0x00000fdbd4761b62 in main (argc=0, argv=0x7f7ffffc2880) at > /usr/src/usr.bin/tmux/tmux.c:529 > > bluhm