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
43 for c in `echo $host_isolcpus | sed 's/,/ /g'` ; do
44 tid=`pgrep -a ksoftirq | grep "ksoftirqd/${c}$" | cut -d ' ' -f 1`
47 tid=`pgrep -a rcuc | grep "rcuc/${c}$" | cut -d ' ' -f 1`
54 # Change RT priority of rcub kernel threads
55 for tid in `pgrep -a rcub | cut -d ' ' -f 1` ; do
59 # Disable RT throttling
60 echo -1 > /proc/sys/kernel/sched_rt_period_us
61 echo -1 > /proc/sys/kernel/sched_rt_runtime_us
63 # Reroute interrupts bound to isolated CPUs to CPU 0
64 for irq in /proc/irq/* ; do
65 if [ -d ${irq} ] && ! grep - ${irq}/smp_affinity_list > /dev/null ; then
66 al=`cat ${irq}/smp_affinity_list`
67 if [[ ${cpu[*]} =~ ${al} ]] ; then
68 echo 0 > ${irq}/smp_affinity_list
73 # Change the iptable so that we can ssh to the guest remotely
74 iptables -I INPUT -p tcp --dport 5555 -j ACCEPT
75 # TODO: download guest disk image from artifactory