Revision: 17014
          http://sourceforge.net/p/edk2/code/17014
Author:   lgao4
Date:     2015-03-06 02:56:20 +0000 (Fri, 06 Mar 2015)
Log Message:
-----------
MdeModulePkg: carve pool pages into the largest chunks possible

In preparation of the next patch, that serves allocations from higher-up
bins if the current bin is depleted, this patch updates the carving up
strategy to populate the largest bins first. To ensure that there will
always be an allocation of the appropriate size made, the current allocation
request is served first from the newly allocated memory region.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <[email protected]>
Reviewed-by: Liming Gao <[email protected]>

Modified Paths:
--------------
    trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Pool.c

Modified: trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Pool.c
===================================================================
--- trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Pool.c 2015-03-06 02:55:35 UTC (rev 
17013)
+++ trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Pool.c 2015-03-06 02:56:20 UTC (rev 
17014)
@@ -352,9 +352,15 @@
     }
 
     //
-    // Carve up new page into free pool blocks
+    // Serve the allocation request from the head of the allocated block
     //
-    Offset = 0;
+    Head = (POOL_HEAD *) NewPage;
+    Offset = LIST_TO_SIZE (Index);
+
+    //
+    // Carve up remaining space into free pool blocks
+    //
+    Index = SIZE_TO_LIST (Granularity) - 1;
     while (Offset < Granularity) {
       ASSERT (Index < MAX_POOL_LIST);
       FSize = LIST_TO_SIZE(Index);
@@ -371,7 +377,7 @@
     }
 
     ASSERT (Offset == Granularity);
-    Index = SIZE_TO_LIST(Size);
+    goto Done;
   }
 
   //


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to