From: Tejun Heo <tj@kernel.org>
To: Yi Sun <yi.sun@unisoc.com>
Cc: sunyibuaa@gmail.com, jiangshanlai@gmail.com, jaegeuk@kernel.org,
chao@kernel.org, ebiggers@google.com,
linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, kent.overstreet@linux.dev,
niuzhiguo84@gmail.com, Hao_hao.Wang@unisoc.com,
yunlongxing23@gmail.com
Subject: Re: [PATCH v2 1/2] workqueue: new struct io_work
Date: Mon, 1 Jul 2024 07:32:23 -1000 [thread overview]
Message-ID: <ZoLoJ-uBo9qyAlMg@slm.duckdns.org> (raw)
In-Reply-To: <20240701075138.1144575-2-yi.sun@unisoc.com>
Hello,
On Mon, Jul 01, 2024 at 03:51:37PM +0800, Yi Sun wrote:
> +/*
> + * If a work may do disk IO, it is recommended to use struct io_work
> + * instead of struct work_struct.
> + */
> +struct io_work {
> + struct work_struct work;
> +
> + /* If the work does submit_bio, io priority may be needed. */
> + unsigned short ioprio;
> + /* Record kworker's original io priority. */
> + unsigned short ori_ioprio;
> + /* Whether the work has set io priority? */
> + long ioprio_flag;
> +};
There are fundamental limitations to this approach in terms of
prioritization. If you tag each work items with priority and then send them
to the same workqueue, there's nothing preventing a low priority issuer from
flooding the workqueue and causing a priority inversion. ie. To solve this
properly, you need per-issuer-class workqueue so that the concurrency limit
is not shared across different priorities.
Now, this limited implementation, while incomplete and easy to defeat, may
still be useful. After all, ioprio itself, I think, is flawed in the same
way. If f2fs wants to implement this internally, that's okay, I suppose, but
as a generic mechanism, I don't think this makes a lot of sense.
Thanks.
--
tejun
next prev parent reply other threads:[~2024-07-01 17:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-01 7:51 [PATCH v2 0/2] new struct io_work and use it in f2fs fsverity work Yi Sun
2024-07-01 7:51 ` [PATCH v2 1/2] workqueue: new struct io_work Yi Sun
2024-07-01 17:32 ` Tejun Heo [this message]
2024-07-02 3:53 ` Kent Overstreet
2024-07-02 9:27 ` yi sun
2024-07-02 16:40 ` Tejun Heo
2024-07-02 16:45 ` Kent Overstreet
2024-07-02 3:40 ` kernel test robot
2024-07-02 21:51 ` kernel test robot
2024-07-01 7:51 ` [PATCH v2 2/2] f2fs: set io priority for fsverity work Yi Sun
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=ZoLoJ-uBo9qyAlMg@slm.duckdns.org \
--to=tj@kernel.org \
--cc=Hao_hao.Wang@unisoc.com \
--cc=chao@kernel.org \
--cc=ebiggers@google.com \
--cc=jaegeuk@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=kent.overstreet@linux.dev \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=niuzhiguo84@gmail.com \
--cc=sunyibuaa@gmail.com \
--cc=yi.sun@unisoc.com \
--cc=yunlongxing23@gmail.com \
/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®