Skip to content

Commit

Permalink
ntb_perf: Schedule based on time not on performance
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Dave Jiang <[email protected]>
Signed-off-by: Jon Mason <[email protected]>
  • Loading branch information
lsgunth authored and jonmason committed Aug 5, 2016
1 parent 19645a0 commit fd2ecd8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/ntb/test/ntb_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ static int perf_move_data(struct pthr_ctx *pctx, char __iomem *dst, char *src,
char __iomem *tmp = dst;
u64 perf, diff_us;
ktime_t kstart, kstop, kdiff;
unsigned long last_sleep = jiffies;

chunks = div64_u64(win_size, buf_size);
total_chunks = div64_u64(total, buf_size);
Expand All @@ -288,8 +289,9 @@ static int perf_move_data(struct pthr_ctx *pctx, char __iomem *dst, char *src,
} else
tmp += buf_size;

/* Probably should schedule every 4GB to prevent soft hang. */
if (((copied % SZ_4G) == 0) && !use_dma) {
/* Probably should schedule every 5s to prevent soft hang. */
if (unlikely((jiffies - last_sleep) > 5 * HZ)) {
last_sleep = jiffies;
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1);
}
Expand Down

0 comments on commit fd2ecd8

Please sign in to comment.