Index: trunk/kernel/kern/dqdt.h
===================================================================
--- trunk/kernel/kern/dqdt.h	(revision 564)
+++ trunk/kernel/kern/dqdt.h	(revision 582)
@@ -31,5 +31,5 @@
 /****************************************************************************************
  * This DQDT infrastructure maintains a topological description of ressources usage
- * (number of threads, and number of physical pages allocated) in each cluster.
+ * in each cluster: number of threads, and number of physical pages allocated.
  *
  * - If X_SIZE or Y_SIZE are equal to 1, it makes the assumption that the cluster
@@ -42,12 +42,12 @@
  * - If both Y_SIZE and Y_SIZE are larger than 1, it makes the assumption that
  *   the clusters topology is a 2D mesh. The [X,Y] coordinates of a cluster are
- *   obtained from the CXY identifier using the following rules :
+ *   obtained from the CXY identifier using the Rrelevant macros.
  *      X = CXY >> Y_WIDTH   /  Y = CXY & ((1<<Y_WIDTH)-1)
- *   If the mesh X_SIZE and Y_SIZE dimensions are not equal, or are not power of 2,
+ * - If the mesh X_SIZE and Y_SIZE dimensions are not equal, or are not power of 2,
+ *   or the mesh contains "holes" reported in the cluster_info[x][y] array,
  *   we build the smallest two dimensionnal quad-tree covering all clusters,
  *   and this tree is truncated as required.
- *   The root node is always implemented in cluster [0,0]
- *   The mesh size is supposed to contain at most 32 * 32 clusters.
- *   There are at most 6 DQDT nodes in a cluster
+ * - The mesh size is supposed to contain at most 32 * 32 clusters.
+ *   Therefore, it can exist at most 6 DQDT nodes in a given cluster:
  *   . Level 0 nodes exist on all clusters and have no children.
  *   . Level 1 nodes exist when both X and Y coordinates are multiple of 2
@@ -56,6 +56,9 @@
  *   . Level 4 nodes exist when both X and Y coordinates are multiple of 16
  *   . Level 5 nodes exist when both X and Y coordinates are multiple of 32
- *
- *   TODO : the cluster_info[x][y] array is not taken into account [AG].
+ * - For nodes other than level 0, the placement is defined as follow:
+ *   . The root node is placed in the cluster containing the core executing 
+ *     the dqdt_init() function.
+ *   . An intermediate node (representing a given sub-tree) is placed in one
+ *     cluster covered by the subtree, pseudo-randomly selected.
  ***************************************************************************************/
 
@@ -64,6 +67,7 @@
  * The max number of children is 4, but it can be smaller for some nodes.
  * Level 0 nodes are the clusters, and have no children.
- * The root node has no parent, and is always stored in cluster[0,0].
+ * The root node has no parent.
  ***************************************************************************************/
+
 typedef struct dqdt_node_s
 {
@@ -73,5 +77,5 @@
     uint32_t            pages;               // current number of pages in subtree
 	xptr_t              parent;              // extended pointer on parent node
-	xptr_t              children[4];         // extended pointers on children nodes
+	xptr_t              children[2][2];      // extended pointers on children nodes
 }
 dqdt_node_t;
@@ -79,17 +83,14 @@
 
 /****************************************************************************************
- * This local function initializes the local DQDT structures.
- * The information describing the hardware platform topology and the cluster
- * indexing policy is defined by the three arguments below.
- * This initialisation is done in parallel, locally in each cluster, because the DQDT
- * is allocated as a global variable in the cluster_manager, and the local addresses
+ * This function recursively initializes the DQDT structure from informations
+ * stored in cluster manager (x_size, y_size and cluster_info[x][y].
+ * It is executed in all clusters by the local CP0, to compute level_max and register
+ * the DQDT root node in each cluster manager, but only CPO in cluster 0 build actually
+ * the quad-tree covering all active clusters.
+ * This initialisation can use remote_accesses, because the DQDT nodes are
+ * allocated as global variables in the cluster_manager, and the local addresses
  * are identical in all clusters.
- ****************************************************************************************
- * @ x_size   : number of clusters (containing memory and CPUs) in a row
- * @ y_size   : number of clusters (containing memory and CPUs) in a column
- * @ return the number of levels in quad-tree.
  ***************************************************************************************/
-uint32_t dqdt_init( uint32_t x_size,
-                    uint32_t y_size );
+void dqdt_init( void );
 
 /****************************************************************************************
