Print this page
XXXX initialize cpu's sys and vm stats properly

@@ -3119,25 +3119,27 @@
         else
                 zoneid = ALL_ZONES;
         /*
          * Create named kstats
          */
-#define CPU_STATS_KS_CREATE(name, tsize, update_func)                    \
+#define CPU_STATS_KS_CREATE(name, template, update_func)                 \
         ksp = kstat_create_zone(module, instance, (name), class,         \
-            KSTAT_TYPE_NAMED, (tsize) / sizeof (kstat_named_t), 0,       \
-            zoneid);                                                     \
+            KSTAT_TYPE_NAMED, sizeof (template) / sizeof (kstat_named_t),\
+            0, zoneid);                                                  \
         if (ksp != NULL) {                                               \
+                bcopy(&template, ksp->ks_data, sizeof (template));       \
                 ksp->ks_private = cp;                                    \
                 ksp->ks_update = (update_func);                          \
                 kstat_install(ksp);                                      \
-        } else                                                           \
+        } else {                                                         \
                 cmn_err(CE_WARN, "cpu: unable to create %s:%d:%s kstat", \
-                    module, instance, (name));
+                    module, instance, (name));                           \
+        }                                                                \
 
-        CPU_STATS_KS_CREATE("sys", sizeof (cpu_sys_stats_ks_data_template),
+        CPU_STATS_KS_CREATE("sys", cpu_sys_stats_ks_data_template,
             cpu_sys_stats_ks_update);
-        CPU_STATS_KS_CREATE("vm", sizeof (cpu_vm_stats_ks_data_template),
+        CPU_STATS_KS_CREATE("vm", cpu_vm_stats_ks_data_template,
             cpu_vm_stats_ks_update);
 
         /*
          * Export the familiar cpu_stat_t KSTAT_TYPE_RAW kstat.
          */