diff options
author | Logan Gunthorpe <logang@deltatee.com> | 2016-06-20 15:15:04 -0400 |
---|---|---|
committer | Jon Mason <jdmason@kudzu.us> | 2016-08-05 10:21:06 -0400 |
commit | fd2ecd885bab8e456298d0b702806ea736456c62 (patch) | |
tree | 705a3ba20eba4662738fbc94e25a818ab4942783 | |
parent | 19645a077120c6417e9dc5ad469c45194cf78a82 (diff) |
ntb_perf: Schedule based on time not on performance
When debugging performance problems, if some issue causes the ntb
hardware to be significantly slower than expected, ntb_perf will
hang requiring a reboot because it only schedules once every 4GB.
Instead, schedule based on jiffies so it will not hang the CPU if
the transfer is slow.
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Acked-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
-rw-r--r-- | drivers/ntb/test/ntb_perf.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c index 4368519da102..5008ccf600a9 100644 --- a/drivers/ntb/test/ntb_perf.c +++ b/drivers/ntb/test/ntb_perf.c | |||
@@ -273,6 +273,7 @@ static int perf_move_data(struct pthr_ctx *pctx, char __iomem *dst, char *src, | |||
273 | char __iomem *tmp = dst; | 273 | char __iomem *tmp = dst; |
274 | u64 perf, diff_us; | 274 | u64 perf, diff_us; |
275 | ktime_t kstart, kstop, kdiff; | 275 | ktime_t kstart, kstop, kdiff; |
276 | unsigned long last_sleep = jiffies; | ||
276 | 277 | ||
277 | chunks = div64_u64(win_size, buf_size); | 278 | chunks = div64_u64(win_size, buf_size); |
278 | total_chunks = div64_u64(total, buf_size); | 279 | total_chunks = div64_u64(total, buf_size); |
@@ -288,8 +289,9 @@ static int perf_move_data(struct pthr_ctx *pctx, char __iomem *dst, char *src, | |||
288 | } else | 289 | } else |
289 | tmp += buf_size; | 290 | tmp += buf_size; |
290 | 291 | ||
291 | /* Probably should schedule every 4GB to prevent soft hang. */ | 292 | /* Probably should schedule every 5s to prevent soft hang. */ |
292 | if (((copied % SZ_4G) == 0) && !use_dma) { | 293 | if (unlikely((jiffies - last_sleep) > 5 * HZ)) { |
294 | last_sleep = jiffies; | ||
293 | set_current_state(TASK_INTERRUPTIBLE); | 295 | set_current_state(TASK_INTERRUPTIBLE); |
294 | schedule_timeout(1); | 296 | schedule_timeout(1); |
295 | } | 297 | } |