(2019-04-11, 16:42)smp1 Wrote: Any idea why LE does not use 131072?
Much of the discussion surrounding this particular change happened on the Team Kodi Slack, which isn't ideal considering it's not public.
Anyway, I (and others) did some investigation of the different threshold settings and - at the time, 6 Feb 2017 - a figure of 512KB appeared to be the most optimal.
Cutting & pasting the following from Team Kodi Slack (the testing involved caching thumbnails, if I remember correctly):
text:
------- EXPORT=128KB
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
892 root 20 0 2703440 359256 162872 S 6.7 4.5 0:08.26 kodi.bin
892 root 20 0 2884536 363168 164308 S 7.3 4.5 3:49.45 kodi.bin
------- EXPORT=512KB
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
914 root 20 0 2694472 351676 163380 R 8.3 4.4 0:08.04 kodi.bin
914 root 20 0 2885048 358816 164740 S 6.3 4.5 3:48.86 kodi.bin
------- EXPORT=1MB
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
885 root 20 0 2322412 304240 162292 S 360.0 3.8 0:04.47 kodi.bin
885 root 20 0 2900616 376744 164928 S 6.7 4.7 3:48.23 kodi.bin
The start/end difference in RES seems to increase with the EXPORT, which I guess is to be expected. `TIME+` (or time to cache) doesn't change significantly with any EXPORT setting. 512KB might be the sweet spot. (edited)
It appears that members of Team Kodi decided to use a different value of 128KB on 22 Feb 2017 after LibreELEC had opted to use use 512KB on 7 Feb 2017 - not really sure why.
We already use a much smaller threshold on ARM systems mainly because ARM systems typically have much less RAM than x86_64 and will therefore suffer OOM sooner, but also the allocators for 64-bit (x86_64) systems are different to 32-bit (ARM).
I'm not against revising the setting we use for x86_64, but would want more evidence of an actual problem before doing so. How much RAM does your x86_64 system have? If you have 2GB or less RAM installed then yes, 512KB may not be an ideal setting particularly if the system is up for extended periods of time.
To be honest, I think any figure we - LibreELEC or Kodi - use is likely to cause an OOM problem eventually, as there's not really a right or wrong value, just "least worse" values. The threshold value is a trade-off, balancing performance against likelihood of fragmentation, so it's never going to be perfect and the smaller value you use will cost you in terms of overall performance.
Not sure which solution you used to override the threshold, but you can persistently override the kodi.conf setting by running:
text:
echo "MALLOC_MMAP_THRESHOLD_=131072" > /storage/.config/kodi.conf
to use a 128KB threshold.