harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x..@apache.org
Subject svn commit: r709117 - /harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/large_pages.cpp
Date Thu, 30 Oct 2008 08:45:19 GMT
Author: xli
Date: Thu Oct 30 01:45:19 2008
New Revision: 709117

URL: http://svn.apache.org/viewvc?rev=709117&view=rev
Log:
HARMONY-5049 : a minor fix to prevent mem size calculation overflow

Modified:
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/large_pages.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/large_pages.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/large_pages.cpp?rev=709117&r1=709116&r2=709117&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/large_pages.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/large_pages.cpp Thu Oct 30 01:45:19
2008
@@ -125,13 +125,14 @@
     LWARN(52, "GC large_page: Large pages are not supported by kernel.\nGC large_page: CONFIG_HUGETLB_PAGE
and CONFIG_HUGETLBFS needs to be enabled.");
   } else if (proc_huge_pages_total == 0){
     LWARN(53, "GC large_page: No large pages reserved,  Use the following command: echo num>
/proc/sys/vm/nr_hugepages.\nGC large_page: Do it just after kernel boot before huge pages
become fragmented.");
-  } else if (proc_huge_pages_free * proc_huge_page_size < required_size) {
-    if (proc_huge_pages_total * proc_huge_page_size >= required_size) {
-      LWARN(54, "GC large_page: Not enough free large pages, some of reserved space is already
busy.");
-    } else {
-      LWARN(54, "GC large_page: Not enough free large pages, some of reserved space is already
busy.");
+  } else {
+    //compute required huge page number
+    size_t required = (required_size+proc_huge_page_size-1)/proc_huge_page_size;
+    if (proc_huge_pages_total < required) {
+      LWARN(54, "GC large_page: required size exceeds total large page size.");
+    } else if (proc_huge_pages_free < required) {
+      LWARN(55, "GC large_page: required size exceeds free large page size.");
     }
-    LWARN(55, "GC large_page: Large pages can be only allocated.");
   }
 }
 



Mime
View raw message