[dm-devel] dm-cache mq policy warmup issue

Mears, Morgan Morgan.Mears at netapp.com
Wed Nov 13 16:13:43 UTC 2013


On Mon, Nov 04, 2013 at 12:22:26PM -0500, Krishnasamy, Somasundaram wrote:
> Mike,
> 
> I was doing some testing with latest dm-cache code (from 'for-next' branch). I
> am having difficulty in making the cache to warm-up. I used the below script
> to read range of blocks repeatedly to get them promoted. I assume after
> reading a block for mq->promote_threshold + 4 times, a block will be
> promoted. But it is not happening. I also tested the same with the
> sequential_threshold set to very high value.
> 
> Cache warming-up was relatively easier in the previous dm-cache code. Is this
> something you have seen in your testing?. Is there anything different should I
> do?

I'm also testing with the for-next branch of linux-dm.git and seeing the
same thing as Somu.  It's easy to reproduce; reading the same block on the
cached device over and over with dd does not result in that block being
promoted.

I did notice that the "read miss" counter for the cached device increments
each time I execute dd, which I believe means this isn't a buffer cache
issue (I also used dd iflag=direct).  The migration_threshold value
shouldn't be an issue for this test, but I set it to a very high value
anyway; didn't make any difference.

Are there any tests in device-mapper-test-suite that you would recommend
for testing whether promotions are occurring as expected?

--Morgan

> Note: /dev/mapper/mydev is the dm-cache target device. I ran the below
> script with "64k 100 100 0" as argument.
> -----------
> #!/bin/bash
> 
> if [[ $# -lt 4 ]]
> then
>         echo "Usage: $0 <cache_block_size> <nblocks to promote> <nread of a
> block> <start_block>"
>         exit 1
> fi
> 
> BSSIZE=$1
> ((TOTAL=$2+$4))
> HITCNT=$3
> 
> # Read even numbered blocks
> blkcnt=$4
> while [[ blkcnt -lt $TOTAL ]]
> do
>         i=0
>         echo "Reading block $blkcnt $HITCNT times"
>         while [[ $i -lt $HITCNT ]]
>         do
>                 dd if=/dev/mapper/mydev of=/dev/null bs=$BSSIZE skip=$blkcnt
> count=1 conv=notrunc iflag=direct 2> /dev/null
>                 if [[ $? -ne 0 ]]
>                then
>                         echo "I/O failure. exiting."
>                         exit 1
>                 fi
>                 ((i=i+1))
>         done
> 
>         ((blkcnt=blkcnt+2))
> 
>         PROMOTED=$(dmsetup status mydev | awk '{print $11}')
>         echo "Promoted blocks so far: $PROMOTED"
> done
> 
> # Read odd numbered blocks
> ((blkcnt=$4+1))
> while [[ blkcnt -lt $TOTAL ]]
> do
>         i=0
>         echo "Reading block $blkcnt $HITCNT times"
>         while [[ $i -lt $HITCNT ]]
>         do
>                 dd if=/dev/mapper/mydev of=/dev/null bs=$BSSIZE skip=$blkcnt
> count=1 conv=notrunc iflag=direct 2> /dev/null
>                 if [[ $? -ne 0 ]]
>                 then
>                         echo "I/O failure. exiting."
>                         exit 1
>                 fi
>                 ((i=i+1))
>         done
> 
>         ((blkcnt=blkcnt+2))
> 
>         PROMOTED=$(dmsetup status mydev | awk '{print $11}')
>         echo "Promoted blocks so far: $PROMOTED"
> done
> ------------
> 
> Regards,
> Somu.





More information about the dm-devel mailing list