lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <69df5d1e-0fce-41ae-a0e8-ee2da7c109c6@yukuai.org.cn>
Date: Sat, 30 Aug 2025 12:22:20 +0800
From: Yu Kuai <hailan@...uai.org.cn>
To: Damien Le Moal <dlemoal@...nel.org>, Yu Kuai <yukuai1@...weicloud.com>,
 axboe@...nel.dk, tj@...nel.org, josef@...icpanda.com, song@...nel.org,
 neil@...wn.name, akpm@...ux-foundation.org, hch@...radead.org,
 colyli@...nel.org, hare@...e.de, tieren@...as.com
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
 cgroups@...r.kernel.org, linux-raid@...r.kernel.org, yukuai3@...wei.com,
 yi.zhang@...wei.com, yangerkun@...wei.com, johnny.chenyi@...wei.com
Subject: Re: [PATCH RFC v2 08/10] block: skip unnecessary checks for split bio

Hi,

在 2025/8/30 8:58, Damien Le Moal 写道:
> On 8/28/25 15:57, Yu Kuai wrote:
>> From: Yu Kuai <yukuai3@...wei.com>
>>
>> Lots of checks are already done while submitting this bio the first
>> time, and there is no need to check them again when this bio is
>> resubmitted after split.
>>
>> Hence factor out a helper submit_split_bio_noacct() for resubmitting
>> bio after splitting, only should_fail_bio() and blk_throtl_bio() are
>> keeped.
> s/keeped/kept
>
>> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
>> ---
>>   block/blk-core.c  | 15 +++++++++++++++
>>   block/blk-merge.c |  2 +-
>>   block/blk.h       |  1 +
>>   3 files changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/block/blk-core.c b/block/blk-core.c
>> index 4201504158a1..37836446f365 100644
>> --- a/block/blk-core.c
>> +++ b/block/blk-core.c
>> @@ -765,6 +765,21 @@ static blk_status_t blk_validate_atomic_write_op_size(struct request_queue *q,
>>   	return BLK_STS_OK;
>>   }
>>   
>> +void submit_split_bio_noacct(struct bio *bio)
>> +{
>> +	might_sleep();
>> +
>> +	if (should_fail_bio(bio)) {
>> +		bio_io_error(bio);
>> +		return;
>> +	}
>> +
>> +	if (blk_throtl_bio(bio))
>> +		return;
>> +
>> +	submit_bio_noacct_nocheck(bio);
>> +}
>> +
>>   /**
>>    * submit_bio_noacct - re-submit a bio to the block device layer for I/O
>>    * @bio:  The bio describing the location in memory and on the device.
>> diff --git a/block/blk-merge.c b/block/blk-merge.c
>> index 3d6dc9cc4f61..fa2c3d98b277 100644
>> --- a/block/blk-merge.c
>> +++ b/block/blk-merge.c
>> @@ -131,7 +131,7 @@ struct bio *bio_submit_split_bioset(struct bio *bio, int split_sectors,
>>   	bio_chain(split, bio);
>>   	trace_block_split(split, bio->bi_iter.bi_sector);
>>   	WARN_ON_ONCE(bio_zone_write_plugging(bio));
>> -	submit_bio_noacct(bio);
>> +	submit_split_bio_noacct(bio);
> If this helper is used only here, I would just open-code it here as otherwise it
> is confusing: its name has "split" in it but nothing of its code checks that the
> BIO was actually split.

I agree and I actually tried this first, the problem I met is that should_fail_bio()
is defined internal at blk-core.c, perhaps I'll add comment about this function?

Thanks,
Kuai

>>   
>>   	return split;
>>   }
>> diff --git a/block/blk.h b/block/blk.h
>> index 46f566f9b126..80375374ef55 100644
>> --- a/block/blk.h
>> +++ b/block/blk.h
>> @@ -54,6 +54,7 @@ bool blk_queue_start_drain(struct request_queue *q);
>>   bool __blk_freeze_queue_start(struct request_queue *q,
>>   			      struct task_struct *owner);
>>   int __bio_queue_enter(struct request_queue *q, struct bio *bio);
>> +void submit_split_bio_noacct(struct bio *bio);
>>   void submit_bio_noacct_nocheck(struct bio *bio);
>>   void bio_await_chain(struct bio *bio);
>>   
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ