mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* __alloc_pages ()
@ 2005-06-20 11:53 Parveen  Verma, Noida
  2005-06-20 13:52 ` Alexander Nyberg
  0 siblings, 1 reply; 3+ messages in thread
From: Parveen  Verma, Noida @ 2005-06-20 11:53 UTC (permalink / raw)
  To: linux-kernel; +Cc: Parveen  Verma, Noida, Shilpi Jaiswal, Noida, linux.guy

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)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: __alloc_pages ()
  2005-06-20 11:53 __alloc_pages () Parveen  Verma, Noida
@ 2005-06-20 13:52 ` Alexander Nyberg
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Nyberg @ 2005-06-20 13:52 UTC (permalink / raw)
  To: Parveen  Verma, Noida; +Cc: linux.guy, Shilpi Jaiswal, Noida, linux-kernel

mån 2005-06-20 klockan 17:23 +0530 skrev Parveen Verma, Noida:
> 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.

I'd say gcc should optimize this out as is already, but now that it
doesn't, if you just make zone_statistics() inline the call will go away
with -O2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: __alloc_pages ()
@ 2005-06-21  5:24 Parveen  Verma, Noida
  0 siblings, 0 replies; 3+ messages in thread
From: Parveen  Verma, Noida @ 2005-06-21  5:24 UTC (permalink / raw)
  To: Alexander Nyberg, Parveen Verma, Noida
  Cc: linux.guy, Shilpi Jaiswal, Noida, linux-kernel

mån 2005-06-20 klockan 17:23 +0530 skrev Parveen Verma, Noida:
> 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.

I'd say gcc should optimize this out as is already, but now that it doesn't,
if you just make zone_statistics() inline the call will go away with -O2

I checked with gcc 4.0.0 in FC4, the gcc optimizes it without making inline
and with -O1 option too.

Now the main point is how can we incorporate this change in main Linux
kernel.

-- 
Praveen Verma
(Hare Rama Hare Krishna)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-06-21  5:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-20 11:53 __alloc_pages () Parveen  Verma, Noida
2005-06-20 13:52 ` Alexander Nyberg
2005-06-21  5:24 Parveen  Verma, Noida

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®