X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=backend.c;h=89ffee1277f5ad47f733b56e9bf5c86ad9b39fc8;hp=1c4484be951e8ea437ff9cb91fa7a01818b24bb5;hb=a0bafb7d88c33b9046073e0bc4af7d64d0caa30b;hpb=4e0a8fa2593006505b7f4e18931a201d221b49e9 diff --git a/backend.c b/backend.c index 1c4484be..89ffee12 100644 --- a/backend.c +++ b/backend.c @@ -910,6 +910,15 @@ static int init_io_u(struct thread_data *td) if ((td->io_ops->flags & FIO_NOIO) || !(td_read(td) || td_write(td))) data_xfer = 0; + /* + * if we may later need to do address alignment, then add any + * possible adjustment here so that we don't cause a buffer + * overflow later. this adjustment may be too much if we get + * lucky and the allocator gives us an aligned address. + */ + if (td->o.odirect || td->o.mem_align || (td->io_ops->flags & FIO_RAWIO)) + td->orig_buffer_size += page_mask + td->o.mem_align; + if (td->o.mem_type == MEM_SHMHUGE || td->o.mem_type == MEM_MMAPHUGE) { unsigned long bs; @@ -1549,6 +1558,12 @@ reaped: fio_terminate_threads(TERMINATE_ALL); } +static void do_usleep(unsigned int usecs) +{ + check_for_running_stats(); + usleep(usecs); +} + /* * Main function for kicking off and reaping jobs, as needed. */ @@ -1727,7 +1742,7 @@ static void run_threads(void) if (mtime_since_now(&this_start) > JOB_START_TIMEOUT) break; - usleep(100000); + do_usleep(100000); for (i = 0; i < this_jobs; i++) { td = map[i]; @@ -1779,12 +1794,12 @@ static void run_threads(void) reap_threads(&nr_running, &t_rate, &m_rate); if (todo) - usleep(100000); + do_usleep(100000); } while (nr_running) { reap_threads(&nr_running, &t_rate, &m_rate); - usleep(10000); + do_usleep(10000); } fio_idle_prof_stop(); @@ -1880,6 +1895,7 @@ int fio_backend(void) return 1; set_genesis_time(); + stat_init(); create_disk_util_thread(); cgroup_list = smalloc(sizeof(*cgroup_list)); @@ -1909,5 +1925,6 @@ int fio_backend(void) fio_mutex_remove(startup_mutex); fio_mutex_remove(writeout_mutex); fio_mutex_remove(disk_thread_mutex); + stat_exit(); return exit_value; }