• [^] # Re: tmpfs

    Posté par . En réponse au journal Améliorer vos ordinateurs avec zRam !. Évalué à 2.

    Je viens de croiser ceci : http://www.webupd8.org/2011/10/increased-performance-in-linux-with.html
    Voici le script adapté pour archlinux (https://aur.archlinux.org/packages.php?ID=52958) je ne sais pas si ça te sera utile mais je copie ici.

    #!/bin/bash
    . /etc/rc.conf
    . /etc/rc.d/functions
    # get the number of CPUs
    num_cpus=$(grep -c processor /proc/cpuinfo)
    # if something goes wrong, assume we have 1
    [[ "$num_cpus" != 0 ]] || num_cpus=1
    # set decremented number of CPUs
    decr_num_cpus=$((num_cpus - 1))
    case "1ドル" in
     start)
     stat_busy "Enabling zram-based swap"
     # get the amount of memory in the machine
     mem_total_kb=$(grep MemTotal /proc/meminfo | grep -E --only-matching '[[:digit:]]+')
     mem_total=$((mem_total_kb * 1024))
     # load dependency modules
     modprobe zram num_devices=$num_cpus
     # initialize the devices
     for i in $(seq 0 $decr_num_cpus); do
    echo $((mem_total / num_cpus)) > /sys/block/zram$i/disksize
     done
     # Creating swap filesystems
     for i in $(seq 0 $decr_num_cpus); do
    mkswap /dev/zram$i
     done
     # Switch the swaps on
     for i in $(seq 0 $decr_num_cpus); do
    swapon -p 100 /dev/zram$i
     done
    stat_done
     ;;
     stop)
     stat_busy "Switching off zram-based swap"
     # Switching off swap
     for i in $(seq 0 $decr_num_cpus); do
     if [[ "$(grep /dev/zram$i /proc/swaps)" != "" ]]; then
    swapoff /dev/zram$i
     fi
     done
    rmmod zram
     stat_done
     ;;
     *)
     echo "usage: 0ドル {start|stop}"
    esac
    exit 0