From: Garrett C. <yan...@gm...> - 2010-09-25 04:56:51
|
On Fri, Sep 24, 2010 at 6:21 AM, Jan Tluka <jt...@re...> wrote: > Resending ... > > I've noticed that in some cases the hugeshmget05 testcase is not > cleaning up properly after itself. It leaves hugepages reserved and > does not free them. This could break further test runs. > > I think the problem is with signal handling. The testcase will do > rm_shm() only if it ends up properly. In case it's being killed by > SIGTERM signal (as seen from the testlog) the cleanup() function does > not return shared memory. > > Without the patch I have to use ipcrm to remove all hugepages reserved > and not returned. > > # grep -i unexpected RHEL-hugepage.run.log > hugeshmget05 1 TBROK : Unexpected signal 15 received. > # ipcs -m > ------ Shared Memory Segments -------- > key shmid owner perms bytes nattch status > 0x7400ee08 3932160 root 600 4 0 > 0x7400edde 4620289 root 600 4 0 > 0x00000000 4980738 gdm 600 393216 2 dest > 0x7400eddd 4587523 root 600 4 0 > 0x78002a3b 64552964 root 600 209715200 0 > 0x78002a38 64520197 root 600 209715200 0 > # ipcrm -m 64552964 -m 64520197 > > With the patch the test returns hugepages back to the system even if it > gets signal 15. > > Checked on RHEL5.5. > > Thanks, Jan > > > The patch follows, > > > --- ltp-full-20100831/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c 2010-09-14 13:04:33.000000000 +0200 > +++ ltp-full-20100831.new/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c 2010-09-24 13:47:19.413177300 +0200 > @@ -105,7 +105,6 @@ > > do_child(); > > - cleanup(); > > /*NOTREACHED*/ > } else { /* parent */ > @@ -114,11 +113,10 @@ > tst_brkm(TBROK, cleanup, "waitpid failed"); > } > > - /* if it exists, remove the shared memory resource */ > - rm_shm(shm_id_1); > - > /* Remove the temporary directory */ > tst_rmdir(); > + > + cleanup(); > } > return 0; > } > @@ -209,6 +207,9 @@ > void > cleanup(void) > { > + /* if it exists, remove the shared memory resource */ > + rm_shm(shm_id_1); > + > /* > * print timing stats if that option was specified. > * print errno log if that option was specified. Hi Jan, I spotted some other potential issues with the test. Please try this patch and let me know whether or not it works for you . Cheers, -Garrett |