From: Grazvydas Ignotas Date: Fri, 24 Aug 2012 21:45:36 +0000 (+0300) Subject: pandora-scripts: add a script for hugetlb allocation X-Git-Tag: sz_152~33 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12e5c4fa8e3c6637e1db0f7e17689fec978412fa;p=openpandora.oe.git pandora-scripts: add a script for hugetlb allocation --- diff --git a/recipes/pandora-system/pandora-scripts.bb b/recipes/pandora-system/pandora-scripts.bb index 92a2258..4802b2c 100644 --- a/recipes/pandora-system/pandora-scripts.bb +++ b/recipes/pandora-system/pandora-scripts.bb @@ -6,7 +6,7 @@ COMPATIBLE_MACHINE = "omap3-pandora" DEPENDS = "zenity dbus" RDEPENDS = "zenity dbus" -PR = "r111" +PR = "r112" SRC_URI = " \ file://op_paths.sh \ @@ -84,6 +84,7 @@ SRC_URI = " \ file://op_bright_up.sh \ file://op_menu.sh \ file://op_xfcemenu.sh \ + file://op_hugetlb.sh \ " do_install() { @@ -117,6 +118,7 @@ do_install() { install -m 0755 ${WORKDIR}/op_bright_up.sh ${D}${prefix}/pandora/scripts/ install -m 0755 ${WORKDIR}/op_menu.sh ${D}${prefix}/pandora/scripts/ install -m 0755 ${WORKDIR}/op_xfcemenu.sh ${D}${prefix}/pandora/scripts/ + install -m 0755 ${WORKDIR}/op_hugetlb.sh ${D}${prefix}/pandora/scripts/ install -m 0755 ${WORKDIR}/reset_nubs.sh ${D}${prefix}/pandora/scripts/ install -m 0644 ${WORKDIR}/pndlogo.png ${D}${prefix}/pandora/scripts/ install -m 0755 ${WORKDIR}/ConfigModel.py ${D}${prefix}/pandora/scripts/ diff --git a/recipes/pandora-system/pandora-scripts/op_hugetlb.sh b/recipes/pandora-system/pandora-scripts/op_hugetlb.sh new file mode 100755 index 0000000..a9f9ea5 --- /dev/null +++ b/recipes/pandora-system/pandora-scripts/op_hugetlb.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +if [ "$#" -ne "1" ]; then + echo "usage: $0 " + exit 1 +fi + +if ! [ -e /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages ]; then + echo "hugetlb error: no hugetlb support in kernel" + exit 1 +fi + +pages_needed=$(( ($1 + 1) / 2 )) + +# find amount of pages reserved or in use +pages_nr=`cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages` +pages_free=`cat /sys/kernel/mm/hugepages/hugepages-2048kB/free_hugepages` +pages_resv=`cat /sys/kernel/mm/hugepages/hugepages-2048kB/resv_hugepages` + +pages_inuse_before=$(($pages_nr - $pages_free + $pages_resv)) +pages_inuse_after=$(($pages_inuse_before + $pages_needed)) + +for a in `seq 5`; do + echo $pages_inuse_after > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages + sleep .2 + pages_nr=`cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages` + + if [ "$pages_nr" = "$pages_inuse_after" ]; then + break + fi +done + +if [ "$pages_nr" != "$pages_inuse_after" ]; then + echo "hugetlb error: could not alloc $pages_inuse_after pages (got $pages_nr)" +else + echo "hugetlb: $pages_nr pages allocated." +fi diff --git a/recipes/pandora-system/pandora-sudoers.bb b/recipes/pandora-system/pandora-sudoers.bb index 1a009e9..61a5c05 100644 --- a/recipes/pandora-system/pandora-sudoers.bb +++ b/recipes/pandora-system/pandora-sudoers.bb @@ -5,7 +5,7 @@ COMPATIBLE_MACHINE = "omap3-pandora" RDEPENDS = "sudo" -PR = "r17" +PR = "r18" SRC_URI = " \ file://50_openpandora \ diff --git a/recipes/pandora-system/pandora-sudoers/50_openpandora b/recipes/pandora-system/pandora-sudoers/50_openpandora index b37a5fc..1e572b5 100755 --- a/recipes/pandora-system/pandora-sudoers/50_openpandora +++ b/recipes/pandora-system/pandora-sudoers/50_openpandora @@ -30,3 +30,4 @@ %wheel ALL=(ALL) NOPASSWD: /usr/pandora/scripts/op_bluetooth_work.sh %wheel ALL=(ALL) NOPASSWD: /usr/pandora/scripts/pnd_run.sh %wheel ALL=(ALL) NOPASSWD: /usr/pandora/scripts/op_touchinit.sh +%wheel ALL=(ALL) NOPASSWD: /usr/pandora/scripts/op_hugetlb.sh