All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] stat/options patches
@ 2019-02-19 21:44 vincentfu
  2019-02-19 21:44 ` [PATCH 1/2] stat: use long doubles to identify latency percentiles vincentfu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vincentfu @ 2019-02-19 21:44 UTC (permalink / raw)
  To: axboe, fio; +Cc: Vincent Fu

From: Vincent Fu <vincent.fu@wdc.com>

Jens, please consider these two patches that address a couple issues
that we have encountered. Thanks.

Vincent

Vincent Fu (2):
  stat: use long doubles to identify latency percentiles
  options: catch division by zero in setting CPU affinity

 options.c | 3 +++
 stat.c    | 5 ++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

-- 
2.17.1



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] stat: use long doubles to identify latency percentiles
  2019-02-19 21:44 [PATCH 0/2] stat/options patches vincentfu
@ 2019-02-19 21:44 ` vincentfu
  2019-02-19 21:44 ` [PATCH 2/2] options: catch division by zero in setting CPU affinity vincentfu
  2019-02-21 17:55 ` [PATCH 0/2] stat/options patches Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: vincentfu @ 2019-02-19 21:44 UTC (permalink / raw)
  To: axboe, fio; +Cc: Vincent Fu

From: Vincent Fu <vincent.fu@wdc.com>

In some cases, the 100th percentile latency is not correctly identified
because of problems with double precision floating point arithmetic.
Use long doubles instead in the while loop condition to reduce the
likelihood of encountering this problem.

Also, print an error message when latency percentiles are not
successfully identified.
---
 stat.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/stat.c b/stat.c
index c1f46e1d..66a13bca 100644
--- a/stat.c
+++ b/stat.c
@@ -170,7 +170,7 @@ unsigned int calc_clat_percentiles(uint64_t *io_u_plat, unsigned long long nr,
 	is_last = false;
 	for (i = 0; i < FIO_IO_U_PLAT_NR && !is_last; i++) {
 		sum += io_u_plat[i];
-		while (sum >= (plist[j].u.f / 100.0 * nr)) {
+		while (sum >= ((long double) plist[j].u.f / 100.0 * nr)) {
 			assert(plist[j].u.f <= 100.0);
 
 			ovals[j] = plat_idx_to_val(i);
@@ -187,6 +187,9 @@ unsigned int calc_clat_percentiles(uint64_t *io_u_plat, unsigned long long nr,
 		}
 	}
 
+	if (!is_last)
+		log_err("fio: error calculating latency percentiles\n");
+
 	*output = ovals;
 	return len;
 }
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] options: catch division by zero in setting CPU affinity
  2019-02-19 21:44 [PATCH 0/2] stat/options patches vincentfu
  2019-02-19 21:44 ` [PATCH 1/2] stat: use long doubles to identify latency percentiles vincentfu
@ 2019-02-19 21:44 ` vincentfu
  2019-02-21 17:55 ` [PATCH 0/2] stat/options patches Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: vincentfu @ 2019-02-19 21:44 UTC (permalink / raw)
  To: axboe, fio; +Cc: Vincent Fu

From: Vincent Fu <vincent.fu@wdc.com>

Catch a division by zero and abort with a helpful message instead of a
signal 8 floating point error.
---
 options.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/options.c b/options.c
index 6d832354..95086074 100644
--- a/options.c
+++ b/options.c
@@ -493,6 +493,9 @@ int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
 	const long max_cpu = cpus_online();
 
 	cpus_in_mask = fio_cpu_count(mask);
+	if (!cpus_in_mask)
+		return 0;
+
 	cpu_index = cpu_index % cpus_in_mask;
 
 	index = 0;
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] stat/options patches
  2019-02-19 21:44 [PATCH 0/2] stat/options patches vincentfu
  2019-02-19 21:44 ` [PATCH 1/2] stat: use long doubles to identify latency percentiles vincentfu
  2019-02-19 21:44 ` [PATCH 2/2] options: catch division by zero in setting CPU affinity vincentfu
@ 2019-02-21 17:55 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2019-02-21 17:55 UTC (permalink / raw)
  To: vincentfu, fio; +Cc: Vincent Fu

On 2/19/19 2:44 PM, vincentfu@gmail.com wrote:
> From: Vincent Fu <vincent.fu@wdc.com>
> 
> Jens, please consider these two patches that address a couple issues
> that we have encountered. Thanks.

Applied, thanks Vincent.

-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-21 17:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-19 21:44 [PATCH 0/2] stat/options patches vincentfu
2019-02-19 21:44 ` [PATCH 1/2] stat: use long doubles to identify latency percentiles vincentfu
2019-02-19 21:44 ` [PATCH 2/2] options: catch division by zero in setting CPU affinity vincentfu
2019-02-21 17:55 ` [PATCH 0/2] stat/options patches Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.