Re: [PATCH]: block_read_full_page: micro optimization

From: Ray Lee
Date: Sat Jun 24 2006 - 19:47:05 EST


On 6/24/06, Paul Drynoff <pauldrynoff@xxxxxxxxx> wrote:
I wonder, may be with such change kernel become little faster?
- memset(kaddr + i * blocksize, 0, blocksize);
+ memset(kaddr + (i << inode->i_blkbits), 0, blocksize);

It's likely slower with this change, as you now require the CPU to
load inode->i_blkbits which, chances are, isn't hanging around handily
in a register like blocksize obviously is. So, you've increased
register pressure and added more fetches from memory instead of just
doing a simple (and cheap) multiplication. Not good.

Check the generated code for both cases. Smaller is usually better.
Benchmarking would be best, however, code changes that cause cache
misses or register pressure can be hard to measure well.

Ray
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/