ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: shyouhei@ruby-lang.org
To: ruby-core@ruby-lang.org
Subject: [ruby-core:88406] [Ruby trunk Feature#14759] [PATCH] set M_ARENA_MAX for glibc malloc
Date: Fri, 10 Aug 2018 00:51:18 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-73458.20180810005117.44bce2c8d93c88dd@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-14759.20180515082552@ruby-lang.org

Issue #14759 has been updated by shyouhei (Shyouhei Urabe).


normalperson (Eric Wong) wrote:
> shyouhei@ruby-lang.org wrote:
>  > One question: is it possible to cancel the effect of
>  > M_ARENA_MAX ?  Given @mame's corner case, it might be
>  > desirable for a user (or sysadmin) to be able to choose the
>  > behaviour between the proposed one and the status quo.
>  
>  Environment variable (MALLOC_ARENA_MAX) at startup (only),
>  or they can use fiddle or C extension to call mallopt
>  at anytime once a program is running.

Yes the question is, what exactly is the value of MALLOC_ARENA_MAX that a user should specify to let malloc behave as it works in 2.5 now?

----------------------------------------
Feature #14759: [PATCH] set M_ARENA_MAX for glibc malloc
https://bugs.ruby-lang.org/issues/14759#change-73458

* Author: normalperson (Eric Wong)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Not everybody benefits from jemalloc and the extra download+install
time is not always worth it.  Lets make the user experience for
glibc malloc users better, too.

Personally, I prefer using M_ARENA_MAX=1 (via MALLOC_ARENA_MAX
env) myself, but there is currently a performance penalty for
that.


gc.c (Init_GC): set M_ARENA_MAX=2 for glibc malloc

glibc malloc creates too many arenas and leads to fragmentation.
Given the existence of the GVL, clamping to two arenas seems
to be a reasonable trade-off for performance and memory usage.

Some users (including myself for several years, now) prefer only
one arena, now, so continue to respect users' wishes when
MALLOC_ARENA_MAX is set.

Thanks to Mike Perham for the reminder [ruby-core:86843]


This doesn't seem to conflict with jemalloc, so it should be safe
for all glibc-using systems.


---Files--------------------------------
0001-gc.c-Init_GC-set-M_ARENA_MAX-2-for-glibc-malloc.patch (1.46 KB)


-- 
https://bugs.ruby-lang.org/

  parent reply	other threads:[~2018-08-10  0:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-14759.20180515082552@ruby-lang.org>
2018-05-15  8:25 ` [ruby-core:87035] [Ruby trunk Feature#14759] [PATCH] set M_ARENA_MAX for glibc malloc normalperson
2018-05-16  5:03 ` [ruby-core:87059] " dennisb55
2018-05-16  5:24   ` [ruby-core:87063] " Eric Wong
2018-05-19  3:04 ` [ruby-core:87187] " dennisb55
2018-05-19 14:03 ` [ruby-core:87193] " mame
2018-05-21  6:30   ` [ruby-core:87211] " Eric Wong
2018-05-20 17:58 ` [ruby-core:87199] " mperham
2018-05-21  5:19 ` [ruby-core:87209] " dennisb55
2018-08-01  0:20 ` [ruby-core:88240] " sam.saffron
2018-08-01  9:41   ` [ruby-core:88255] " Eric Wong
2018-08-01  9:57     ` [ruby-core:88258] " Eric Wong
2018-08-01 13:04 ` [ruby-core:88259] " eregontp
2018-08-01 19:18   ` [ruby-core:88262] " Eric Wong
2018-08-01 20:55 ` [ruby-core:88263] " eregontp
2018-08-08  6:10 ` [ruby-core:88343] " ko1
2018-08-08  6:27 ` [ruby-core:88344] " ko1
2018-08-09 11:35 ` [ruby-core:88394] " shyouhei
2018-08-09 17:43   ` [ruby-core:88402] " Eric Wong
2018-08-10  0:51 ` shyouhei [this message]
2018-08-10  1:42   ` [ruby-core:88409] " Eric Wong
2018-08-10  2:07 ` [ruby-core:88411] " shyouhei
2018-08-10  2:16   ` [ruby-core:88412] " Eric Wong
2018-08-10  5:37 ` [ruby-core:88418] " dennisb55
2019-03-15  6:54 ` [ruby-core:91844] " dennisb55

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-73458.20180810005117.44bce2c8d93c88dd@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).