3 ##############################################################################
4 ## Copyright (c) 2015 Intel Corp.
6 ## All rights reserved. This program and the accompanying materials
7 ## are made available under the terms of the Apache License, Version 2.0
8 ## which accompanies this distribution, and is available at
9 ## http://www.apache.org/licenses/LICENSE-2.0
10 ###############################################################################
15 ##############################
16 # Create 1GB pages for guest #
17 ##############################
19 hugepage_size=`cat /proc/meminfo |grep Hugepagesize |tr -s " "| cut -f 2 -d " "`
20 if [[ $hugepage_size -ne 1048576 ]]
22 echo "Need 1G huge page support for performance benefit"
26 mkdir -p /mnt/hugetlbfs-1g
27 mount -t hugetlbfs hugetlbfs /mnt/hugetlbfs-1g -osize=1G
29 hugepage_dir="/sys/devices/system/node/node${numa_node}/hugepages/hugepages-1048576kB/nr_hugepages"
31 huge_pages+=`cat $hugepage_dir`
32 echo ${huge_pages} > ${hugepage_dir}
34 ############################
36 ############################
37 # Disable watchdogs to reduce overhead
38 echo 0 > /proc/sys/kernel/watchdog
39 echo 0 > /proc/sys/kernel/nmi_watchdog
41 # Change RT priority of ksoftirqd and rcuc kernel threads on isolated CPUs
42 startVal=$(echo ${host_isolcpus} | cut -f1 -d-)
43 endVal=$(echo ${host_isolcpus} | cut -f2 -d-)
45 while [ ${startVal} -lt ${endVal} ]; do
46 tid=`pgrep -a ksoftirq | grep "ksoftirqd/${startVal}$" | cut -d ' ' -f 1`
49 tid=`pgrep -a rcuc | grep "rcuc/${startVal}$" | cut -d ' ' -f 1`
54 startVal=`expr $startVal + 1`
57 # Change RT priority of rcub kernel threads
58 for tid in `pgrep -a rcub | cut -d ' ' -f 1` ; do
62 # Disable RT throttling
63 echo -1 > /proc/sys/kernel/sched_rt_period_us
64 echo -1 > /proc/sys/kernel/sched_rt_runtime_us
66 # Reroute interrupts bound to isolated CPUs to CPU 0
67 for irq in /proc/irq/* ; do
68 if [ -d ${irq} ] && ! grep - ${irq}/smp_affinity_list > /dev/null ; then
69 al=`cat ${irq}/smp_affinity_list`
70 if [[ ${cpu[*]} =~ ${al} ]] ; then
71 echo 0 > ${irq}/smp_affinity_list
76 # Change the iptable so that we can ssh to the guest remotely
77 iptables -I INPUT -p tcp --dport 5555 -j ACCEPT
78 # TODO: download guest disk image from artifactory