* [PATCH]: block_read_full_page: micro optimization
@ 2006-06-24 7:01 Paul Drynoff
2006-06-24 23:48 ` Ray Lee
0 siblings, 1 reply; 2+ messages in thread
From: Paul Drynoff @ 2006-06-24 7:01 UTC (permalink / raw)
To: akpm, viro; +Cc: linux-kernel, linux-fsdevel
I wonder, may be with such change kernel become little faster?
Signed-off-by: Paul Drynoff <pauldrynoff@gmail.com>
---
Index: linux-2.6.17-mm1/fs/buffer.c
===================================================================
--- linux-2.6.17-mm1.orig/fs/buffer.c
+++ linux-2.6.17-mm1/fs/buffer.c
@@ -2093,7 +2093,7 @@ int block_read_full_page(struct page *pa
}
if (!buffer_mapped(bh)) {
void *kaddr = kmap_atomic(page, KM_USER0);
- memset(kaddr + i * blocksize, 0, blocksize);
+ memset(kaddr + (i << inode->i_blkbits), 0, blocksize);
flush_dcache_page(page);
kunmap_atomic(kaddr, KM_USER0);
if (!err)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH]: block_read_full_page: micro optimization
2006-06-24 7:01 [PATCH]: block_read_full_page: micro optimization Paul Drynoff
@ 2006-06-24 23:48 ` Ray Lee
0 siblings, 0 replies; 2+ messages in thread
From: Ray Lee @ 2006-06-24 23:48 UTC (permalink / raw)
To: Paul Drynoff; +Cc: akpm, viro, linux-kernel, linux-fsdevel
On 6/24/06, Paul Drynoff <pauldrynoff@gmail.com> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-06-24 23:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-24 7:01 [PATCH]: block_read_full_page: micro optimization Paul Drynoff
2006-06-24 23:48 ` Ray Lee
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).