>-----Original Message-----
>From: Wanlong Gao [mailto:[email protected]]
>Sent: Tuesday, February 07, 2012 3:15 PM
>To: Shang, YanFeng
>Cc: [email protected]; [email protected]
>Subject: Re: [LTP] [PATCH] updated mmap2.c for low memory target
>
>On 02/06/2012 05:18 PM, Shang Yanfeng wrote:
>
>> many low memory boards don't have 1G memory,so add get_free_mem function for
>low memory target,
>> limit 3000M for 64bit kernel with n32 file system.
>
>
>Can you explain that why limit 3000M for 64bit? and the n32 file system,
>can you give a example? You means the file system may failure with the
>not limited memory?
I test this using a x86 target with 24G memory. When using n32 file system,
./mmap2 -x 0.002 -a -p -s 3829 (success)
./mmap2 -x 0.002 -a -p -s 3830 (failed)
I think because n32 address limit.
When using n64 file system.
root@localhost:/> ./mmap2latest1 -x 0.002 -a -p -s 8000
MM Stress test, map/write/unmap large file
Test scheduled to run for: 0.002000
Size of temp file in MB: 8000
file mapped at 0x7f7dd402c000
changing file content to 'A'
unmapped file at 0x7f7dd402c000
file mapped at 0x7f7dd402c000
changing file content to 'A'
Test ended, success
>
>a bit comment below:
>
>>
>> Signed-off-by: Shang Yanfeng <[email protected]>
>> ---
>> testcases/kernel/mem/mtest06/mmap2.c | 50
>++++++++++++++++++++++++++-------
>> 1 files changed, 39 insertions(+), 11 deletions(-)
>>
>> diff --git a/testcases/kernel/mem/mtest06/mmap2.c
>b/testcases/kernel/mem/mtest06/mmap2.c
>> index 6d56a54..f9b7ccd 100644
>> --- a/testcases/kernel/mem/mtest06/mmap2.c
>> +++ b/testcases/kernel/mem/mtest06/mmap2.c
>> @@ -68,13 +68,14 @@
>> #include <signal.h>
>> #include <sys/time.h>
>> #include <sys/wait.h>
>> +#include <sys/sysinfo.h>
>> #include <signal.h>
>> #include <string.h>
>> #include <getopt.h>
>> #include "test.h"
>> #include "usctest.h"
>>
>> -#define GB 1000000000
>> +#define MB 1048576
>
>
>I wonder that why did the author definite the GB like this?
Only guess author want using big memory.
>
>> #ifndef TRUE
>> #define TRUE 1
>> #endif
>> @@ -100,7 +101,7 @@ static int mkfile(int size)
>> fprintf(stdout, "creating tmp file and writing 'a' to it ");
>> }
>>
>> - while (index < (size * GB)) {
>> + while (index < (size * MB)) {
>> index += 4096;
>> if (write(fd, buff, 4096) == -1) {
>> perror("mkfile(): write()");
>> @@ -128,6 +129,17 @@ static void sig_handler(int signal)
>> exit(0);
>> }
>>
>> +
>> +unsigned long get_free_mem()
>
>
>This may be *static* if no one else use this.
>
>> +{
>> + struct sysinfo board_sysinfo;
>> + unsigned long avail_mem;
>> + if (sysinfo(&board_sysinfo))
>> + perror("sysinfo failed\n");
>> + avail_mem = board_sysinfo.freeram/MB;
>> + return avail_mem;
>> +}
>> +
>> static void usage(char *progname)
>> {
>> fprintf(stderr,
>> @@ -137,7 +149,7 @@ static void usage(char *progname)
>> "\t -p set map_flag to MAP_PRIVATE.\tdefault:"
>> "MAP_SHARED\n"
>> "\t -s size of the file/memory to be mmaped.\tdefault:"
>> - "1GB\n"
>> + "1000MB\n"
>
>
>Now, the 1000MB not equal the origin 1GB, what did you think about this?
I think this test case only want to mmap big memory.
>
>
>Thanks
>-Wanlong Gao
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list