I changed #define ELEMENTS 1024*1024*64 to #define ELEMENTS 1024*1024*20,
and it takes effect. Thank you.
-------
And there is another question. It's on another machine
I take the following steps:
--------------
[root@ ~]# echo 1000 > /proc/sys/vm/nr_hugepages
[root@ ~]# mkdir /hugetlb
[root@ ~]# HUGETLB_MORECORE=yes LD_PRELOAD=libhugetlbfs.so ./a.out
---------------
There's should be output some error message, but it output nothing.
(I do this in order to check whether hugepage take effect.)
I think there's some wrong hugetlbfs setting, and I don't know why.
My machine total memory is 24GB, and hugepages is 434 pages.
Any help will appreciated.
--Easley
------------------ Original ------------------
From: "bill4carson"<bill4car...@gmail.com>;
Date: Fri, Dec 23, 2011 11:12 AM
To: "Easley"<ugi...@gmail.com>;
Cc: "libhugetlbfs-devel"<libhugetlbfs-devel@lists.sourceforge.net>;
Subject: Re: [Libhugetlbfs-devel] The Hugetlb looks like doesn't take effect.
On 2011年12月23日 10:37, Easley wrote:
>
> Hi,
>
> I run my program by follow:
> ---------------------------------
> [root@ ~]# echo 200 > /proc/sys/vm/nr_hugepages
> [root@ ~]# mkdir /hugetlb
> [root@ ~]# mount -t hugetlbfs hugetlbfs /hugetlb
> [root@ ~]# HUGETLB_MORECORE=yes LD_PRELOAD=libhugetlbfs.so ./a.out
> [root@ ~]# grep Huge /proc/meminfo
> HugePages_Total: 200
> HugePages_Free: 200
> HugePages_Rsvd: 0
> Hugepagesize: 2048 kB
> ------------------------------------------------
So you have 400M bytes memory based on huge page.
> And some machines output the follow msg.
> -----------
> libhugetlbfs: WARNING: New heap segment map at 0x40a00000 failed:
> Cannot allocate memory
> libhugetlbfs: WARNING: New heap segment map at 0x40a00000 failed:
> Cannot allocate memory
> ------------
> How can I do that?
> Any help will be appreciated.
>
> --Easley
>
>
>
> My program code (The code is not belong to me.)
> ----------------------
> #include <stdio.h>
> #include <stdlib.h>
>
> #define ELEMENTS 1024*1024*64
> static double bss_array_from[ELEMENTS];
> static double bss_array_to[ELEMENTS];
> static double *malloc_array_from;
> static double *malloc_array_to;
>
> int main() {
> int i;
> malloc_array_from = (double *)malloc(ELEMENTS*sizeof(double));
> malloc_array_to = (double *)malloc(ELEMENTS*sizeof(double));
>
I think you allocate much bigger than you set before.
Take a smaller size first, and try again.
good luck :)
> /* initialize and touch all of the pages */
> for (i = 1; i < ELEMENTS; i++) {
> bss_array_to[i] = 1.0;
> bss_array_from[i] = 2.0;
> malloc_array_to[i] = 3.0;
> malloc_array_from[i] = 4.0;
> }
>
> /* copy "from" "to" */
> for (i = 1; i < ELEMENTS; i++) {
> bss_array_to[i] = bss_array_from[i];
> malloc_array_to[i] = malloc_array_from[i];
> }
> return 0;
> }
> ---------------------------------
>
>
>
>
>
> ------------------------------------------------------------------------------
> Write once. Port to many.
> Get the SDK and tools to simplify cross-platform app development. Create
> new or port existing apps to sell to consumers worldwide. Explore the
> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
> http://p.sf.net/sfu/intel-appdev
>
>
> _______________________________________________
> Libhugetlbfs-devel mailing list
> Libhugetlbfs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel
--
I am a slow learner
but I will keep trying to fight for my dreams!
--bill
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel