An update on what I am doing with the Cubox-i4pro
I was thinking about how streaming works with audio. How CPU’s cache functions and decided to make some Affinity adjustments, as to pin mpd process, to CPU 2 and 3, and then isolated CPU 2 and 3 from the kernel and all other processes. My reasoning is to establish a more local and fixed cache for the CPUs, dedicating just to audio streaming. Also freeing up MPD from sharing CPU resources with IRQs.
I edited uEnv.txt and /etc/init.d/mpd to implement Affinity changes.
Then I decided to tune some resources for my NAS, USB and network. Here are my files changes. If anyone is interested, with these changes. They could probably use a whole lot of adjustments, feedback on that would be kind. This is Just for fun, trying to get the most out of the quad cores.
Make sure you make a backup of your SD card, before you do any of this, to insure you can go back to the original. I am just sharing with you, somethings I am playing with.
vi/boot/uEnv.txt # last command isolates CPU 2 and 3
mmcroot=/dev/mmcblk0p2 rootwait rw console=ttymxc0,115200 consoleblank=0 raid=no
autodetect cgroup_disable=memory isolcpus=2,3
changed the /etc/init.d/mpd last lines to pin the CPUs when mpd is started and restarted
[code]
case “$1” in
start)
mpd_start
BJI=$(cat /run/mpd/pid)
taskset -cp 2-3 $BJI
;;
stop)
mpd_stop
;;
status)
status_of_proc -p $PIDFILE $DAEMON $NAME
;;
restart|force-reload)
mpd_stop
mpd_start
BJI=$(cat /run/mpd/pid)
taskset -cp 2-3 $BJI
;;
force-start)
mpd_start
BJI=$(cat /run/mpd/pid)
taskset -cp 2-3 $BJI[/code]
vi /etc/security/limits.conf add to the bottom to adjust limits
@audio - rtprio 99
@audio - memlock unlimited
@audio - nice -19
vi /etc/sysctl.conf add following to tweak LAN buffers
net.core.rmem_max=12582912
net.core.wmem_max=12582912
net.ipv4.tcp_rmem= 10240 87380 12582912
net.ipv4.tcp_wmem= 10240 87380 12582912
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_sack = 1
net.ipv4.tcp_no_metrics_save = 1
net.core.netdev_max_backlog = 5000
vm.overcommit_memory = 2
vm.overcommit_ratio = 50
vi /etc/init.d/rtset.conf created not sure about this, but it is to tune realtime streaming.
#!/bin/sh
chrt -f -p 53 `pgrep irq/24-ehci_hcd`
chrt -f -p 53 `pgrep irq/29-eth0`
chrt -f -p 53 `pgrep cifsd`
Anyway, just playing, looks like these changes made a difference, no so much in sound, but in resource management.
Play with at your own risk!!