Skip to contentSkip to conversation

hugemmap01.c

PATCH Cyril Hrubis 3 participants 5 messages Sep 2, 2011 – Nov 22, 2011 4 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi!

Quoted 40 lines

#include "test.h"
#include "usctest.h"
#include "system_specific_hugepages_info.h"

(quoted diff) +6 -13
+#include "libmnt.h"
 
 #define BUFFER_SIZE  256
 
-char* TEMPFILE="mmapfile";
+char TEMPFILE[MAXPATHLEN];
 
 char *TCID="hugemmap01";	/* Test program identifier.    */
 int TST_TOTAL=1;		/* Total number of test cases. */
 long *addr;			/* addr of memory mapped region */
 int fildes;			/* file descriptor for tempfile */
-char *Hopt;                     /* location of hugetlbfs */
+int hugepagesmapped=0;		/* Amount of huge pages mapped after testing */
 int beforetest=0;		/* Amount of free huge pages before testing */
 int aftertest=0;		/* Amount of free huge pages after testing */
-int hugepagesmapped=0;		/* Amount of huge pages mapped after testing */
+char *mount_point=NULL;
 
-void setup();			/* Main setup function of test */
-void cleanup();			/* cleanup function for the test */
-
-void help()
-{
-	printf("  -H /..  Location of hugetlbfs, i.e. -H /var/hugetlbfs \n");
-}
+void setup(void);			/* Main setup function of test */
+void cleanup(void);			/* cleanup function for the test */
 
 int
 main(int ac, char **av)
 {
 	int lc;			/* loop counter */
-	char *msg;		/* message returned from parse_opts */
-        int Hflag=0;              /* binary flag: opt or not */
 	int page_sz=0;
 
-       	option_t options[] = {

Review

Quoted 10 lines
(quoted diff) +0 -10
-        	{ "H:",   &Hflag, &Hopt },    /* Required for location of hugetlbfs */
-            	{ NULL, NULL, NULL }          /* NULL required to end array */
-       	};
-
-	/* Parse standard options given to run the test. */
-	msg = parse_opts(ac, av, options, &help);
-	if (msg != (char *) NULL) {
-		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s, use -help", msg);
-		tst_exit();
-	}

The parse_opts() should stay here but with NULL parameters there are some default options and it makes the test bail out on invalid options passed.

Quoted 53 lines
(quoted diff) +13 -12
-	if (Hflag == 0) {
-		tst_brkm(TBROK, NULL, "-H option is REQUIRED for this test, use -h for options help");
-		tst_exit();
-	}
-
 	setup();
 
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
@@ -189,18 +166,22 @@ main(int ac, char **av)
  * 	     Write some known data into file and get the size of the file.
  */
 void
-setup()
+setup(void)
 {
-	char mypid[40];
-
-	sprintf(mypid,"/%d",getpid());
-	TEMPFILE=strcat(mypid,TEMPFILE);
-	TEMPFILE=strcat(Hopt,TEMPFILE);
+	tst_require_root(NULL);
 
 	tst_sig(FORK, DEF_HANDLER, cleanup);
 
 	TEST_PAUSE;
 
+	tst_tmpdir();
+	mount_point = get_tst_tmpdir();
+
+	mount_hugetlbfs(mount_point);
+	hugepage_alloc(1024);
+
+	snprintf(TEMPFILE, sizeof(TEMPFILE), "%s/mmapfile%d", 
+		mount_point, getpid());
 }
 
 /*
@@ -209,7 +190,7 @@ setup()
  * 	       Remove the temporary directory created.
  */
 void
-cleanup()
+cleanup(void)
 {
 	/*
 	 * print timing stats if that option was specified.
@@ -218,4 +199,6 @@ cleanup()
 
 	unlink(TEMPFILE);
 
+	umount_hugetlbfs(mount_point);
+	tst_rmdir();
 }
Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#3 lore raw

Hi!

Quoted 3 lines

The parse_opts() should stay here but with NULL parameters there are some default options and it makes the test bail out on invalid options passed.

The same goes for the rest of the tests, without this the test looping wouldn't work. The rest seems to be good.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Hi!

Review

Quoted 6 lines
(quoted diff) +1 -1
 	/* Parse standard options given to run the test. */
-	msg = parse_opts(ac, av, options, &help);
+	msg = parse_opts(ac, av, NULL, NULL);
 	if (msg != (char *) NULL) {
 		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s, use -help", msg);
 		tst_exit();

The cast to (char *) is useless, please remove it, and also the tst_exit() don't need to be there as tst_brkm() calls the tst_exit() itself now.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#7 lore raw

Re: [LTP] [PATCH 0/6] Automatically mount hugetlbfs for hugemmap tests.

In reply to a message not in the archive

hi,

I have been waiting such a long time for the feedback of this patch set. Does anybody have any time to give some comments?
Thanks:)

Quoted 18 lines · tangchen

hi,

I am sorry for replying your comments so late. Here, I seperate all the code into 6 patches.

The purpose of this patch set is to automatically mount hugetlbfs for hugemmap tests, so that users don't need to mount hugetlbfs themselves before testing.

I made a new library, including some common functions, mounting hugetlbfs and allocating hugepages for test programs. And testcase hugemmap01 ~ hugemmap04 used these functions to mount hugetlbfs before testing.

Please comment! Thanks:)

Signature · 25 lines
Best Regards,
Tang chen
--------------------------------------------------
Tang Chen
Development Dept.I
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
No.6 Wenzhu Road, Nanjing, 210012, China 
TEL: +86+25-86630566-8527
FUJITSU INTERNAL: 7998-8527
FAX: +86+25-83317685
EMail: [email protected]
--------------------------------------------------
This communication is for use by the intended recipient(s) only and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not an intended recipient of this communication, you are hereby notified that any dissemination, distribution or copying hereof is strictly prohibited.  If you have received this communication in error, please notify me by reply e-mail, permanently delete this communication from your system, and destroy any hard copies you may have printed


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#8 lore raw

Re: [LTP] [PATCH 0/6] Automatically mount hugetlbfs for hugemmap tests.

Quoted 22 lines · tangchen

hi,

I have been waiting such a long time for the feedback of this patch set. Does anybody have any time to give some comments?
Thanks:)

Quoted 15 lines · tangchen

hi,

I am sorry for replying your comments so late. Here, I seperate all the code into 6 patches.

The purpose of this patch set is to automatically mount hugetlbfs for hugemmap tests, so that users don't need to mount hugetlbfs themselves before testing.

I made a new library, including some common functions, mounting hugetlbfs and allocating hugepages for test programs. And testcase hugemmap01 ~ hugemmap04 used these functions to mount hugetlbfs before testing.

Tang-Chen,
You didn't reply to all of my comments based on my looking back at
my gmail mailbox. Granted, I could have preened the messages by accident, but I don't see replies. If you can dig up links and/or [re]submit updated patches to the list, I'll review it today and commit them if the comments have been addressed.
Thanks!
-Garrett

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list