All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] io_uring: Try to merge io requests only for regular files
@ 2021-03-19  5:28 Dmitry Monakhov
  2021-03-19  6:36 ` Greg KH
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dmitry Monakhov @ 2021-03-19  5:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, stable, axboe, Dmitry Monakhov

Otherwise we may endup blocking on pipe or socket.

Fixes: 6d5d5ac ("io_uring: extend async work merge")
Testcase: https://github.com/dmonakhov/liburing/commit/16d171b6ef9d68e6db66650a83d98c5c721d01f6
Signed-off-by: Dmitry Monakhov <dmtrmonakhov@yandex-team.ru>
---
 fs/io_uring.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 478df7e..848657c 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2183,6 +2183,9 @@ static int __io_submit_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req,
 static struct async_list *io_async_list_from_req(struct io_ring_ctx *ctx,
 						 struct io_kiocb *req)
 {
+	if (!(req->flags & REQ_F_ISREG))
+		return NULL;
+
 	switch (req->submit.opcode) {
 	case IORING_OP_READV:
 	case IORING_OP_READ_FIXED:
-- 
2.7.4


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

* Re: [PATCH] io_uring: Try to merge io requests only for regular files
  2021-03-19  5:28 [PATCH] io_uring: Try to merge io requests only for regular files Dmitry Monakhov
@ 2021-03-19  6:36 ` Greg KH
  2021-03-19  7:45 ` Dmitry Monakhov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2021-03-19  6:36 UTC (permalink / raw)
  To: Dmitry Monakhov; +Cc: linux-kernel, linux-fsdevel, stable, axboe

On Fri, Mar 19, 2021 at 05:28:59AM +0000, Dmitry Monakhov wrote:
> Otherwise we may endup blocking on pipe or socket.
> 
> Fixes: 6d5d5ac ("io_uring: extend async work merge")
> Testcase: https://github.com/dmonakhov/liburing/commit/16d171b6ef9d68e6db66650a83d98c5c721d01f6
> Signed-off-by: Dmitry Monakhov <dmtrmonakhov@yandex-team.ru>
> ---
>  fs/io_uring.c | 3 +++
>  1 file changed, 3 insertions(+)


<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

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

* Re: [PATCH] io_uring: Try to merge io requests only for regular files
  2021-03-19  5:28 [PATCH] io_uring: Try to merge io requests only for regular files Dmitry Monakhov
  2021-03-19  6:36 ` Greg KH
@ 2021-03-19  7:45 ` Dmitry Monakhov
  2021-03-19 10:23 ` Pavel Begunkov
  2021-03-19 14:06 ` Matthew Wilcox
  3 siblings, 0 replies; 5+ messages in thread
From: Dmitry Monakhov @ 2021-03-19  7:45 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, axboe

[-- Attachment #1: Type: text/plain, Size: 1311 bytes --]

- stable@



19.03.2021, 08:29, "Dmitry Monakhov" <dmtrmonakhov@yandex-team.ru>:
> Otherwise we may endup blocking on pipe or socket.
>
> Fixes: 6d5d5ac ("io_uring: extend async work merge")
> Testcase: https://github.com/dmonakhov/liburing/commit/16d171b6ef9d68e6db66650a83d98c5c721d01f6
> Signed-off-by: Dmitry Monakhov <dmtrmonakhov@yandex-team.ru>
> ---
>  fs/io_uring.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 478df7e..848657c 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -2183,6 +2183,9 @@ static int __io_submit_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req,
>  static struct async_list *io_async_list_from_req(struct io_ring_ctx *ctx,
>                                                   struct io_kiocb *req)
>  {
> + if (!(req->flags & REQ_F_ISREG))
> + return NULL;
> +
IMHO it is reasonable to completely disable  io_should_merge logic because
even with the this fix it still affected by latency spikes like follows:

->submit_read: req1[slow_hdd, sector=z]
->submit_read: req2[nvme, sector=X]
-> wait(req2)  -> fast

->submit_read: req3[nvme, sector=Y] 
--> wait(req3)  ->slow  
  if completes if X and Y belongs to same page merge logic will wait for req1 to complete




[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-io_uring-completely-disable-io_should_merge-logic.patch --]
[-- Type: text/x-diff; name="0001-io_uring-completely-disable-io_should_merge-logic.patch", Size: 780 bytes --]

From c24cda9aa902775e4e23575b758f009e9fae4640 Mon Sep 17 00:00:00 2001
From: Dmitry Monakhov <dmtrmonakhov@yandex-team.ru>
Date: Fri, 19 Mar 2021 08:48:18 +0300
Subject: [PATCH] io_uring: completely disable io_should_merge logic

io_should_merge logic is wierd and prone to latency spikes because of slow neighbors.

Signed-off-by: Dmitry Monakhov <dmtrmonakhov@yandex-team.ru>

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 478df7e..a4fb3a7 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1288,7 +1288,7 @@ static ssize_t io_import_iovec(struct io_ring_ctx *ctx, int rw,
 
 static inline bool io_should_merge(struct async_list *al, struct kiocb *kiocb)
 {
-	if (al->file == kiocb->ki_filp) {
+	if (al->file == kiocb->ki_filp && 0) {
 		off_t start, end;
 
 		/*
-- 
2.7.4


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

* Re: [PATCH] io_uring: Try to merge io requests only for regular files
  2021-03-19  5:28 [PATCH] io_uring: Try to merge io requests only for regular files Dmitry Monakhov
  2021-03-19  6:36 ` Greg KH
  2021-03-19  7:45 ` Dmitry Monakhov
@ 2021-03-19 10:23 ` Pavel Begunkov
  2021-03-19 14:06 ` Matthew Wilcox
  3 siblings, 0 replies; 5+ messages in thread
From: Pavel Begunkov @ 2021-03-19 10:23 UTC (permalink / raw)
  To: Dmitry Monakhov, linux-kernel; +Cc: linux-fsdevel, stable, axboe, io-uring

On 19/03/2021 05:28, Dmitry Monakhov wrote:
> Otherwise we may endup blocking on pipe or socket.

CC: io-uring ml

> 
> Fixes: 6d5d5ac ("io_uring: extend async work merge")
> Testcase: https://github.com/dmonakhov/liburing/commit/16d171b6ef9d68e6db66650a83d98c5c721d01f6
> Signed-off-by: Dmitry Monakhov <dmtrmonakhov@yandex-team.ru>
> ---
>  fs/io_uring.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 478df7e..848657c 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -2183,6 +2183,9 @@ static int __io_submit_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req,
>  static struct async_list *io_async_list_from_req(struct io_ring_ctx *ctx,
>  						 struct io_kiocb *req)
>  {
> +	if (!(req->flags & REQ_F_ISREG))
> +		return NULL;
> +
>  	switch (req->submit.opcode) {
>  	case IORING_OP_READV:
>  	case IORING_OP_READ_FIXED:
> 

-- 
Pavel Begunkov

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

* Re: [PATCH] io_uring: Try to merge io requests only for regular files
  2021-03-19  5:28 [PATCH] io_uring: Try to merge io requests only for regular files Dmitry Monakhov
                   ` (2 preceding siblings ...)
  2021-03-19 10:23 ` Pavel Begunkov
@ 2021-03-19 14:06 ` Matthew Wilcox
  3 siblings, 0 replies; 5+ messages in thread
From: Matthew Wilcox @ 2021-03-19 14:06 UTC (permalink / raw)
  To: Dmitry Monakhov; +Cc: linux-kernel, linux-fsdevel, stable, axboe

On Fri, Mar 19, 2021 at 05:28:59AM +0000, Dmitry Monakhov wrote:
> Otherwise we may endup blocking on pipe or socket.
> 
> Fixes: 6d5d5ac ("io_uring: extend async work merge")

7 bytes of sha1 isn't enough.  You can set core.abbrev to 12 or upgrade
to a version of git from this decade to get that automatically.

> 2.7.4

... is from 2016, so you're five years out of date.  Don't get cut
off when git switches from SHA1.

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

end of thread, other threads:[~2021-03-19 14:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-19  5:28 [PATCH] io_uring: Try to merge io requests only for regular files Dmitry Monakhov
2021-03-19  6:36 ` Greg KH
2021-03-19  7:45 ` Dmitry Monakhov
2021-03-19 10:23 ` Pavel Begunkov
2021-03-19 14:06 ` Matthew Wilcox

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.