Conversation

I fell down an interesting rabbit hole with Telegram. Telegram-Desktop uses Jemalloc which seems to run into some problems with the 16k page sizes on Asahi Linux. If you build from the RPM package it builds fine because the version of Jemalloc for Asahi is built using 16k page sizes. That said, if you use the Flatpak version, it's built for 4k page sizes and crashes out.

Since Jemalloc can only have the page sizes set at build time and not runtime, how exactly would you fix the Flatpak version without breaking out of the Flatpak sandbox and linking the system install of Jemalloc? wolf_peek​ And how does Flatpak usually handle other similar edge cases where different build options are needed even on the same architecture?

1
0
0

@Rusty jemalloc configured to use a larger page size works on systems with smaller page size. so jemalloc configured with `--with-lg-page=16` (64k page size) works on system with 4k, 16k and 64k page size. see https://github.com/jemalloc/jemalloc/issues/467 and https://github.com/AsahiLinux/docs/wiki/Broken-Software

1
0
0

@janne So it's mostly just down to jemalloc stubbornly refusing to change the default page size for some dubious compiler optimizations that can take place on 4k systems?

1
0
0

@Rusty @janne not compiler optimizations per se, but a manual one as using 4kiB pages is more space efficient (albeit slower) on 4kiB machines while Incorrect anywhere above that

1
0
1

@charlotte @janne Do the jemalloc devs see the performance gains as worth crashing everyone out who isn't using a 4k pagesize? I can't figure out the cost/benefit analysis on why crashing out entire systems with a different pagesize is worth the performance gains by making 4k the default in the build options. And, if those gains are so important, why can't they figure out a way to determine pagesize at runtime? blobfoxdizzy

1
0
0

@Rusty @janne apparently so, except there are no performance gains to enforce 4k pages. only space gains

1
0
0

@Rusty @janne if they enforced 64k pages (which is the largest common denominator among common and a bit less common platforms), it would run likely faster, at the cost of maybe needing more memory (how much is application-dependent)

0
0
0