Browse code

core: mem - use own functions for shm mod stats get operation

- protect with global lock for shm stats

Daniel-Constantin Mierla authored on 09/09/2020 16:44:46
Showing 3 changed files
... ...
@@ -1367,6 +1367,16 @@ void fm_shm_sums(void* qmp)
1367 1367
 	fm_sums(qmp);
1368 1368
 	fm_shm_unlock();
1369 1369
 }
1370
+void fm_shm_mod_get_stats(void *qmp, void **qm_rootp)
1371
+{
1372
+	fm_shm_lock();
1373
+	fm_mod_get_stats(qmp, qm_rootp);
1374
+	fm_shm_unlock();
1375
+}
1376
+void fm_shm_mod_free_stats(void *qm_rootp)
1377
+{
1378
+	fm_mod_free_stats(qm_rootp);
1379
+}
1370 1380
 
1371 1381
 
1372 1382
 /**
... ...
@@ -1413,8 +1423,8 @@ int fm_malloc_init_shm_manager(void)
1413 1423
 	ma.xavailable     = fm_shm_available;
1414 1424
 	ma.xsums          = fm_shm_sums;
1415 1425
 	ma.xdestroy       = fm_malloc_destroy_shm_manager;
1416
-	ma.xmodstats      = fm_mod_get_stats;
1417
-	ma.xfmodstats     = fm_mod_free_stats;
1426
+	ma.xmodstats      = fm_shm_mod_get_stats;
1427
+	ma.xfmodstats     = fm_shm_mod_free_stats;
1418 1428
 	ma.xglock         = fm_shm_glock;
1419 1429
 	ma.xgunlock       = fm_shm_gunlock;
1420 1430
 
... ...
@@ -1350,7 +1350,16 @@ void qm_shm_sums(void* qmp)
1350 1350
 	qm_sums(qmp);
1351 1351
 	qm_shm_unlock();
1352 1352
 }
1353
-
1353
+void qm_shm_mod_get_stats(void *qmp, void **qm_rootp)
1354
+{
1355
+	qm_shm_lock();
1356
+	qm_mod_get_stats(qmp, qm_rootp);
1357
+	qm_shm_unlock();
1358
+}
1359
+void qm_shm_mod_free_stats(void *qm_rootp)
1360
+{
1361
+	qm_mod_free_stats(qm_rootp);
1362
+}
1354 1363
 
1355 1364
 /**
1356 1365
  * \brief Destroy memory pool
... ...
@@ -1396,8 +1405,8 @@ int qm_malloc_init_shm_manager(void)
1396 1405
 	ma.xavailable     = qm_shm_available;
1397 1406
 	ma.xsums          = qm_shm_sums;
1398 1407
 	ma.xdestroy       = qm_malloc_destroy_shm_manager;
1399
-	ma.xmodstats      = qm_mod_get_stats;
1400
-	ma.xfmodstats     = qm_mod_free_stats;
1408
+	ma.xmodstats      = qm_shm_mod_get_stats;
1409
+	ma.xfmodstats     = qm_shm_mod_free_stats;
1401 1410
 	ma.xglock         = qm_shm_glock;
1402 1411
 	ma.xgunlock       = qm_shm_gunlock;
1403 1412
 
... ...
@@ -1607,6 +1607,16 @@ void tlsf_shm_sums(void* tlsfmp)
1607 1607
 	tlsf_sums(tlsfmp);
1608 1608
 	tlsf_shm_unlock();
1609 1609
 }
1610
+void tlsf_shm_mod_get_stats(void *qmp, void **qm_rootp)
1611
+{
1612
+	tlsf_shm_lock();
1613
+	tlsf_mod_get_stats(qmp, qm_rootp);
1614
+	tlsf_shm_unlock();
1615
+}
1616
+void tlsf_shm_mod_free_stats(void *qm_rootp)
1617
+{
1618
+	tlsf_mod_free_stats(qm_rootp);
1619
+}
1610 1620
 
1611 1621
 
1612 1622
 /**
... ...
@@ -1653,8 +1663,8 @@ int tlsf_malloc_init_shm_manager(void)
1653 1663
 	ma.xavailable     = tlsf_shm_available;
1654 1664
 	ma.xsums          = tlsf_shm_sums;
1655 1665
 	ma.xdestroy       = tlsf_malloc_destroy_shm_manager;
1656
-	ma.xmodstats      = tlsf_mod_get_stats;
1657
-	ma.xfmodstats     = tlsf_mod_free_stats;
1666
+	ma.xmodstats      = tlsf_shm_mod_get_stats;
1667
+	ma.xfmodstats     = tlsf_shm_mod_free_stats;
1658 1668
 	ma.xglock         = tlsf_shm_glock;
1659 1669
 	ma.xgunlock       = tlsf_shm_gunlock;
1660 1670