From: Wanlong G. <gao...@cn...> - 2012-02-08 08:38:57
|
On 02/08/2012 04:31 PM, Caspar Zhang wrote: > On 02/08/2012 04:21 PM, Wanlong Gao wrote: >> -static void setup(void) >> +void setup(void) >> { >> - char mypid[40]; >> - >> - sprintf(mypid, "/%d", getpid()); >> - TEMPFILE = strcat(mypid, TEMPFILE); >> - TEMPFILE = strcat(Hopt, TEMPFILE); >> - >> - tst_sig(FORK, DEF_HANDLER, cleanup); >> - >> TEST_PAUSE; >> - >> + tst_require_root(NULL); >> + if (mount("none", Hopt, "hugetlbfs", 0, NULL) < 0) >> + tst_brkm(TBROK|TERRNO, NULL, >> + "mount failed on %s", Hopt); >> + >> + set_sys_tune("nr_hugepages", hugepages, 1); >> + snprintf(TEMPFILE, sizeof(TEMPFILE), "%s/mmapfile%d", >> + Hopt, getpid()); >> } >> >> -static void cleanup(void) >> +void cleanup(void) >> { >> TEST_CLEANUP; >> >> unlink(TEMPFILE); >> >> + umount(Hopt); >> + tst_rmdir(); >> } > > Hi, I just have another concern, that you might want to keep the initial > value of nr_hugepages and restore it once the test is done. as set_sys_tune defined in mem lib, this restore work should be done there, too. right? Thanks -Wanlong Gao > > Thanks, > Caspar > |