release_process_vm: free vm_range_numa_policy
Change-Id: I8084cd60a12b557b635b8e350f70d4e4f95d4c52 Refs: #1101
This commit is contained in:
committed by
Masamichi Takagi
parent
d5de68e97b
commit
1db00ebc04
@ -2750,6 +2750,8 @@ void
|
|||||||
release_process_vm(struct process_vm *vm)
|
release_process_vm(struct process_vm *vm)
|
||||||
{
|
{
|
||||||
struct process *proc = vm->proc;
|
struct process *proc = vm->proc;
|
||||||
|
struct vm_range_numa_policy *policy;
|
||||||
|
struct rb_node *node;
|
||||||
|
|
||||||
if (!ihk_atomic_dec_and_test(&vm->refcount)) {
|
if (!ihk_atomic_dec_and_test(&vm->refcount)) {
|
||||||
return;
|
return;
|
||||||
@ -2777,6 +2779,15 @@ release_process_vm(struct process_vm *vm)
|
|||||||
detach_address_space(vm->address_space, vm->proc->pid);
|
detach_address_space(vm->address_space, vm->proc->pid);
|
||||||
proc->vm = NULL;
|
proc->vm = NULL;
|
||||||
release_process(proc);
|
release_process(proc);
|
||||||
|
|
||||||
|
while ((node = rb_first(&vm->vm_range_numa_policy_tree))) {
|
||||||
|
policy = rb_entry(node, struct vm_range_numa_policy,
|
||||||
|
policy_rb_node);
|
||||||
|
rb_erase(&policy->policy_rb_node,
|
||||||
|
&vm->vm_range_numa_policy_tree);
|
||||||
|
kfree(policy);
|
||||||
|
}
|
||||||
|
|
||||||
kfree(vm);
|
kfree(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
37
test/issues/1101/C1101.sh
Normal file
37
test/issues/1101/C1101.sh
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
USELTP=0
|
||||||
|
USEOSTEST=0
|
||||||
|
BOOTPARAM="-c 1-3 -m 1G@0 -e memdebug"
|
||||||
|
|
||||||
|
. ../../common.sh
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
if unxz < C1101T01.txt.xz | grep '^end 1999 ' > /dev/null 2>&1; then
|
||||||
|
echo '*** C1101T01 PASS'
|
||||||
|
else
|
||||||
|
echo '*** C1101T01 FAILED'
|
||||||
|
fi
|
||||||
|
|
||||||
|
$MCEXEC ./C1101T02
|
||||||
|
sleep 2
|
||||||
|
$IHKOSCTL 0 intr 200
|
||||||
|
sleep 2
|
||||||
|
$IHKOSCTL 0 clear_kmsg
|
||||||
|
|
||||||
|
for i in 2 3 4 5; do
|
||||||
|
echo "*** C1101T0$i START"
|
||||||
|
if $MCEXEC ./C1101T0$i; then
|
||||||
|
sleep 2
|
||||||
|
$IHKOSCTL 0 intr 200
|
||||||
|
sleep 2
|
||||||
|
l=`$IHKOSCTL 0 kmsg | grep "memory leak" | wc -l`
|
||||||
|
$IHKOSCTL 0 clear_kmsg
|
||||||
|
if [ $l = 0 ]; then
|
||||||
|
echo "*** C1101T0$i PASS"
|
||||||
|
else
|
||||||
|
echo "*** C1101T0$i FAILED"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "*** C1101T0$i FAILED"
|
||||||
|
fi
|
||||||
|
done
|
||||||
BIN
test/issues/1101/C1101T01.txt.xz
Normal file
BIN
test/issues/1101/C1101T01.txt.xz
Normal file
Binary file not shown.
28
test/issues/1101/C1101T02.c
Normal file
28
test/issues/1101/C1101T02.c
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <numaif.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
void *p;
|
||||||
|
unsigned long mask;
|
||||||
|
|
||||||
|
p = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
|
||||||
|
-1, 0);
|
||||||
|
if (p == ((void *)-1)) {
|
||||||
|
perror("mmap");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
mask = 0;
|
||||||
|
if (mbind(p, 4096, MPOL_DEFAULT, &mask, 2, MPOL_MF_MOVE) == -1) {
|
||||||
|
perror("mbind");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
munmap(p, 4096);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
28
test/issues/1101/C1101T03.c
Normal file
28
test/issues/1101/C1101T03.c
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <numaif.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
void *p;
|
||||||
|
unsigned long mask;
|
||||||
|
|
||||||
|
p = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
|
||||||
|
-1, 0);
|
||||||
|
if (p == ((void *)-1)) {
|
||||||
|
perror("mmap");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
mask = 1;
|
||||||
|
if (mbind(p, 4096, MPOL_BIND, &mask, 2, MPOL_MF_MOVE) == -1) {
|
||||||
|
perror("mbind");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
munmap(p, 4096);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
28
test/issues/1101/C1101T04.c
Normal file
28
test/issues/1101/C1101T04.c
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <numaif.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
void *p;
|
||||||
|
unsigned long mask;
|
||||||
|
|
||||||
|
p = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
|
||||||
|
-1, 0);
|
||||||
|
if (p == ((void *)-1)) {
|
||||||
|
perror("mmap");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
mask = 1;
|
||||||
|
if (mbind(p, 4096, MPOL_INTERLEAVE, &mask, 2, MPOL_MF_MOVE) == -1) {
|
||||||
|
perror("mbind");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
munmap(p, 4096);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
28
test/issues/1101/C1101T05.c
Normal file
28
test/issues/1101/C1101T05.c
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <numaif.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
void *p;
|
||||||
|
unsigned long mask;
|
||||||
|
|
||||||
|
p = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
|
||||||
|
-1, 0);
|
||||||
|
if (p == ((void *)-1)) {
|
||||||
|
perror("mmap");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
mask = 1;
|
||||||
|
if (mbind(p, 4096, MPOL_PREFERRED, &mask, 2, MPOL_MF_MOVE) == -1) {
|
||||||
|
perror("mbind");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
munmap(p, 4096);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
19
test/issues/1101/C1101_arm64.txt
Normal file
19
test/issues/1101/C1101_arm64.txt
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
Script started on 2019-12-19 06:01:59+00:00
|
||||||
|
bash-4.4$ make test
|
||||||
|
sh ./C1101.sh
|
||||||
|
aarch64
|
||||||
|
mcstop+release.sh ... done
|
||||||
|
mcreboot.sh -c 1-3 -m 1G@0 -e memdebug ... done
|
||||||
|
*** C1101T01 PASS
|
||||||
|
*** C1101T02 START
|
||||||
|
*** C1101T02 PASS
|
||||||
|
*** C1101T03 START
|
||||||
|
*** C1101T03 PASS
|
||||||
|
*** C1101T04 START
|
||||||
|
*** C1101T04 PASS
|
||||||
|
*** C1101T05 START
|
||||||
|
*** C1101T05 PASS
|
||||||
|
bash-4.4$ exit
|
||||||
|
exit
|
||||||
|
|
||||||
|
Script done on 2019-12-19 06:02:34+00:00
|
||||||
23
test/issues/1101/C1101_x86_64.txt
Normal file
23
test/issues/1101/C1101_x86_64.txt
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
Script started on Thu Dec 19 14:58:46 2019
|
||||||
|
bash-4.2$ make test
|
||||||
|
gcc -g -Wall -o C1101T02 C1101T02.c -lnuma
|
||||||
|
gcc -g -Wall -o C1101T03 C1101T03.c -lnuma
|
||||||
|
gcc -g -Wall -o C1101T04 C1101T04.c -lnuma
|
||||||
|
gcc -g -Wall -o C1101T05 C1101T05.c -lnuma
|
||||||
|
sh ./C1101.sh
|
||||||
|
x86_64
|
||||||
|
mcstop+release.sh ... done
|
||||||
|
mcreboot.sh -c 1-3 -m 1G@0 -e memdebug ... done
|
||||||
|
*** C1101T01 PASS
|
||||||
|
*** C1101T02 START
|
||||||
|
*** C1101T02 PASS
|
||||||
|
*** C1101T03 START
|
||||||
|
*** C1101T03 PASS
|
||||||
|
*** C1101T04 START
|
||||||
|
*** C1101T04 PASS
|
||||||
|
*** C1101T05 START
|
||||||
|
*** C1101T05 PASS
|
||||||
|
bash-4.2$ exit
|
||||||
|
exit
|
||||||
|
|
||||||
|
Script done on Thu Dec 19 14:59:18 2019
|
||||||
22
test/issues/1101/Makefile
Normal file
22
test/issues/1101/Makefile
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
CC = gcc
|
||||||
|
TARGET = C1101T02 C1101T03 C1101T04 C1101T05
|
||||||
|
|
||||||
|
all:: $(TARGET)
|
||||||
|
|
||||||
|
C1101T02: C1101T02.c
|
||||||
|
$(CC) -g -Wall -o $@ $^ -lnuma
|
||||||
|
|
||||||
|
C1101T03: C1101T03.c
|
||||||
|
$(CC) -g -Wall -o $@ $^ -lnuma
|
||||||
|
|
||||||
|
C1101T04: C1101T04.c
|
||||||
|
$(CC) -g -Wall -o $@ $^ -lnuma
|
||||||
|
|
||||||
|
C1101T05: C1101T05.c
|
||||||
|
$(CC) -g -Wall -o $@ $^ -lnuma
|
||||||
|
|
||||||
|
test:: all
|
||||||
|
sh ./C1101.sh
|
||||||
|
|
||||||
|
clean::
|
||||||
|
rm -f $(TARGET) *.o
|
||||||
24
test/issues/1101/README
Normal file
24
test/issues/1101/README
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
【Issue#1101 動作確認】
|
||||||
|
□ テスト内容
|
||||||
|
1. Issue 指摘事項の再現確認
|
||||||
|
C1101T01 OFPにてHPLを2000回連続実行し、現象が発生しないことを確認する。
|
||||||
|
OFPでのHPL実行結果を C1101T01.txt.xz にxz圧縮形式で格納している。
|
||||||
|
2000回の連続実行に成功したことを以って PASS とする。
|
||||||
|
|
||||||
|
2. mbind を呼び出してメモリリークが発生しないことを確認する。
|
||||||
|
全てのテストが PASS すること。
|
||||||
|
C1101T02 mbind(MPOL_DEFAULT) の動作確認。
|
||||||
|
C1101T03 mbind(MPOL_BIND) の動作確認。
|
||||||
|
C1101T04 mbind(MPOL_INTERLEAVE) の動作確認。
|
||||||
|
C1101T05 mbind(MPOL_PREFERRED) の動作確認。
|
||||||
|
|
||||||
|
□ 実行手順
|
||||||
|
$ make test
|
||||||
|
|
||||||
|
McKernelのインストール先は、$HOME/.mck_test_config を
|
||||||
|
参照する。.mck_test_config は、McKernel をビルドした際に生成される
|
||||||
|
mck_test_config.sample ファイルを $HOME にコピーし、適宜編集すること。
|
||||||
|
|
||||||
|
□ 実行結果
|
||||||
|
C1101_x86_64.txt(x86_64実行結果)、C1101_arm64.txt(arm64実行結果)参照。
|
||||||
|
全ての項目が PASS していることを確認。
|
||||||
Reference in New Issue
Block a user