Re: [PATCH] block: Minimize the number of requests in Direct I/O when bio get pages.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi Christoph Hellwig:

>queue_max_bytes is a limit only available to the
>splitting routines and not to the upper layers submitting I/O.

keep  “bio->bi_iter.bi_size % request_max_size = 0” if possible ,it
better for he final number of requests to be processed.

>Please try to debug your scenarious a little more - just because a bio
>get split off it should not just turn into a request of it's own,
>but be merged with the next bio due to the plug.  If that doesn't happen
>we do have a problem somewhere.

without patch,the request can not merge with the next bio.

for example:
first bio size is 2088 * 512 , split by 1024+1024+40,address
138577200,138578224,138579248
second bio size is 2064 * 512, split by 1024+1024+16,address
138579288,138580312,138581336
They are continuous. However, when decomposing requests in bio,
try to split the maximum request as much as possible,
resulting in the first request of the second bio being the maximum request size,
 so it cannot be merged with the last request of the first bio.
Therefore, two additional requests need to be consumed.

This is the trace without patch.
request 1.3 do not merged with request 2.1,beacause request 2.1 is
full.And also can not merged with request2.3.
        Thread-6-11566   [007] .....  1982.474122:
f2fs_direct_IO_enter: dev = (254,48), ino = 6366 pos = 0 len =
33554432 ki_flags = 20000 ki_ioprio = 4004 rw = 0
        Thread-6-11566   [007] .....  1982.474843: block_bio_queue:
254,48 R 123268400 + 2088 [Thread-6]
        Thread-6-11566   [007] .....  1982.474854: block_bio_remap:
8,0 R 123268400 + 2088 <- (254,48) 123268400
        Thread-6-11566   [007] .....  1982.474854: block_bio_remap:
8,0 R 138577200 + 2088 <- (259,55) 123268400
        Thread-6-11566   [007] .....  1982.474855: block_bio_queue:
8,0 R 138577200 + 2088 [Thread-6]                 <<<<first bio
        Thread-6-11566   [007] .....  1982.474863: block_split: 8,0 R
138577200 / 138578224 [Thread-6]
        Thread-6-11566   [007] .....  1982.474869: block_getrq: 8,0 R
138577200 + 1024 [Thread-6]
        Thread-6-11566   [007] .....  1982.474876: block_split: 8,0 R
138578224 / 138579248 [Thread-6]
        Thread-6-11566   [007] .....  1982.474878: block_getrq: 8,0 R
138578224 + 1024 [Thread-6]
        Thread-6-11566   [007] ...1.  1982.474881: block_rq_insert:
8,0 R 524288 () 138577200 + 1024 [Thread-6]       <<<<<request1.1
        Thread-6-11566   [007] .....  1982.474897: block_rq_issue: 8,0
R 524288 () 138577200 + 1024 [Thread-6]
        Thread-6-11566   [007] .....  1982.477396: block_getrq: 8,0 R
138579248 + 40 [Thread-6]
        Thread-6-11566   [007] ...1.  1982.477400: block_rq_insert:
8,0 R 524288 () 138578224 + 1024 [Thread-6]       <<<<<request1.2
        Thread-6-11566   [007] .....  1982.477409: block_rq_issue: 8,0
R 524288 () 138578224 + 1024 [Thread-6]
        Thread-6-11566   [007] .....  1982.477515: block_bio_queue:
254,48 R 123270488 + 2064 [Thread-6]
        Thread-6-11566   [007] .....  1982.477520: block_bio_remap:
8,0 R 123270488 + 2064 <- (254,48) 123270488
        Thread-6-11566   [007] .....  1982.477521: block_bio_remap:
8,0 R 138579288 + 2064 <- (259,55) 123270488
        Thread-6-11566   [007] .....  1982.477522: block_bio_queue:
8,0 R 138579288 + 2064 [Thread-6]                 <<<<second bio
        Thread-6-11566   [007] .....  1982.477528: block_split: 8,0 R
138579288 / 138580312 [Thread-6]
        Thread-6-11566   [007] .....  1982.477530: block_getrq: 8,0 R
138579288 + 1024 [Thread-6]
        Thread-6-11566   [007] .....  1982.477534: block_split: 8,0 R
138580312 / 138581336 [Thread-6]
        Thread-6-11566   [007] .....  1982.477536: block_getrq: 8,0 R
138580312 + 1024 [Thread-6]
        Thread-6-11566   [007] ...1.  1982.477538: block_rq_insert:
8,0 R 20480 () 138579248 + 40 [Thread-6]          <<<<<request1.3
        Thread-6-11566   [007] ...1.  1982.477538: block_rq_insert:
8,0 R 524288 () 138579288 + 1024 [Thread-6]       <<<<<request2.1
        Thread-6-11566   [007] .....  1982.477545: block_rq_issue: 8,0
R 20480 () 138579248 + 40 [Thread-6]
        Thread-6-11566   [007] .....  1982.477557: block_rq_issue: 8,0
R 524288 () 138579288 + 1024 [Thread-6]
        Thread-6-11566   [007] .....  1982.477596: block_getrq: 8,0 R
138581336 + 16 [Thread-6]
        Thread-6-11566   [007] ...1.  1982.477597: block_rq_insert:
8,0 R 524288 () 138580312 + 1024 [Thread-6]       <<<<<request2.2
        Thread-6-11566   [007] .....  1982.477604: block_rq_issue: 8,0
R 524288 () 138580312 + 1024 [Thread-6]
        Thread-6-11566   [007] .....  1982.477703: block_bio_queue:
254,48 R 123272552 + 2072 [Thread-6]
        Thread-6-11566   [007] .....  1982.477707: block_bio_remap:
8,0 R 123272552 + 2072 <- (254,48) 123272552
        Thread-6-11566   [007] .....  1982.477707: block_bio_remap:
8,0 R 138581352 + 2072 <- (259,55) 123272552
        Thread-6-11566   [007] .....  1982.477708: block_bio_queue:
8,0 R 138581352 + 2072 [Thread-6]
        Thread-6-11566   [007] .....  1982.477713: block_split: 8,0 R
138581352 / 138582376 [Thread-6]
        Thread-6-11566   [007] .....  1982.477715: block_getrq: 8,0 R
138581352 + 1024 [Thread-6]
        Thread-6-11566   [007] .....  1982.477719: block_split: 8,0 R
138582376 / 138583400 [Thread-6]
        Thread-6-11566   [007] .....  1982.477721: block_getrq: 8,0 R
138582376 + 1024 [Thread-6]
        Thread-6-11566   [007] ...1.  1982.477722: block_rq_insert:
8,0 R 8192 () 138581336 + 16 [Thread-6]           <<<<request2.3
        Thread-6-11566   [007] ...1.  1982.477723: block_rq_insert:
8,0 R 524288 () 138581352 + 1024 [Thread-6]
        Thread-6-11566   [007] .....  1982.477728: block_rq_issue: 8,0
R 8192 () 138581336 + 16 [Thread-6]
        Thread-6-11566   [007] .....  1982.477740: block_rq_issue: 8,0
R 524288 () 138581352 + 1024 [Thread-6]
        Thread-6-11566   [007] .....  1982.477778: block_getrq: 8,0 R
138583400 + 24 [Thread-6]
        Thread-6-11566   [007] ...1.  1982.477779: block_rq_insert:
8,0 R 524288 () 138582376 + 1024 [Thread-6]
        Thread-6-11566   [007] .....  1982.477784: block_rq_issue: 8,0
R 524288 () 138582376 + 1024 [Thread-6]
        Thread-6-11566   [007] .....  1982.477886: block_bio_queue:
254,48 R 123274624 + 2056 [Thread-6]
        Thread-6-11566   [007] .....  1982.477889: block_bio_remap:
8,0 R 123274624 + 2056 <- (254,48) 123274624

....
        Thread-6-11566   [007] ..s..  1982.478899: block_rq_complete:
8,0 R () 138579248 + 40 [0]                        <<<<request1.3
finish
.....
        Thread-6-11566   [007] ..s..  1982.478995: block_rq_complete:
8,0 R () 138577200 + 1024 [0]                       <<<<request 1.1
finish
...
        Thread-6-11566   [007] ..s..  1982.479603: block_rq_complete:
8,0 R () 138578224 + 1024 [0]                    <<<<<request1.2
finish
        Thread-6-11566   [007] ..s..  1982.479824: block_rq_complete:
8,0 R () 138581336 + 16 [0]       <<<<request 2.3 finish
....
....
        Thread-6-11566   [007] ..s..  1982.480173: block_rq_complete:
8,0 R () 138579288 + 1024 [0]     <<<<request 2.1 finish
....
        Thread-6-11566   [007] ..s..  1982.480739: block_rq_complete:
8,0 R () 138580312 + 1024 [0]     <<<<request 2.2 finish

Christoph Hellwig <hch@xxxxxxxxxxxxx> 于2024年3月14日周四 05:49写道:
>
> > +             request_max_size = queue_max_bytes(bdev_get_queue(bio->bi_bdev));
>
> Besides all the coding style problems this is simply not how the bio
> interface works.  queue_max_bytes is a limit only available to the
> splitting routines and not to the upper layers submitting I/O.
>
> Please try to debug your scenarious a little more - just because a bio
> get split off it should not just turn into a request of it's own,
> but be merged with the next bio due to the plug.  If that doesn't happen
> we do have a problem somewhere.
>





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux