Navigation Menu

Skip to content

Commit

Permalink
some variable and judgement are unnecessary in activate_mappings
Browse files Browse the repository at this point in the history
sign_off_by Shuang Xia <xiashuang1@huawei.com>
  • Loading branch information
Pyxisha committed Jul 15, 2019
1 parent f7fdebb commit cfe3d10
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions activate.c
Expand Up @@ -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*/
Expand Down

0 comments on commit cfe3d10

Please sign in to comment.