From: Christoph Hellwig <hch@infradead.org>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: Mike Snitzer <msnitzer@redhat.com>,
Damien Le Moal <dlemoal@kernel.org>,
Guangwu Zhang <guazhang@redhat.com>,
dm-devel@lists.linux.dev, Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] dm-io: don't warn if flush takes too long time
Date: Wed, 17 Apr 2024 07:50:54 -0700 [thread overview]
Message-ID: <Zh_hzvgnY-VbkdO5@infradead.org> (raw)
In-Reply-To: <754d1973-31cb-d3ca-1f6f-2d35b96364db@redhat.com>
> --- linux-2.6.orig/include/linux/completion.h 2024-04-15 15:54:22.000000000 +0200
> +++ linux-2.6/include/linux/completion.h 2024-04-15 15:57:14.000000000 +0200
> @@ -10,6 +10,7 @@
> */
>
> #include <linux/swait.h>
> +#include <linux/sched/sysctl.h>
If you're touching completion.h you need to CC lkml and the people
who wrote/maintain it even if we don't have a proper maintainer.
I don't think adding yet another include into it is a good idea.
As is this whole hack here. Pleas just add the proper TASK_STATE for
task that can legitimately sleep for very long times instead of
extending this hack again and again, just like I told Kent when he messed with the timeout.
>
> /*
> * struct completion - structure used to maintain state for a "completion"
> @@ -119,4 +120,20 @@ extern void complete(struct completion *
> extern void complete_on_current_cpu(struct completion *x);
> extern void complete_all(struct completion *);
>
> +/**
> + * wait_for_completion_long_io - this is like wait_for_completion_io,
> + * but it doesn't warn if the wait takes too long.
> + */
> +static inline void wait_for_completion_long_io(struct completion *done)
> +{
> + /* Prevent hang_check timer from firing at us during very long I/O */
> + unsigned long timeout = sysctl_hung_task_timeout_secs * HZ / 2;
> +
> + if (timeout)
> + while (!wait_for_completion_io_timeout(done, timeout))
> + ;
> + else
> + wait_for_completion_io(done);
> +}
> +
> #endif
> Index: linux-2.6/block/bio.c
> ===================================================================
> --- linux-2.6.orig/block/bio.c 2024-03-30 20:07:03.000000000 +0100
> +++ linux-2.6/block/bio.c 2024-04-15 15:55:13.000000000 +0200
> @@ -1378,7 +1378,7 @@ int submit_bio_wait(struct bio *bio)
> bio->bi_end_io = submit_bio_wait_endio;
> bio->bi_opf |= REQ_SYNC;
> submit_bio(bio);
> - blk_wait_io(&done);
> + wait_for_completion_long_io(&done);
>
> return blk_status_to_errno(bio->bi_status);
> }
> Index: linux-2.6/block/blk-mq.c
> ===================================================================
> --- linux-2.6.orig/block/blk-mq.c 2024-03-30 20:07:03.000000000 +0100
> +++ linux-2.6/block/blk-mq.c 2024-04-15 15:55:05.000000000 +0200
> @@ -1407,7 +1407,7 @@ blk_status_t blk_execute_rq(struct reque
> if (blk_rq_is_poll(rq))
> blk_rq_poll_completion(rq, &wait.done);
> else
> - blk_wait_io(&wait.done);
> + wait_for_completion_long_io(&wait.done);
>
> return wait.ret;
> }
>
>
---end quoted text---
parent reply other threads:[~2024-04-17 14:50 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <754d1973-31cb-d3ca-1f6f-2d35b96364db@redhat.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zh_hzvgnY-VbkdO5@infradead.org \
--to=hch@infradead.org \
--cc=axboe@kernel.dk \
--cc=dlemoal@kernel.org \
--cc=dm-devel@lists.linux.dev \
--cc=guazhang@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=msnitzer@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®