Skip to content

Commit

Permalink
powerpc/pseries/mobility: use cond_resched when updating device tree
Browse files Browse the repository at this point in the history
After a partition migration, pseries_devicetree_update() processes
changes to the device tree communicated from the platform to
Linux. This is a relatively heavyweight operation, with multiple
device tree searches, memory allocations, and conversations with
partition firmware.

There's a few levels of nested loops which are bounded only by
decisions made by the platform, outside of Linux's control, and indeed
we have seen RCU stalls on large systems while executing this call
graph. Use cond_resched() in these loops so that the cpu is yielded
when needed.

Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20190802192926.19277-4-nathanl@linux.ibm.com
  • Loading branch information
Nathan Lynch authored and Michael Ellerman committed Aug 20, 2019
1 parent 10e4850 commit ccfb5bd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions arch/powerpc/platforms/pseries/mobility.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <linux/cpu.h>
#include <linux/kernel.h>
#include <linux/kobject.h>
#include <linux/sched.h>
#include <linux/smp.h>
#include <linux/stat.h>
#include <linux/completion.h>
Expand Down Expand Up @@ -207,7 +208,11 @@ static int update_dt_node(__be32 phandle, s32 scope)

prop_data += vd;
}

cond_resched();
}

cond_resched();
} while (rtas_rc == 1);

of_node_put(dn);
Expand Down Expand Up @@ -310,8 +315,12 @@ int pseries_devicetree_update(s32 scope)
add_dt_node(phandle, drc_index);
break;
}

cond_resched();
}
}

cond_resched();
} while (rc == 1);

kfree(rtas_buf);
Expand Down

0 comments on commit ccfb5bd

Please sign in to comment.