On Fri, May 29, 2009 at 06:24:41PM -0700, Avantika Mathur wrote: > Mel Gorman wrote: > >>> + >>> + /* swapsize is 5 hugepages (in KB) */ >>> + swap_size = gethugepagesize() * 5; >>> + buf = malloc(swap_size); >>> + memset(buf, 0, swap_size); >>> + fwrite(buf, sizeof(char), swap_size, f); >>> + free(buf); >>> + fclose(f); >>> >> >> Just out of curiousity, why did you not use ftruncate? >> > When I had tried with ftruncate, the swapon failed with the > message that the swapfile has holes, that is why I went this way.
All right, that's fine. I thought that swapon might be able to deal with sparse files and fille them in but apparently not. > Don't > know if there is another better option? > There wasn't need to create a buffer of the same size but as the buffer should never be that large, this will work just fine. Thanks -- Mel Gorman Part-time Phd Student Linux Technology Center University of Limerick IBM Dublin Software Lab ------------------------------------------------------------------------------ OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get _______________________________________________ Libhugetlbfs-devel mailing list Libhugetlbfs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel