Skip to content
  1. Dec 04, 2019
  2. Aug 05, 2019
  3. Aug 02, 2019
  4. Jul 31, 2019
  5. Jul 30, 2019
  6. Jul 29, 2019
    • Qi Wang's avatar
      Revert "Refactor prof log" · 5742473c
      Qi Wang authored
      This reverts commit 7618b0b8.
      5742473c
    • Qi Wang's avatar
      Revert "Refactor profiling" · 1a050336
      Qi Wang authored
      This reverts commit 0b462407.
      1a050336
    • Yinan Zhang's avatar
      Refactor profiling · 0b462407
      Yinan Zhang authored
      Refactored core profiling codebase into two logical parts:
      
      (a) `prof_data.c`: core internal data structure managing & dumping;
      (b) `prof.c`: mutexes & outward-facing APIs.
      
      Some internal functions had to be exposed out, but there are not
      that many of them if the modularization is (hopefully) clean enough.
      0b462407
    • Yinan Zhang's avatar
      Refactor prof log · 7618b0b8
      Yinan Zhang authored
      `prof.c` is growing too long, so trying to modularize it.  There are
      a few internal functions that had to be exposed but I think it is a
      fair trade-off.
      7618b0b8
  7. Jul 26, 2019
  8. Jul 25, 2019
  9. Jul 24, 2019
    • Qi Wang's avatar
      Optimize max_active_fit in first_fit. · 1d148f35
      Qi Wang authored
      Stop scanning once reached the first max_active_fit size.
      1d148f35
    • Qi Wang's avatar
      Track the leaked VM space via the abandoned_vm counter. · 4e36ce34
      Qi Wang authored
      The counter is 0 unless metadata allocation failed (indicates OOM), and is
      mainly for sanity checking.
      4e36ce34
    • Qi Wang's avatar
      extent_dalloc instead of leak when register fails. · 42807fcd
      Qi Wang authored
      extent_register may only fail if the underlying extent and region got stolen /
      coalesced before we lock.  Avoid doing extent_leak (which purges the region)
      since we don't really own the region.
      42807fcd
    • Qi Wang's avatar
      Avoid leaking extents / VM when split is not supported. · 57dbab5d
      Qi Wang authored
      This can only happen on Windows and with opt.retain disabled (which isn't the
      default).  The solution is suboptimal, however not a common case as retain is
      the long term plan for all platforms anyway.
      57dbab5d
    • Qi Wang's avatar
      Enable opt.retain by default on Windows. · badf8d95
      Qi Wang authored
      badf8d95
    • Qi Wang's avatar
      Implement retain on Windows. · 9a86c65a
      Qi Wang authored
      The VirtualAlloc and VirtualFree APIs are different because MEM_DECOMMIT cannot
      be used across multiple VirtualAlloc regions.  To properly support decommit,
      only allow merge / split within the same region -- this is done by tracking the
      "is_head" state of extents and not merging cross-region.
      
      Add a new state is_head (only relevant for retain && !maps_coalesce), which is
      true for the first extent in each VirtualAlloc region.  Determine if two extents
      can be merged based on the head state, and use serial numbers for sanity checks.
      9a86c65a
  10. Jul 18, 2019
  11. Jul 17, 2019
    • Yinan Zhang's avatar
      Remove prof_accumbytes in arena · a2a693e7
      Yinan Zhang authored
      `prof_accumbytes` was supposed to be replaced by `prof_accum` in
      https://github.com/jemalloc/jemalloc/pull/623.
      a2a693e7
    • Yinan Zhang's avatar
      Fix a bug in prof_dump_write · e0a0c8d4
      Yinan Zhang authored
      The original logic can be disastrous if `PROF_DUMP_BUFSIZE` is less
      than `slen` -- `prof_dump_buf_end + slen <= PROF_DUMP_BUFSIZE` would
      always be `false`, so `memcpy` would always try to copy
      `PROF_DUMP_BUFSIZE - prof_dump_buf_end` chars, which can be
      dangerous: in the last round of the `while` loop it would not only
      illegally read the memory beyond `s` (which might not always be
      disastrous), but it would also illegally overwrite the memory beyond
      `prof_dump_buf` (which can be pretty disastrous).  `slen` probably
      has never gone beyond `PROF_DUMP_BUFSIZE` so we were just lucky.
      e0a0c8d4
  12. Jul 16, 2019
    • Yinan Zhang's avatar
      Fix logic in printing · d26636d5
      Yinan Zhang authored
      `cbopaque` can now be overriden without overriding `write_cb` in
      the first place.  (Otherwise there would be no need to have the
      `cbopaque` parameter in `malloc_message`.)
      d26636d5
  13. Jul 15, 2019
  14. Jul 12, 2019
  15. May 24, 2019
  16. May 22, 2019
    • Qi Wang's avatar
      Avoid blocking on background thread lock for stats. · 1a715335
      Qi Wang authored
      Background threads may run for a long time, especially when the # of dirty pages
      is high.  Avoid blocking stats calls because of this (which may cause latency
      spikes).
      1a715335
    • Qi Wang's avatar
      Add experimental.arenas.i.pactivep. · e13cf65a
      Qi Wang authored
      The new experimental mallctl exposes the arena pactive counter to applications,
      which allows fast read w/o going through the mallctl / epoch steps.  This is
      particularly useful when frequent balancing is required, e.g. when having
      multiple manual arenas, and threads are multiplexed to them based on usage.
      e13cf65a
    • Yinan Zhang's avatar
      Add confirm_conf option · c92ac306
      Yinan Zhang authored
      If the confirm_conf option is set, when the program starts, each of
      the four malloc_conf strings will be printed, and each option will
      be printed when being set.
      c92ac306
  17. May 21, 2019
    • Yinan Zhang's avatar
      Improve memory utilization tests · 4c63b0e7
      Yinan Zhang authored
      Added tests for large size classes and expanded the tests to
      cover wider range of allocation sizes.
      4c63b0e7
    • Vaibhav Jain's avatar
      Fix GCC-9.1 warning with macro GET_ARG_NUMERIC · 2d6d099f
      Vaibhav Jain authored
      GCC-9.1 reports following error when trying to compile file
      src/malloc_io.c and with CFLAGS='-Werror' :
      
      src/malloc_io.c: In function ‘malloc_vsnprintf’:
      src/malloc_io.c:369:2: error: case label value exceeds maximum value for type [-Werror]
        369 |  case '?' | 0x80:      \
            |  ^~~~
      src/malloc_io.c:581:5: note: in expansion of macro ‘GET_ARG_NUMERIC’
        581 |     GET_ARG_NUMERIC(val, 'p');
            |     ^~~~~~~~~~~~~~~
      ...
      <snip>
      cc1: all warnings being treated as errors
      make: *** [Makefile:388: src/malloc_io.sym.o] Error 1
      
      The warning is reported as by default the type 'char' is 'signed char'
      and or-ing 0x80 will turn the case label char negative which will be
      beyond the printable ascii range (0 - 127).
      
      The patch fixes this by explicitly casting the 'len' variable as
      unsigned char' inside the 'switch' statement so that value of
      expression " '?' | 0x80 " falls within the legal values of the
      variable 'len'.
      2d6d099f
  18. May 15, 2019
  19. May 08, 2019
    • Yinan Zhang's avatar
      Improve macro readability in malloc_conf_init · 259b15de
      Yinan Zhang authored
      Define more readable macros than yes and no.
      259b15de
    • Dave Watson's avatar
      Remove best fit · 56797512
      Dave Watson authored
      This option saves a few CPU cycles, but potentially adds a lot of
      fragmentation - so much so that there are workarounds like
      max_active.  Instead, let's just drop it entirely.  It only made
      a difference in one service I tested (.3% cpu regression), while
      many services saw a memory win (also small, less than 1% mem P99)
      56797512
    • Dave Watson's avatar
      Add max_active_fit to first_fit · b62d126d
      Dave Watson authored
      The max_active_fit check is currently only on the best_fit
      path, add it to the first_fit path also.
      b62d126d
  20. Apr 29, 2019
    • Doron Roberts-Kedes's avatar
      Add nonfull_slabs to bin_stats_t. · 7fc4f2a3
      Doron Roberts-Kedes authored
      When config_stats is enabled track the size of bin->slabs_nonfull in
      the new nonfull_slabs counter in bin_stats_t. This metric should be
      useful for establishing an upper ceiling on the savings possible by
      meshing.
      7fc4f2a3