Index: trunk/kernel/mm/vmm.h
===================================================================
--- trunk/kernel/mm/vmm.h	(revision 632)
+++ trunk/kernel/mm/vmm.h	(revision 635)
@@ -52,5 +52,5 @@
  * - The allocator checks that the requested slot has not been already allocated, and set the
  *   corresponding bit in the bitmap.
- * - The de-allocator function reset the corresponding bit in the bitmap.
+ * - The de-allocator reset the corresponding bit in the bitmap.
  ********************************************************************************************/
 
@@ -112,31 +112,35 @@
 typedef struct vmm_s
 {
-	remote_rwlock_t  vsl_lock;           /*! lock protecting the local VSL                  */
-	xlist_entry_t    vsegs_root;         /*! Virtual Segment List (complete in reference)   */
-	uint32_t         vsegs_nr;           /*! total number of local vsegs                    */
-
-    gpt_t            gpt;                /*! Generic Page Table (complete in reference)     */
-
-    stack_mgr_t      stack_mgr;          /*! embedded STACK vsegs allocator                 */
-    mmap_mgr_t       mmap_mgr;           /*! embedded MMAP vsegs allocator                  */
-
-	uint32_t         pgfault_nr;         /*! page fault counter (instrumentation)           */
-
-    vpn_t            args_vpn_base;      /*! args vseg first page                           */
-    vpn_t            envs_vpn_base;      /*! envs vseg first page                           */
-	vpn_t            code_vpn_base;      /*! code vseg first page                           */
-	vpn_t            data_vpn_base;      /*! data vseg first page                           */
-    vpn_t            heap_vpn_base;      /*! heap zone first page                           */
-
-	intptr_t         entry_point;        /*! main thread entry point                        */
+	remote_rwlock_t  vsl_lock;            /*! lock protecting the local VSL                 */
+	xlist_entry_t    vsegs_root;          /*! Virtual Segment List (complete in reference)  */
+	uint32_t         vsegs_nr;            /*! total number of local vsegs                   */
+
+    gpt_t            gpt;                 /*! Generic Page Table (complete in reference)    */
+
+    stack_mgr_t      stack_mgr;           /*! embedded STACK vsegs allocator                */
+    mmap_mgr_t       mmap_mgr;            /*! embedded MMAP vsegs allocator                 */
+
+	uint32_t         false_pgfault_nr;    /*! false page fault counter (for all threads)    */
+	uint32_t         local_pgfault_nr;    /*! false page fault counter (for all threads)    */
+	uint32_t         global_pgfault_nr;   /*! false page fault counter (for all threads)    */
+    uint32_t         false_pgfault_cost;  /*! cumulated cost (for all threads)              */
+    uint32_t         local_pgfault_cost;  /*! cumulated cost (for all threads)              */
+    uint32_t         global_pgfault_cost; /*! cumulated cost (for all threads)              */
+
+    vpn_t            args_vpn_base;       /*! args vseg first page                          */
+    vpn_t            envs_vpn_base;       /*! envs vseg first page                          */
+	vpn_t            code_vpn_base;       /*! code vseg first page                          */
+	vpn_t            data_vpn_base;       /*! data vseg first page                          */
+    vpn_t            heap_vpn_base;       /*! heap zone first page                          */
+
+	intptr_t         entry_point;         /*! main thread entry point                       */
 }
 vmm_t;
 
 /*********************************************************************************************
- * This function mkkes a partial initialisation of the VMM attached to an user process. 
- * The GPT must have been previously created, with the hal_gpt_create() function.
- * - It registers "args", "envs" vsegs in the VSL.
- * - It initializes the STACK and MMAP allocators.
- * Note:
+ * This function makes only a partial initialisation of the VMM attached to an user
+ * process: It intializes the STACK and MMAP allocators, and the VSL lock.
+ * - The GPT has been previously created, with the hal_gpt_create() function.
+ * - The "kernel" vsegs are previously registered, by the hal_vmm_kernel_update() function.
  * - The "code" and "data" vsegs are registered by the elf_load_process() function.
  * - The "stack" vsegs are dynamically registered by the thread_user_create() function.
@@ -165,7 +169,10 @@
  * This function is called by the process_make_fork() function. It partially copies
  * the content of a remote parent process VMM to the local child process VMM:
+ * - The KERNEL vsegs required by the architecture must have been previously
+ *   created in the child VMM, using the hal_vmm_kernel_update() function.
  * - The DATA, ANON, REMOTE vsegs registered in the parent VSL are registered in the
- *   child VSL. All valid PTEs in parent GPT are copied to the child GPT, but the 
- *   WRITABLE flag is reset and the COW flag is set.
+ *   child VSL. All valid PTEs in parent GPT are copied to the child GPT.
+ *   The WRITABLE  and COW flags are not modified, as it will be done later for those
+ *   shared pages by the vmm_set_cow() function.
  * - The CODE vsegs registered in the parent VSL are registered in the child VSL, but the
  *   GPT entries are not copied in the child GPT, and will be dynamically updated from
@@ -173,8 +180,6 @@
  * - The FILE vsegs registered in the parent VSL are registered in the child VSL, and all
  *   valid GPT entries in parent GPT are copied to the child GPT. The COW flag is not set.
- * - No STACK vseg is copied from  parent VMM to child VMM, because the child stack vseg
- *   must be copied later from the cluster containing the user thread requesting the fork().
- * - The KERNEL vsegs required by the target architecture are re-created in the child
- *   VMM, from the local kernel process VMM, using the hal_vmm_kernel_update() function.
+ * - No STACK vseg is copied from  parent VMM to child VMM: the child stack vseg is copied
+ *   later from the cluster containing the user thread requesting the fork().
  *********************************************************************************************
  * @ child_process     : local pointer on local child process descriptor.
@@ -203,5 +208,5 @@
  * This function modifies one GPT entry identified by the <process> and <vpn> arguments
  * in all clusters containing a process copy. It is used to maintain coherence in GPT 
- * copies, using the list of copies stored in the owner process, and remote_write accesses.
+ * copies, using remote_write accesses.
  * It must be called by a thread running in the process owner cluster.
  * Use the RPC_VMM_GLOBAL_UPDATE_PTE if required.
@@ -248,7 +253,7 @@
  * - For the FILE, ANON, & REMOTE types, it does not use the <base> and <size> arguments,
  *   but uses the specific MMAP virtual memory allocator.
- * - For the STACK type, it does not use the <size> argument, and the <base> argument
- *   defines the user thread LTID used by the specific STACK virtual memory allocator.
- * It checks collision with all pre-existing vsegs.
+ * - For the STACK type, it does not use the <base> and <size> arguments,  but uses the
+ *   and the <base> argument the specific STACK virtual memory allocator.
+ * It checks collision with pre-existing vsegs.
  * To comply with the "on-demand" paging policy, this function does NOT modify the GPT,
  * and does not allocate physical memory for vseg data.
