1 |
On Tue, Feb 26, 2013 at 5:33 AM, Richard Yao <ryao@g.o> wrote: |
2 |
> The Blender project found some fairly remarkable discrepancies between |
3 |
> what their software actually used and what glibc's ptmalloc allocated: |
4 |
> |
5 |
> http://www.sintel.org/development/memory-jemalloc/ |
6 |
> |
7 |
> Results such as these led Blender and others (e.g. Chrome/Chromium, |
8 |
> Firefox, Thunderbird) to bundle private versions of jemalloc. This |
9 |
> bundling situation violates our policy against bundled libraries. The |
10 |
> maintainers could just patch their software to link to libjemalloc. |
11 |
> However, it might make more sense to evaluate jemalloc as a |
12 |
> distribution-wide replacement for glibc's ptmalloc. |
13 |
|
14 |
So I'm confused a bit. The glibc malloc does perform poorly in some |
15 |
edge cases. Lots of folks use an optimized allocator. That doesn't |
16 |
mean that the glibc one is necessarily bad or worth replacing. |
17 |
|
18 |
In terms of 'following Gentoo policy.' We encourage packages to be as |
19 |
close to upstream as possible. I cannot fathom why when you basically |
20 |
find a performance bug in malloc, you start a thread on the list about |
21 |
replacing it; as opposed to filing a bug against glibc or emailing the |
22 |
glibc lists and asking them about it. |
23 |
|
24 |
> |
25 |
> It appears that run the following commands on amd64 to see how jemalloc |
26 |
> works when used system-wide: |
27 |
> |
28 |
> echo dev-libs/jemalloc ~amd64 >> /etc/portage/package.accept_keywords |
29 |
> emerge dev-libs/jemalloc |
30 |
> echo /usr/lib64/libjemalloc.so.1 >> /etc/ld.so.preload |
31 |
|
32 |
Well certainly we would never deploy an ld preload hack. If you want |
33 |
to test jemalloc, why don't you actually recompile the system against |
34 |
libjemalloc (patched glibc)? |
35 |
|
36 |
> |
37 |
> I did this on my system, verified that jemalloc was being loaded with |
38 |
> strace and rebooted. So far, sudo is broken and anything that is 32-bit |
39 |
> will have the loader print an error about the library not being |
40 |
> preloaded. On a related note, setuid binaries will obey |
41 |
> /etc/ld.so.preload, even though they ignore LD_PRELOAD. |
42 |
> |
43 |
> There is a chance that patching jemalloc directly into glibc would solve |
44 |
> the sudo issue, but I imagine that sudo is doing something strange, |
45 |
> which likely merits attention. For now, I am using su as a substitute |
46 |
> until I look into why sudo is broken. |
47 |
> |
48 |
> Unless a significant issue is found in jemalloc itself, I do not see any |
49 |
> reason to continue using glibc's ptmalloc over jemalloc. As far as I |
50 |
> know, FreeBSD, NetBSD, Facebook and others are using jemalloc, so I |
51 |
> expect that no significant issues will be found. jemalloc will still |
52 |
> needs testing before we can consider it. Doing good tests is hard, so I |
53 |
> would like to crowd source ideas on the appropriate way to test a malloc |
54 |
> implementation from the list. My expectation is that people on the list |
55 |
> will collectively think of better ideas than I could on my own. |
56 |
> |
57 |
> With that said, what do people think? |
58 |
> |
59 |
|
60 |
I see a *HUGE* reason. glibc ships with ptmalloc. If you think they |
61 |
should use jemalloc, talk to them. Don't just do it in Gentoo. |