linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: Fix default IO priority if there is no IO context
@ 2025-07-31  4:49 Guenter Roeck
  2025-07-31  5:22 ` Damien Le Moal
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Guenter Roeck @ 2025-07-31  4:49 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, linux-kernel, Guenter Roeck, Bart Van Assche

Upstream commit 53889bcaf536 ("block: make __get_task_ioprio() easier to
read") changes the IO priority returned to the caller if no IO context
is defined for the task. Prior to this commit, the returned IO priority
was determined by task_nice_ioclass() and task_nice_ioprio(). Now it is
always IOPRIO_DEFAULT, which translates to IOPRIO_CLASS_NONE with priority
0. However, task_nice_ioclass() returns IOPRIO_CLASS_IDLE, IOPRIO_CLASS_RT,
or IOPRIO_CLASS_BE depending on the task scheduling policy, and
task_nice_ioprio() returns a value determined by task_nice(). This causes
regressions in test code checking the IO priority and class of IO
operations on tasks with no IO context.

Fix the problem by returning the IO priority calculated from
task_nice_ioclass() and task_nice_ioprio() if no IO context is defined
to match earlier behavior.

Fixes: 53889bcaf536 ("block: make __get_task_ioprio() easier to read")
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 include/linux/ioprio.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
index b25377b6ea98..5210e8371238 100644
--- a/include/linux/ioprio.h
+++ b/include/linux/ioprio.h
@@ -60,7 +60,8 @@ static inline int __get_task_ioprio(struct task_struct *p)
 	int prio;
 
 	if (!ioc)
-		return IOPRIO_DEFAULT;
+		return IOPRIO_PRIO_VALUE(task_nice_ioclass(p),
+					 task_nice_ioprio(p));
 
 	if (p != current)
 		lockdep_assert_held(&p->alloc_lock);
-- 
2.45.2


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

* Re: [PATCH] block: Fix default IO priority if there is no IO context
  2025-07-31  4:49 [PATCH] block: Fix default IO priority if there is no IO context Guenter Roeck
@ 2025-07-31  5:22 ` Damien Le Moal
  2025-07-31  7:05 ` Yu Kuai
  2025-07-31 21:02 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Damien Le Moal @ 2025-07-31  5:22 UTC (permalink / raw)
  To: Guenter Roeck, Jens Axboe; +Cc: linux-block, linux-kernel, Bart Van Assche

On 7/31/25 1:49 PM, Guenter Roeck wrote:
> Upstream commit 53889bcaf536 ("block: make __get_task_ioprio() easier to
> read") changes the IO priority returned to the caller if no IO context
> is defined for the task. Prior to this commit, the returned IO priority
> was determined by task_nice_ioclass() and task_nice_ioprio(). Now it is
> always IOPRIO_DEFAULT, which translates to IOPRIO_CLASS_NONE with priority
> 0. However, task_nice_ioclass() returns IOPRIO_CLASS_IDLE, IOPRIO_CLASS_RT,
> or IOPRIO_CLASS_BE depending on the task scheduling policy, and
> task_nice_ioprio() returns a value determined by task_nice(). This causes
> regressions in test code checking the IO priority and class of IO
> operations on tasks with no IO context.
> 
> Fix the problem by returning the IO priority calculated from
> task_nice_ioclass() and task_nice_ioprio() if no IO context is defined
> to match earlier behavior.
> 
> Fixes: 53889bcaf536 ("block: make __get_task_ioprio() easier to read")
> Cc: Jens Axboe <axboe@kernel.dk>
> Cc: Bart Van Assche <bvanassche@acm.org>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Looks good to me.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>


-- 
Damien Le Moal
Western Digital Research

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

* Re: [PATCH] block: Fix default IO priority if there is no IO context
  2025-07-31  4:49 [PATCH] block: Fix default IO priority if there is no IO context Guenter Roeck
  2025-07-31  5:22 ` Damien Le Moal
@ 2025-07-31  7:05 ` Yu Kuai
  2025-07-31 21:02 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Yu Kuai @ 2025-07-31  7:05 UTC (permalink / raw)
  To: Guenter Roeck, Jens Axboe
  Cc: linux-block, linux-kernel, Bart Van Assche, yukuai (C)

在 2025/07/31 12:49, Guenter Roeck 写道:
> Upstream commit 53889bcaf536 ("block: make __get_task_ioprio() easier to
> read") changes the IO priority returned to the caller if no IO context
> is defined for the task. Prior to this commit, the returned IO priority
> was determined by task_nice_ioclass() and task_nice_ioprio(). Now it is
> always IOPRIO_DEFAULT, which translates to IOPRIO_CLASS_NONE with priority
> 0. However, task_nice_ioclass() returns IOPRIO_CLASS_IDLE, IOPRIO_CLASS_RT,
> or IOPRIO_CLASS_BE depending on the task scheduling policy, and
> task_nice_ioprio() returns a value determined by task_nice(). This causes
> regressions in test code checking the IO priority and class of IO
> operations on tasks with no IO context.
> 
> Fix the problem by returning the IO priority calculated from
> task_nice_ioclass() and task_nice_ioprio() if no IO context is defined
> to match earlier behavior.
> 
> Fixes: 53889bcaf536 ("block: make __get_task_ioprio() easier to read")
> Cc: Jens Axboe <axboe@kernel.dk>
> Cc: Bart Van Assche <bvanassche@acm.org>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>   include/linux/ioprio.h | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
LGTM
Reviewed-by: Yu Kuai <yukuai3@huawei.com>

Thanks


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

* Re: [PATCH] block: Fix default IO priority if there is no IO context
  2025-07-31  4:49 [PATCH] block: Fix default IO priority if there is no IO context Guenter Roeck
  2025-07-31  5:22 ` Damien Le Moal
  2025-07-31  7:05 ` Yu Kuai
@ 2025-07-31 21:02 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2025-07-31 21:02 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-block, linux-kernel, Bart Van Assche


On Wed, 30 Jul 2025 21:49:53 -0700, Guenter Roeck wrote:
> Upstream commit 53889bcaf536 ("block: make __get_task_ioprio() easier to
> read") changes the IO priority returned to the caller if no IO context
> is defined for the task. Prior to this commit, the returned IO priority
> was determined by task_nice_ioclass() and task_nice_ioprio(). Now it is
> always IOPRIO_DEFAULT, which translates to IOPRIO_CLASS_NONE with priority
> 0. However, task_nice_ioclass() returns IOPRIO_CLASS_IDLE, IOPRIO_CLASS_RT,
> or IOPRIO_CLASS_BE depending on the task scheduling policy, and
> task_nice_ioprio() returns a value determined by task_nice(). This causes
> regressions in test code checking the IO priority and class of IO
> operations on tasks with no IO context.
> 
> [...]

Applied, thanks!

[1/1] block: Fix default IO priority if there is no IO context
      commit: e2ba58ccc9099514380c3300cbc0750b5055fc1c

Best regards,
-- 
Jens Axboe




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

end of thread, other threads:[~2025-07-31 21:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-31  4:49 [PATCH] block: Fix default IO priority if there is no IO context Guenter Roeck
2025-07-31  5:22 ` Damien Le Moal
2025-07-31  7:05 ` Yu Kuai
2025-07-31 21:02 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).