Linux block layer
 help / color / mirror / Atom feed
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:02:10 -0700	[thread overview]
Message-ID: <1b0c9f7f-9b1b-484b-a9fb-bf2c42d9a18d@kernel.dk> (raw)
In-Reply-To: <9e13afd4-d073-4822-92ff-936788f0c2a1@wdc.com>

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.

-- 
Jens Axboe


  reply	other threads:[~2024-01-29 14:02 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 [this message]
2024-01-29 14:06       ` Johannes Thumshirn
2024-01-29 14:08         ` Jens Axboe

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=1b0c9f7f-9b1b-484b-a9fb-bf2c42d9a18d@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