__alloc_pages ()

From: Parveen Verma, Noida
Date: Mon Jun 20 2005 - 06:58:03 EST


Hi,

I have found that while allocating (mostly it is done) the pages in
__alloc_pages(), after successfully allocating the page the
zone_statistics() function is called.

static void zone_statistics(struct zonelist *zonelist, struct zone *z)
{
#ifdef CONFIG_NUMA
.....
#endif
}
The whole body of this function is enclosed b/w #ifdef ... #endif.
This function is called each time and does nothing if we don't have a NUMA
machine.
Can we put the call for this b/w #ifdef ... #endif?
Although the gcc -O3 option does not generate a function call if the
function body is nil.

The patch for the same is given below:

diff -Nru linux-2.6.11.11.orig/mm/page_alloc.c
linux-2.6.11.11/mm/page_alloc.c
--- linux-2.6.11.11.orig/mm/page_alloc.c 2005-05-27
01:06:46.000000000 -0400
+++ linux-2.6.11.11/mm/page_alloc.c 2005-06-20 17:07:41.000000000 -0400
@@ -851,7 +851,9 @@
}
return NULL;
got_pg:
+#ifdef CONFIG_NUMA
zone_statistics(zonelist, z);
+#endif
return page;
}


Further, I have not removed the #ifdef ... #endif from zone_statistics() as
in future some other function might call this function, but in present
kernel no one calls this.

Comments are invited..

--
Praveen Verma
(Hare Rama Hare Krishna)
-
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/