From: Jens Axboe <axboe@kernel.dk>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: Re: [PATCH 4/4] block: update cached timestamp post schedule/preemption
Date: Mon, 29 Jan 2024 07:08:52 -0700 [thread overview]
Message-ID: <ca969732-5d80-458c-b2dc-b5e65629e64b@kernel.dk> (raw)
In-Reply-To: <c2cad14a-6add-4301-83b1-be40e48c0daf@wdc.com>
On 1/29/24 7:06 AM, Johannes Thumshirn wrote:
> On 29.01.24 15:02, Jens Axboe wrote:
>> On 1/29/24 1:01 AM, Johannes Thumshirn wrote:
>>> On 26.01.24 22:39, Jens Axboe wrote:
>>>> static void sched_update_worker(struct task_struct *tsk)
>>>> {
>>>> - if (tsk->flags & (PF_WQ_WORKER | PF_IO_WORKER)) {
>>>> + if (tsk->flags & (PF_WQ_WORKER | PF_IO_WORKER | PF_BLOCK_TS)) {
>>>> + if (tsk->flags & PF_BLOCK_TS)
>>>> + blk_plug_invalidate_ts(tsk);
>>>> if (tsk->flags & PF_WQ_WORKER)
>>>> wq_worker_running(tsk);
>>>> - else
>>>> + else if (tsk->flags & PF_IO_WORKER)
>>>> io_wq_worker_running(tsk);
>>>> }
>>>> }
>>>
>>>
>>> Why the nested if? Isn't that more readable:
>>
>> It's so that we can keep it at a single branch for the fast case of none
>> of them being true, which is also how it was done before this change.
>> This one just adds one more flag to check. With your change, it's 3
>> branches instead of one for the fast case.
>>
>
> Although I don't really have hard feelings for it, that could be solved
> as well:
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 9116bcc90346..74beb0126da6 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -6787,12 +6787,12 @@ static inline void sched_submit_work(struct
> task_struct *tsk)
>
> static void sched_update_worker(struct task_struct *tsk)
> {
> - if (tsk->flags & (PF_WQ_WORKER | PF_IO_WORKER)) {
> - if (tsk->flags & PF_WQ_WORKER)
> - wq_worker_running(tsk);
> - else
> - io_wq_worker_running(tsk);
> - }
> + if (tsk->flags & !(PF_WQ_WORKER | PF_IO_WORKER | PF_BLOCK_TS))
> + return;
Don't think that'd work :-)
> + if (tsk->flags & PF_BLOCK_TS)
> + blk_plug_invalidate_ts(tsk);
> + if (tsk->flags & PF_WQ_WORKER)
> + wq_worker_running(tsk);
> + else if (tsk->flags & PF_IO_WORKER)
> + io_wq_worker_running(tsk);
> }
>
> But yep, that's bikeshedding I admit
But agree, it'd accomplish the same. The patch is cleaner just keeping
the existing setup, however, rather than rewrite it like the above.
--
Jens Axboe
prev parent reply other threads:[~2024-01-29 14:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-26 21:30 [PATCHSET v5 0/4] Cache issue side time querying Jens Axboe
2024-01-26 21:30 ` [PATCH 1/4] block: move cgroup time handling code into blk.h Jens Axboe
2024-01-29 14:08 ` Johannes Thumshirn
2024-01-26 21:30 ` [PATCH 2/4] block: add blk_time_get_ns() and blk_time_get() helpers Jens Axboe
2024-01-26 21:30 ` [PATCH 3/4] block: cache current nsec time in struct blk_plug Jens Axboe
2024-01-26 21:30 ` [PATCH 4/4] block: update cached timestamp post schedule/preemption Jens Axboe
2024-01-29 8:01 ` Johannes Thumshirn
2024-01-29 14:02 ` Jens Axboe
2024-01-29 14:06 ` Johannes Thumshirn
2024-01-29 14:08 ` Jens Axboe [this message]
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=ca969732-5d80-458c-b2dc-b5e65629e64b@kernel.dk \
--to=axboe@kernel.dk \
--cc=Johannes.Thumshirn@wdc.com \
--cc=linux-block@vger.kernel.org \
/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