@@ -1256,13 +1256,15 @@ hwloc__export_synthetic_indexes(hwloc_obj_t *level, unsigned total,
1256
1256
1257
1257
static int
1258
1258
hwloc__export_synthetic_obj_attr (struct hwloc_topology * topology ,
1259
+ unsigned long flags ,
1259
1260
hwloc_obj_t obj ,
1260
1261
char * buffer , size_t buflen )
1261
1262
{
1262
1263
const char * separator = " " ;
1263
1264
const char * prefix = "(" ;
1264
1265
char cachesize [64 ] = "" ;
1265
1266
char memsize [64 ] = "" ;
1267
+ char memorysidecachesize [64 ] = "" ;
1266
1268
int needindexes = 0 ;
1267
1269
1268
1270
if (hwloc__obj_type_is_cache (obj -> type ) && obj -> attr -> cache .size ) {
@@ -1275,6 +1277,19 @@ hwloc__export_synthetic_obj_attr(struct hwloc_topology * topology,
1275
1277
prefix , (unsigned long long ) obj -> attr -> numanode .local_memory );
1276
1278
prefix = separator ;
1277
1279
}
1280
+ if (obj -> type == HWLOC_OBJ_NUMANODE && !(flags & HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_V1 )) {
1281
+ hwloc_obj_t memorysidecache = obj -> parent ;
1282
+ hwloc_uint64_t size = 0 ;
1283
+ while (memorysidecache && memorysidecache -> type == HWLOC_OBJ_MEMCACHE ) {
1284
+ size += memorysidecache -> attr -> cache .size ;
1285
+ memorysidecache = memorysidecache -> parent ;
1286
+ }
1287
+ if (size ) {
1288
+ snprintf (memorysidecachesize , sizeof (memorysidecachesize ), "%smemorysidecachesize=%llu" ,
1289
+ prefix , (unsigned long long ) size );
1290
+ prefix = separator ;
1291
+ }
1292
+ }
1278
1293
if (!obj -> logical_index /* only display indexes once per level (not for non-first NUMA children, etc.) */
1279
1294
&& (obj -> type == HWLOC_OBJ_PU || obj -> type == HWLOC_OBJ_NUMANODE )) {
1280
1295
hwloc_obj_t cur = obj ;
@@ -1286,12 +1301,12 @@ hwloc__export_synthetic_obj_attr(struct hwloc_topology * topology,
1286
1301
cur = cur -> next_cousin ;
1287
1302
}
1288
1303
}
1289
- if (* cachesize || * memsize || needindexes ) {
1304
+ if (* cachesize || * memsize || * memorysidecachesize || needindexes ) {
1290
1305
ssize_t tmplen = buflen ;
1291
1306
char * tmp = buffer ;
1292
1307
int res , ret = 0 ;
1293
1308
1294
- res = hwloc_snprintf (tmp , tmplen , "%s%s%s" , cachesize , memsize , needindexes ? "" : ")" );
1309
+ res = hwloc_snprintf (tmp , tmplen , "%s%s%s%s " , cachesize , memsize , memorysidecachesize , needindexes ? "" : ")" );
1295
1310
if (hwloc__export_synthetic_update_status (& ret , & tmp , & tmplen , res ) < 0 )
1296
1311
return -1 ;
1297
1312
@@ -1365,7 +1380,7 @@ hwloc__export_synthetic_obj(struct hwloc_topology * topology, unsigned long flag
1365
1380
1366
1381
if (!(flags & HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_ATTRS )) {
1367
1382
/* obj attributes */
1368
- res = hwloc__export_synthetic_obj_attr (topology , obj , tmp , tmplen );
1383
+ res = hwloc__export_synthetic_obj_attr (topology , flags , obj , tmp , tmplen );
1369
1384
if (hwloc__export_synthetic_update_status (& ret , & tmp , & tmplen , res ) < 0 )
1370
1385
return -1 ;
1371
1386
}
@@ -1411,21 +1426,19 @@ hwloc__export_synthetic_memory_children(struct hwloc_topology * topology, unsign
1411
1426
}
1412
1427
1413
1428
while (mchild ) {
1414
- /* FIXME: really recurse to export memcaches and numanode,
1429
+ /* The core doesn't support shared memcache for now (because ACPI and Linux don't).
1430
+ * So, for each mchild here, recurse only in the first children at each level.
1431
+ *
1432
+ * FIXME: whenever supported by the core, really recurse to export memcaches and numanode,
1415
1433
* but it requires clever parsing of [ memcache [numa] [numa] ] during import,
1416
1434
* better attaching of things to describe the hierarchy.
1417
1435
*/
1418
1436
hwloc_obj_t numanode = mchild ;
1419
- /* only export the first NUMA node leaf of each memory child.
1420
- * memcache are ignored. non-first child of memcaches are also ignored.
1437
+ /* Only export the first NUMA node leaf of each memory child.
1438
+ * Memcaches are ignored here, they will be summed and exported as a single attribute
1439
+ * of the NUMA node in hwloc__export_synthetic_obj().
1421
1440
*/
1422
1441
while (numanode && numanode -> type != HWLOC_OBJ_NUMANODE ) {
1423
- if (verbose ) {
1424
- static int warned = 0 ;
1425
- if (!warned )
1426
- fprintf (stderr , "Ignoring memory objects that are not NUMA nodes.\n" );
1427
- warned = 1 ;
1428
- }
1429
1442
if (verbose && numanode -> memory_arity > 1 ) {
1430
1443
static int warned = 0 ;
1431
1444
if (!warned )
@@ -1591,7 +1604,7 @@ hwloc_topology_export_synthetic(struct hwloc_topology * topology,
1591
1604
1592
1605
if (!(flags & HWLOC_TOPOLOGY_EXPORT_SYNTHETIC_FLAG_NO_ATTRS )) {
1593
1606
/* obj attributes */
1594
- res = hwloc__export_synthetic_obj_attr (topology , obj , tmp , tmplen );
1607
+ res = hwloc__export_synthetic_obj_attr (topology , flags , obj , tmp , tmplen );
1595
1608
if (res > 0 )
1596
1609
needprefix = 1 ;
1597
1610
if (hwloc__export_synthetic_update_status (& ret , & tmp , & tmplen , res ) < 0 )
0 commit comments