From: Eric Nelson <eric@nelint.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC V2 PATCH 0/3] Add cache for block devices
Date: Mon, 21 Mar 2016 10:56:07 -0700 [thread overview]
Message-ID: <56F035B7.6090408@nelint.com> (raw)
In-Reply-To: <56F02617.6010700@denx.de>
Hi Marek,
On 03/21/2016 09:49 AM, Marek Vasut wrote:
> On 03/21/2016 02:48 PM, Eric Nelson wrote:
>> On 03/20/2016 06:59 PM, Marek Vasut wrote:
>>> On 03/21/2016 02:45 AM, Eric Nelson wrote:
>>>> Here's a more full-featured implementation of a cache for block
>>>> devices that uses a small linked list of cache blocks.
>>>
>>> Why do you use linked list ? You have four entries, you can as well
>>> use fixed array. Maybe you should implement an adaptive cache would
>>> would use the unpopulated malloc area and hash the sector number(s)
>>> into that area ?
>>>
>>
>> I was looking for a simple implementation that would allow tweaking of
>> the max entries/size per entry.
>>
>> We could get higher performance through hashing, but with such a
>> small cache, it's probably not worth extra code.
>
> The hashing function can be a simple modulo on sector number ;-) That'd
> be less code than linked lists.
>
I'm not seeing how.
I'm going look first at a better way to integrate than the approach
taken in patch 3.
>> Using an array and re-allocating on changes to the max entries variable
>> is feasible, but I think it would be slightly more code.
>
> That would indeed be more code.
>
>>>> Experimentation loading a 4.5 MiB kernel from the root directory of
>>>> a FAT filesystem shows that a single cache entry of a single
>>>> block is the only
>>>
>>> only ... what ? This is where things started to be interesting, but
>>> you leave us hanging :)
>>>
>>
>> Oops.
>>
>> ... I was planning on re-wording that.
>>
>> My testing showed no gain in performance (additional cache hits) past a
>> single entry of a single block. This was done on a small (32MiB)
>> partition with a small number of files (~10) and only a single
>> read is skipped.
>
> I'd kinda expect that indeed.
>
Yeah, and the single-digit-ms improvement isn't worth much.
>> => blkc c ; blkc i ; blkc 0 0 ;
>> changed to max of 0 entries of 0 blocks each
>> => load mmc 0 10008000 /zImage
>> reading /zImage
>> 4955304 bytes read in 247 ms (19.1 MiB/s)
>> => blkc
>> block cache:
>> 0 hits
>> 7 misses
>> 0 entries in cache
>> trace off
>> max blocks/entry 0
>> max entries 0
>> => blkc c ; blkc i ; blkc 1 1 ;
>> changed to max of 1 entries of 1 blocks each
>> => load mmc 0 10008000 /zImage
>> reading /zImage
>> 4955304 bytes read in 243 ms (19.4 MiB/s)
>> => blkc
>> block cache:
>> 1 hits
>> 6 misses
>> 1 entries in cache
>> trace off
>> max blocks/entry 1
>> max entries 1
>>
>> I don't believe that enabling the cache is worth the extra code
>> for this use case.
>>
>> By comparison, a load of 150 MiB compressed disk image from
>> ext4 showed a 30x speedup with the V1 patch (single block,
>> single entry) from ~150s to 5s.
>>
>> Without some form of cache, the 150s was long enough to make
>> a user (me) think something is broken.
>
> I'm obviously loving this improvement.
>
Glad to hear it.
next prev parent reply other threads:[~2016-03-21 17:56 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-21 1:45 [U-Boot] [RFC V2 PATCH 0/3] Add cache for block devices Eric Nelson
2016-03-21 1:45 ` [U-Boot] [RFC V2 PATCH 1/3] drivers: block: add block device cache Eric Nelson
2016-03-21 17:59 ` Eric Nelson
2016-03-23 17:22 ` Stephen Warren
2016-03-23 17:43 ` Eric Nelson
2016-03-21 1:45 ` [U-Boot] [RFC V2 PATCH 2/3] block: add Kconfig options for [CMD_]BLOCK_CACHE Eric Nelson
2016-03-23 17:24 ` Stephen Warren
2016-03-23 17:45 ` Eric Nelson
2016-03-21 1:45 ` [U-Boot] [RFC V2 PATCH 3/3] mmc: add support for block device cache Eric Nelson
2016-03-23 17:27 ` Stephen Warren
2016-03-23 17:46 ` Eric Nelson
2016-03-21 1:59 ` [U-Boot] [RFC V2 PATCH 0/3] Add cache for block devices Marek Vasut
2016-03-21 13:48 ` Eric Nelson
2016-03-21 16:49 ` Marek Vasut
2016-03-21 17:56 ` Eric Nelson [this message]
2016-03-21 18:54 ` Marek Vasut
2016-03-27 19:00 ` [U-Boot] [PATCH " Eric Nelson
2016-03-27 19:00 ` [U-Boot] [PATCH 1/3] drivers: block: add block device cache Eric Nelson
2016-03-28 14:16 ` Tom Rini
2016-03-28 14:33 ` Eric Nelson
2016-03-28 16:24 ` [U-Boot] [PATCH V2 " Eric Nelson
2016-03-28 17:05 ` [U-Boot] [PATCH V3 " Eric Nelson
2016-03-30 14:36 ` Stephen Warren
2016-03-30 15:19 ` Tom Rini
2016-03-30 15:21 ` Stephen Warren
2016-03-30 17:37 ` Eric Nelson
2016-03-30 17:34 ` Eric Nelson
2016-03-30 21:57 ` Stephen Warren
2016-03-31 20:24 ` Eric Nelson
2016-04-01 22:57 ` Stephen Warren
2016-04-01 23:16 ` Eric Nelson
2016-04-01 23:41 ` Tom Rini
2016-04-02 14:17 ` Eric Nelson
2016-04-02 2:07 ` Stephen Warren
2016-04-02 14:24 ` Eric Nelson
2016-04-02 1:59 ` [U-Boot] [U-Boot, V3, " Tom Rini
2016-04-02 14:19 ` Eric Nelson
2016-04-02 14:37 ` [U-Boot] [PATCH 0/3] minor blkcache updates Eric Nelson
2016-04-02 14:37 ` [U-Boot] [PATCH 1/3] cmd: blkcache: remove indentation from output of 'show' Eric Nelson
2016-04-12 2:28 ` [U-Boot] [U-Boot, " Tom Rini
2016-04-02 14:37 ` [U-Boot] [PATCH 2/3] cmd: blkcache: simplify sub-command handling Eric Nelson
2016-04-04 17:39 ` Stephen Warren
2016-04-12 2:28 ` [U-Boot] [U-Boot, " Tom Rini
2016-04-02 14:37 ` [U-Boot] [PATCH 3/3] drivers: block: fix placement of parameters Eric Nelson
2016-04-12 2:29 ` [U-Boot] [U-Boot, " Tom Rini
2016-03-27 19:00 ` [U-Boot] [PATCH 2/3] mmc: use block layer in mmc command Eric Nelson
2016-03-28 14:16 ` Tom Rini
2016-04-02 1:58 ` [U-Boot] [U-Boot,2/3] " Tom Rini
2016-03-27 19:00 ` [U-Boot] [PATCH 3/3] sata: use block layer for sata command Eric Nelson
2016-03-28 14:16 ` Tom Rini
2016-04-02 1:59 ` [U-Boot] [U-Boot,3/3] " Tom Rini
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=56F035B7.6090408@nelint.com \
--to=eric@nelint.com \
--cc=u-boot@lists.denx.de \
/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