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.


------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to