Skip to content
Permalink
Browse files

some variable and judgement are unnecessary in activate_mappings

sign_off_by Shuang Xia <xiashuang1@huawei.com>
  • Loading branch information...
Pyxisha committed Jul 15, 2019
1 parent f7fdebb commit cfe3d10d37e44be4bb94cb715dbe6fde9e8a60ff
Showing with 4 additions and 11 deletions.
  1. +4 −11 activate.c
@@ -60,35 +60,28 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
{
char buf[PATH_MAX];
FILE *file;
cpumask_t applied_mask;
int valid_mask = 0;

/*
* only activate mappings for irqs that have moved
*/
if (!info->moved)
return;

if (info->assigned_obj) {
applied_mask = info->assigned_obj->mask;
valid_mask = 1;
}
if (!info->assigned_obj)
return;

/*
* Don't activate anything for which we have an invalid mask
*/
if (!valid_mask || check_affinity(info, applied_mask))
return;

if (!info->assigned_obj)
if (check_affinity(info, info->assigned_obj->mask))
return;

sprintf(buf, "/proc/irq/%i/smp_affinity", info->irq);
file = fopen(buf, "w");
if (!file)
return;

cpumask_scnprintf(buf, PATH_MAX, applied_mask);
cpumask_scnprintf(buf, PATH_MAX, info->assigned_obj->mask);
fprintf(file, "%s", buf);
fclose(file);
info->moved = 0; /*migration is done*/

0 comments on commit cfe3d10

Please sign in to comment.
You can’t perform that action at this time.