• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0-or-later
3# Copyright (c) 2021 Yang Xu <xuyang2018.jy@fujitsu.com>
4# Copyright (c) 2021 Petr Vorel <pvorel@suse.cz>
5
6tconf()
7{
8	echo "TCONF: $1"
9	exit 32
10}
11
12echo "Testing .request_hugepages = TST_NO_HUGEPAGES"
13
14orig_value=`cat /proc/sys/vm/nr_hugepages`
15
16if grep -q -E '^proc /proc(/sys)? proc ro' /proc/mounts; then
17	tconf "/proc or /proc/sys mounted as read-only"
18fi
19
20if [ ! -f /proc/sys/vm/nr_hugepages ]; then
21	tconf "/proc/sys/vm/nr_hugepages does not exist"
22fi
23
24if [ ! -w /proc/sys/vm/nr_hugepages ]; then
25	tconf "no write permission to /proc/sys/vm/nr_hugepages (run as root)"
26fi
27
28echo 4 > /proc/sys/vm/nr_hugepages
29
30./test_zero_hugepage
31
32echo $orig_value > /proc/sys/vm/nr_hugepages
33