login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
December
»
18
Re: [RFC v11][PATCH 05/13] Dump memory address space
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Oren Laadan
Subject:
Re: [RFC v11][PATCH 05/13] Dump memory address space
Date: Thursday, December 18, 2008 - 1:00 pm
Dave Hansen wrote:
quoted text
> On Thu, 2008-12-18 at 06:10 -0500, Oren Laadan wrote: >>>> + for (i = pgarr->nr_used; i--; /**/) >>>> + page_cache_release(pgarr->pages[i]); >>> This is sorta hard to read (and non-intuitive). Is it easier to do: >>> >>> for (i = 0; i < pgarr->nr_used; i++) >>> page_cache_release(pgarr->pages[i]); >>> >>> It shouldn't matter what order you release the pages in.. >> Was meant to avoid a dereference to 'pgarr->nr_used' in the comparison. >> (though I doubt if the performance impact is at all visible) > > That's a bit to aggressive an optimization. You two piqued my > curiosity, so I tried a little experiment with this .c file: > > extern void bar(int i); > > struct s { > int *array; > int size; > }; > > extern struct s *s; > void foo(void) > { > int i; > #ifdef OREN > for (i = s->size; i--; ) > #else > for (i = 0; i < s->size; i++) > #endif > bar(s->array[i]); > } > > for O in "" -O -O1 -O2 -O3 -Os; do > gcc -DOREN $O -c f1.c -o oren.o; > gcc $O -c f1.c -o mike.o; > echo -n Oren:; objdump -d oren.o | grep ret; > echo -n Mike:; objdump -d mike.o | grep ret; > done
For what it's worth, the idea was to improve time... (not code length). I changed the code anyway (in response to another comment). Oren. --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[RFC v11][PATCH 05/13] Dump memory address space
, Oren Laadan
, (Fri Dec 5, 10:31 am)
Re: [RFC v11][PATCH 05/13] Dump memory address space
, Mike Waychison
, (Wed Dec 17, 7:26 pm)
Re: [RFC v11][PATCH 05/13] Dump memory address space
, Oren Laadan
, (Thu Dec 18, 4:10 am)
Re: [RFC v11][PATCH 05/13] Dump memory address space
, Dave Hansen
, (Thu Dec 18, 8:05 am)
Re: [RFC v11][PATCH 05/13] Dump memory address space
, Dave Hansen
, (Thu Dec 18, 8:54 am)
Re: [RFC v11][PATCH 05/13] Dump memory address space
, Mike Waychison
, (Thu Dec 18, 11:15 am)
Re: [RFC v11][PATCH 05/13] Dump memory address space
, Dave Hansen
, (Thu Dec 18, 11:21 am)
Re: [RFC v11][PATCH 05/13] Dump memory address space
, Oren Laadan
, (Thu Dec 18, 1:00 pm)
Re: [RFC v11][PATCH 05/13] Dump memory address space
, Oren Laadan
, (Thu Dec 18, 1:11 pm)
Navigation
Mailing list archives
Recent posts