Print this page
XXXX pass in cpu_pause_func via pause_cpus


1280                 return;
1281         }
1282 
1283         /*
1284          * Update lgroup topology with new memory resources, keeping track of
1285          * which lgroups change
1286          */
1287         count = 0;
1288         klgrpset_clear(changed);
1289         my_lgrp = lgrp_hand_to_lgrp(hand);
1290         if (my_lgrp == NULL) {
1291                 /* new lgrp */
1292                 my_lgrp = lgrp_create();
1293                 lgrpid = my_lgrp->lgrp_id;
1294                 my_lgrp->lgrp_plathand = hand;
1295                 my_lgrp->lgrp_latency = lgrp_plat_latency(hand, hand);
1296                 klgrpset_add(my_lgrp->lgrp_leaves, lgrpid);
1297                 klgrpset_add(my_lgrp->lgrp_set[LGRP_RSRC_MEM], lgrpid);
1298 
1299                 if (need_synch)
1300                         pause_cpus(NULL);
1301                 count = lgrp_leaf_add(my_lgrp, lgrp_table, lgrp_alloc_max + 1,
1302                     &changed);
1303                 if (need_synch)
1304                         start_cpus();
1305         } else if (my_lgrp->lgrp_latency == 0 && lgrp_plat_latency(hand, hand)
1306             > 0) {
1307                 /*
1308                  * Leaf lgroup was created, but latency wasn't available
1309                  * then.  So, set latency for it and fill in rest of lgroup
1310                  * topology  now that we know how far it is from other leaf
1311                  * lgroups.
1312                  */
1313                 klgrpset_clear(changed);
1314                 lgrpid = my_lgrp->lgrp_id;
1315                 if (!klgrpset_ismember(my_lgrp->lgrp_set[LGRP_RSRC_MEM],
1316                     lgrpid))
1317                         klgrpset_add(my_lgrp->lgrp_set[LGRP_RSRC_MEM], lgrpid);
1318                 if (need_synch)
1319                         pause_cpus(NULL);
1320                 count = lgrp_leaf_add(my_lgrp, lgrp_table, lgrp_alloc_max + 1,
1321                     &changed);
1322                 if (need_synch)
1323                         start_cpus();
1324         } else if (!klgrpset_ismember(my_lgrp->lgrp_set[LGRP_RSRC_MEM],
1325             my_lgrp->lgrp_id)) {
1326                 /*
1327                  * Add new lgroup memory resource to existing lgroup
1328                  */
1329                 lgrpid = my_lgrp->lgrp_id;
1330                 klgrpset_add(my_lgrp->lgrp_set[LGRP_RSRC_MEM], lgrpid);
1331                 klgrpset_add(changed, lgrpid);
1332                 count++;
1333                 for (i = 0; i <= lgrp_alloc_max; i++) {
1334                         lgrp_t          *lgrp;
1335 
1336                         lgrp = lgrp_table[i];
1337                         if (!LGRP_EXISTS(lgrp) ||
1338                             !lgrp_rsets_member(lgrp->lgrp_set, lgrpid))
1339                                 continue;


1460                 return;
1461         }
1462 
1463         /*
1464          * This lgroup does not contain any memory now
1465          */
1466         klgrpset_clear(my_lgrp->lgrp_set[LGRP_RSRC_MEM]);
1467 
1468         /*
1469          * Remove this lgroup from lgroup topology if it does not contain any
1470          * resources now
1471          */
1472         lgrpid = my_lgrp->lgrp_id;
1473         count = 0;
1474         klgrpset_clear(changed);
1475         if (lgrp_rsets_empty(my_lgrp->lgrp_set)) {
1476                 /*
1477                  * Delete lgroup when no more resources
1478                  */
1479                 if (need_synch)
1480                         pause_cpus(NULL);
1481                 count = lgrp_leaf_delete(my_lgrp, lgrp_table,
1482                     lgrp_alloc_max + 1, &changed);
1483                 ASSERT(count > 0);
1484                 if (need_synch)
1485                         start_cpus();
1486         } else {
1487                 /*
1488                  * Remove lgroup from memory resources of any lgroups that
1489                  * contain it as such
1490                  */
1491                 for (i = 0; i <= lgrp_alloc_max; i++) {
1492                         lgrp_t          *lgrp;
1493 
1494                         lgrp = lgrp_table[i];
1495                         if (!LGRP_EXISTS(lgrp) ||
1496                             !klgrpset_ismember(lgrp->lgrp_set[LGRP_RSRC_MEM],
1497                             lgrpid))
1498                                 continue;
1499 
1500                         klgrpset_del(lgrp->lgrp_set[LGRP_RSRC_MEM], lgrpid);




1280                 return;
1281         }
1282 
1283         /*
1284          * Update lgroup topology with new memory resources, keeping track of
1285          * which lgroups change
1286          */
1287         count = 0;
1288         klgrpset_clear(changed);
1289         my_lgrp = lgrp_hand_to_lgrp(hand);
1290         if (my_lgrp == NULL) {
1291                 /* new lgrp */
1292                 my_lgrp = lgrp_create();
1293                 lgrpid = my_lgrp->lgrp_id;
1294                 my_lgrp->lgrp_plathand = hand;
1295                 my_lgrp->lgrp_latency = lgrp_plat_latency(hand, hand);
1296                 klgrpset_add(my_lgrp->lgrp_leaves, lgrpid);
1297                 klgrpset_add(my_lgrp->lgrp_set[LGRP_RSRC_MEM], lgrpid);
1298 
1299                 if (need_synch)
1300                         pause_cpus(NULL, NULL);
1301                 count = lgrp_leaf_add(my_lgrp, lgrp_table, lgrp_alloc_max + 1,
1302                     &changed);
1303                 if (need_synch)
1304                         start_cpus();
1305         } else if (my_lgrp->lgrp_latency == 0 && lgrp_plat_latency(hand, hand)
1306             > 0) {
1307                 /*
1308                  * Leaf lgroup was created, but latency wasn't available
1309                  * then.  So, set latency for it and fill in rest of lgroup
1310                  * topology  now that we know how far it is from other leaf
1311                  * lgroups.
1312                  */
1313                 klgrpset_clear(changed);
1314                 lgrpid = my_lgrp->lgrp_id;
1315                 if (!klgrpset_ismember(my_lgrp->lgrp_set[LGRP_RSRC_MEM],
1316                     lgrpid))
1317                         klgrpset_add(my_lgrp->lgrp_set[LGRP_RSRC_MEM], lgrpid);
1318                 if (need_synch)
1319                         pause_cpus(NULL, NULL);
1320                 count = lgrp_leaf_add(my_lgrp, lgrp_table, lgrp_alloc_max + 1,
1321                     &changed);
1322                 if (need_synch)
1323                         start_cpus();
1324         } else if (!klgrpset_ismember(my_lgrp->lgrp_set[LGRP_RSRC_MEM],
1325             my_lgrp->lgrp_id)) {
1326                 /*
1327                  * Add new lgroup memory resource to existing lgroup
1328                  */
1329                 lgrpid = my_lgrp->lgrp_id;
1330                 klgrpset_add(my_lgrp->lgrp_set[LGRP_RSRC_MEM], lgrpid);
1331                 klgrpset_add(changed, lgrpid);
1332                 count++;
1333                 for (i = 0; i <= lgrp_alloc_max; i++) {
1334                         lgrp_t          *lgrp;
1335 
1336                         lgrp = lgrp_table[i];
1337                         if (!LGRP_EXISTS(lgrp) ||
1338                             !lgrp_rsets_member(lgrp->lgrp_set, lgrpid))
1339                                 continue;


1460                 return;
1461         }
1462 
1463         /*
1464          * This lgroup does not contain any memory now
1465          */
1466         klgrpset_clear(my_lgrp->lgrp_set[LGRP_RSRC_MEM]);
1467 
1468         /*
1469          * Remove this lgroup from lgroup topology if it does not contain any
1470          * resources now
1471          */
1472         lgrpid = my_lgrp->lgrp_id;
1473         count = 0;
1474         klgrpset_clear(changed);
1475         if (lgrp_rsets_empty(my_lgrp->lgrp_set)) {
1476                 /*
1477                  * Delete lgroup when no more resources
1478                  */
1479                 if (need_synch)
1480                         pause_cpus(NULL, NULL);
1481                 count = lgrp_leaf_delete(my_lgrp, lgrp_table,
1482                     lgrp_alloc_max + 1, &changed);
1483                 ASSERT(count > 0);
1484                 if (need_synch)
1485                         start_cpus();
1486         } else {
1487                 /*
1488                  * Remove lgroup from memory resources of any lgroups that
1489                  * contain it as such
1490                  */
1491                 for (i = 0; i <= lgrp_alloc_max; i++) {
1492                         lgrp_t          *lgrp;
1493 
1494                         lgrp = lgrp_table[i];
1495                         if (!LGRP_EXISTS(lgrp) ||
1496                             !klgrpset_ismember(lgrp->lgrp_set[LGRP_RSRC_MEM],
1497                             lgrpid))
1498                                 continue;
1499 
1500                         klgrpset_del(lgrp->lgrp_set[LGRP_RSRC_MEM], lgrpid);