| @@ -341,14 +341,14 @@ static int cpus_mon_write(struct rdtgroup *rdtgrp, cpumask_var_t newmask, · 340 unmodified lines |
| 341 | | 341 | |
| 342 | /* Check whether cpus belong to parent ctrl group */ | 342 | /* Check whether cpus belong to parent ctrl group */ |
| 343 | cpumask_andnot(tmpmask, newmask, &prgrp->cpu_mask); | 343 | cpumask_andnot(tmpmask, newmask, &prgrp->cpu_mask); |
| 344 | if (cpumask_weight(tmpmask)) { | 344 | if (!cpumask_empty(tmpmask)) { |
| 345 | rdt_last_cmd_puts("Can only add CPUs to mongroup that belong to parent\n"); | 345 | rdt_last_cmd_puts("Can only add CPUs to mongroup that belong to parent\n"); |
| 346 | return -EINVAL; | 346 | return -EINVAL; |
| 347 | } | 347 | } |
| 348 | | 348 | |
| 349 | /* Check whether cpus are dropped from this group */ | 349 | /* Check whether cpus are dropped from this group */ |
| 350 | cpumask_andnot(tmpmask, &rdtgrp->cpu_mask, newmask); | 350 | cpumask_andnot(tmpmask, &rdtgrp->cpu_mask, newmask); |
| 351 | if (cpumask_weight(tmpmask)) { | 351 | if (!cpumask_empty(tmpmask)) { |
| 352 | /* Give any dropped cpus to parent rdtgroup */ | 352 | /* Give any dropped cpus to parent rdtgroup */ |
| 353 | cpumask_or(&prgrp->cpu_mask, &prgrp->cpu_mask, tmpmask); | 353 | cpumask_or(&prgrp->cpu_mask, &prgrp->cpu_mask, tmpmask); |
| 354 | update_closid_rmid(tmpmask, prgrp); | 354 | update_closid_rmid(tmpmask, prgrp); |
| @@ -359,7 +359,7 @@ static int cpus_mon_write(struct rdtgroup *rdtgrp, cpumask_var_t newmask, · 4 unmodified lines |
| 359 | * and update per-cpu rmid | 359 | * and update per-cpu rmid |
| 360 | */ | 360 | */ |
| 361 | cpumask_andnot(tmpmask, newmask, &rdtgrp->cpu_mask); | 361 | cpumask_andnot(tmpmask, newmask, &rdtgrp->cpu_mask); |
| 362 | if (cpumask_weight(tmpmask)) { | 362 | if (!cpumask_empty(tmpmask)) { |
| 363 | head = &prgrp->mon.crdtgrp_list; | 363 | head = &prgrp->mon.crdtgrp_list; |
| 364 | list_for_each_entry(crgrp, head, mon.crdtgrp_list) { | 364 | list_for_each_entry(crgrp, head, mon.crdtgrp_list) { |
| 365 | if (crgrp == rdtgrp) | 365 | if (crgrp == rdtgrp) |
| @@ -394,7 +394,7 @@ static int cpus_ctrl_write(struct rdtgroup *rdtgrp, cpumask_var_t newmask, · 28 unmodified lines |
| 394 | | 394 | |
| 395 | /* Check whether cpus are dropped from this group */ | 395 | /* Check whether cpus are dropped from this group */ |
| 396 | cpumask_andnot(tmpmask, &rdtgrp->cpu_mask, newmask); | 396 | cpumask_andnot(tmpmask, &rdtgrp->cpu_mask, newmask); |
| 397 | if (cpumask_weight(tmpmask)) { | 397 | if (!cpumask_empty(tmpmask)) { |
| 398 | /* Can't drop from default group */ | 398 | /* Can't drop from default group */ |
| 399 | if (rdtgrp == &rdtgroup_default) { | 399 | if (rdtgrp == &rdtgroup_default) { |
| 400 | rdt_last_cmd_puts("Can't drop CPUs from default group\n"); | 400 | rdt_last_cmd_puts("Can't drop CPUs from default group\n"); |
| @@ -413,12 +413,12 @@ static int cpus_ctrl_write(struct rdtgroup *rdtgrp, cpumask_var_t newmask, · 12 unmodified lines |
| 413 | * and update per-cpu closid/rmid. | 413 | * and update per-cpu closid/rmid. |
| 414 | */ | 414 | */ |
| 415 | cpumask_andnot(tmpmask, newmask, &rdtgrp->cpu_mask); | 415 | cpumask_andnot(tmpmask, newmask, &rdtgrp->cpu_mask); |
| 416 | if (cpumask_weight(tmpmask)) { | 416 | if (!cpumask_empty(tmpmask)) { |
| 417 | list_for_each_entry(r, &rdt_all_groups, rdtgroup_list) { | 417 | list_for_each_entry(r, &rdt_all_groups, rdtgroup_list) { |
| 418 | if (r == rdtgrp) | 418 | if (r == rdtgrp) |
| 419 | continue; | 419 | continue; |
| 420 | cpumask_and(tmpmask1, &r->cpu_mask, tmpmask); | 420 | cpumask_and(tmpmask1, &r->cpu_mask, tmpmask); |
| 421 | if (cpumask_weight(tmpmask1)) | 421 | if (!cpumask_empty(tmpmask1)) |
| 422 | cpumask_rdtgrp_clear(r, tmpmask1); | 422 | cpumask_rdtgrp_clear(r, tmpmask1); |
| 423 | } | 423 | } |
| 424 | update_closid_rmid(tmpmask, rdtgrp); | 424 | update_closid_rmid(tmpmask, rdtgrp); |
| @@ -488,7 +488,7 @@ static ssize_t rdtgroup_cpus_write(struct kernfs_open_file *of, · 63 unmodified lines |
| 488 | | 488 | |
| 489 | /* check that user didn't specify any offline cpus */ | 489 | /* check that user didn't specify any offline cpus */ |
| 490 | cpumask_andnot(tmpmask, newmask, cpu_online_mask); | 490 | cpumask_andnot(tmpmask, newmask, cpu_online_mask); |
| 491 | if (cpumask_weight(tmpmask)) { | 491 | if (!cpumask_empty(tmpmask)) { |
| 492 | ret = -EINVAL; | 492 | ret = -EINVAL; |
| 493 | rdt_last_cmd_puts("Can only assign online CPUs\n"); | 493 | rdt_last_cmd_puts("Can only assign online CPUs\n"); |
| 494 | goto unlock; | 494 | goto unlock; |