Re: [PATCH] fix sparse warning from include/linux/mmzone.h

2008-02-13 Thread Harvey Harrison
Maybe I'm beating a dead horse, but here's what I came up with: include/linux/mmzone.h:640:22: warning: potentially expensive pointer subtraction Using arch/x86/mm/highmem_32.o as an example, line 82, PageHighMem expands to is_highmem. if (!PageHighMem(page)) return page

Re: [PATCH] fix sparse warning from include/linux/mmzone.h

2008-02-08 Thread Harvey Harrison
include/linux/mmzone.h:640:22: warning: potentially expensive pointer subtraction Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]> --- Linus, something like the following? include/linux/mmzone.h |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/linux/mmzon

Re: [PATCH] fix sparse warning from include/linux/mmzone.h

2008-02-08 Thread Linus Torvalds
On Fri, 8 Feb 2008, Linus Torvalds wrote: > > It would probably make more sense to just write it as something like > > struct zone *base = zone->zone_pgdat->node_zones; > > if (zone == base + ZONE_HIGHMEM || > (zone == base + ZONE_MOVABLE && zone_movable_is_highmem())

Re: [PATCH] fix sparse warning from include/linux/mmzone.h

2008-02-08 Thread Ingo Molnar
* Linus Torvalds <[EMAIL PROTECTED]> wrote: > Heh, yeah. That's a very odd way to write it. > > It would probably make more sense to just write it as something like > > struct zone *base = zone->zone_pgdat->node_zones; > > if (zone == base + ZONE_HIGHMEM || > (zone ==

Re: [PATCH] fix sparse warning from include/linux/mmzone.h

2008-02-08 Thread Harvey Harrison
On Fri, 2008-02-08 at 14:04 -0800, Linus Torvalds wrote: > > On Fri, 8 Feb 2008, Andrew Morton wrote: > > > #ifdef CONFIG_HIGHMEM > > > - int zone_idx = zone - zone->zone_pgdat->node_zones; > > > - return zone_idx == ZONE_HIGHMEM || > > > - (zone_idx == ZONE_MOVABLE && zone_movable_is_hig

Re: [PATCH] fix sparse warning from include/linux/mmzone.h

2008-02-08 Thread Linus Torvalds
On Fri, 8 Feb 2008, Andrew Morton wrote: > > #ifdef CONFIG_HIGHMEM > > - int zone_idx = zone - zone->zone_pgdat->node_zones; > > - return zone_idx == ZONE_HIGHMEM || > > - (zone_idx == ZONE_MOVABLE && zone_movable_is_highmem()); > > + const int highmem_off = ZONE_HIGHMEM * sizeof

Re: [PATCH] fix sparse warning from include/linux/mmzone.h

2008-02-08 Thread Andrew Morton
On Thu, 07 Feb 2008 12:52:23 -0800 Harvey Harrison <[EMAIL PROTECTED]> wrote: > include/linux/mmzone.h:640:22: warning: potentially expensive pointer > subtraction > > The code in question was doing a pointer subtraction to find the index of > the zone argument in the node_zones array. This ess

[PATCH] fix sparse warning from include/linux/mmzone.h

2008-02-07 Thread Harvey Harrison
include/linux/mmzone.h:640:22: warning: potentially expensive pointer subtraction The code in question was doing a pointer subtraction to find the index of the zone argument in the node_zones array. This essentially boils down to: ((unsigned long)zone - (unsigned long)zone->zone_pgdat->node_zo