Revert "selftests/mm: fix charge_reserved_hugetlb.sh test"

This reverts commit ad18f8f867.
This commit is contained in:
Ksawlii 2024-11-24 00:23:05 +01:00
parent 9b04c465eb
commit 096a5c2b6a
2 changed files with 10 additions and 13 deletions

View file

@ -249,7 +249,7 @@ function cleanup_hugetlb_memory() {
local cgroup="$1"
if [[ "$(pgrep -f write_to_hugetlbfs)" != "" ]]; then
echo killing write_to_hugetlbfs
killall -2 --wait write_to_hugetlbfs
killall -2 write_to_hugetlbfs
wait_for_hugetlb_memory_to_get_depleted $cgroup
fi
set -e

View file

@ -28,7 +28,7 @@ enum method {
/* Global variables. */
static const char *self;
static int *shmaddr;
static char *shmaddr;
static int shmid;
/*
@ -47,17 +47,15 @@ void sig_handler(int signo)
{
printf("Received %d.\n", signo);
if (signo == SIGINT) {
if (shmaddr) {
printf("Deleting the memory\n");
if (shmdt((const void *)shmaddr) != 0) {
perror("Detach failure");
shmctl(shmid, IPC_RMID, NULL);
exit(4);
}
printf("Deleting the memory\n");
if (shmdt((const void *)shmaddr) != 0) {
perror("Detach failure");
shmctl(shmid, IPC_RMID, NULL);
printf("Done deleting the memory\n");
exit(4);
}
shmctl(shmid, IPC_RMID, NULL);
printf("Done deleting the memory\n");
}
exit(2);
}
@ -213,8 +211,7 @@ int main(int argc, char **argv)
shmctl(shmid, IPC_RMID, NULL);
exit(2);
}
shmaddr = ptr;
printf("shmaddr: %p\n", shmaddr);
printf("shmaddr: %p\n", ptr);
break;
default: