linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH mmotm] Fix NUMA accounting in numastat.txt
@ 2009-09-01  4:53 Minchan Kim
  2009-09-01  7:17 ` KAMEZAWA Hiroyuki
  0 siblings, 1 reply; 5+ messages in thread
From: Minchan Kim @ 2009-09-01  4:53 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, lkml, KAMEZAWA Hiroyuki, KOSAKI Motohiro


In Documentation/numastat.txt, it confused me.
For example, there are nodes [0,1] in system.

barrios:~$ cat /proc/zoneinfo | egrep 'numa|zone'
Node 0, zone	DMA
	numa_hit	33226
	numa_miss	1739
	numa_foreign	27978
	..
	..
Node 1, zone	DMA
	numa_hit	307
	numa_miss	46900
	numa_foreign	0

1) In node 0,  NUMA_MISS means it wanted to allocate page
in node 1 but ended up with page in node 0

2) In node 0, NUMA_FOREIGN means it wanted to allocate page
in node 0 but ended up with page from Node 1.

But now, numastat explains it oppositely about (MISS, FOREIGN).
Let's fix up with viewpoint of zone. 

Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
---
 Documentation/numastat.txt |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/numastat.txt b/Documentation/numastat.txt
index 80133ac..9fcc9a6 100644
--- a/Documentation/numastat.txt
+++ b/Documentation/numastat.txt
@@ -7,10 +7,10 @@ All units are pages. Hugepages have separate counters.

 numa_hit			A process wanted to allocate memory from this node,
 					and succeeded.
-numa_miss			A process wanted to allocate memory from this node,
-					but ended up with memory from another.
-numa_foreign		A process wanted to allocate on another node,
-				    but ended up with memory from this one.
+numa_miss			A process wanted to allocate memory from another node,
+					but ended up with memory from this node.
+numa_foreign		A process wanted to allocate on this node,
+				    but ended up with memory from another one.
 local_node			A process ran on this node and got memory from it.
 other_node			A process ran on this node and got memory from another node.
 interleave_hit 		Interleaving wanted to allocate from this node
--
1.5.4.3



-- 
Kind regards,
Minchan Kim

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH mmotm] Fix NUMA accounting in numastat.txt
  2009-09-01  4:53 [PATCH mmotm] Fix NUMA accounting in numastat.txt Minchan Kim
@ 2009-09-01  7:17 ` KAMEZAWA Hiroyuki
  2009-09-01  7:24   ` Minchan Kim
  0 siblings, 1 reply; 5+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-09-01  7:17 UTC (permalink / raw)
  To: Minchan Kim; +Cc: Andrew Morton, linux-mm, lkml, KOSAKI Motohiro

On Tue, 1 Sep 2009 13:53:21 +0900
Minchan Kim <minchan.kim@gmail.com> wrote:

> 
> In Documentation/numastat.txt, it confused me.
> For example, there are nodes [0,1] in system.
> 
> barrios:~$ cat /proc/zoneinfo | egrep 'numa|zone'
> Node 0, zone	DMA
> 	numa_hit	33226
> 	numa_miss	1739
> 	numa_foreign	27978
> 	..
> 	..
> Node 1, zone	DMA
> 	numa_hit	307
> 	numa_miss	46900
> 	numa_foreign	0
> 
> 1) In node 0,  NUMA_MISS means it wanted to allocate page
> in node 1 but ended up with page in node 0
> 
> 2) In node 0, NUMA_FOREIGN means it wanted to allocate page
> in node 0 but ended up with page from Node 1.
> 
> But now, numastat explains it oppositely about (MISS, FOREIGN).
> Let's fix up with viewpoint of zone. 
> 

I'm confused....documentation is really bad ?
Implementation isn't ?

Hmm, this function ?
==
void zone_statistics(struct zone *preferred_zone, struct zone *z)
{
        if (z->zone_pgdat == preferred_zone->zone_pgdat) {
                __inc_zone_state(z, NUMA_HIT);
        } else {
                __inc_zone_state(z, NUMA_MISS);
                __inc_zone_state(preferred_zone, NUMA_FOREIGN);
        }
        if (z->node == numa_node_id())
                __inc_zone_state(z, NUMA_LOCAL);
        else
                __inc_zone_state(z, NUMA_OTHER);
}
==
I wonder
==
void zone_statistics(struct zone *preferred_zone, struct zone *z)
{
        if (z->zone_pgdat == preferred_zone->zone_pgdat) {
                __inc_zone_state(z, NUMA_HIT);
        } else {
                __inc_zone_state(preferred_zone, NUMA_MISS);
                __inc_zone_state(z, NUMA_FOREIGN);
        }
        if (z->node == numa_node_id())
                __inc_zone_state(z, NUMA_LOCAL);
        else
                __inc_zone_state(z, NUMA_OTHER);
}
==
Is correct fix ....

Thanks,
-Kame


> Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
> ---
>  Documentation/numastat.txt |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/numastat.txt b/Documentation/numastat.txt
> index 80133ac..9fcc9a6 100644
> --- a/Documentation/numastat.txt
> +++ b/Documentation/numastat.txt
> @@ -7,10 +7,10 @@ All units are pages. Hugepages have separate counters.
> 
>  numa_hit			A process wanted to allocate memory from this node,
>  					and succeeded.
> -numa_miss			A process wanted to allocate memory from this node,
> -					but ended up with memory from another.
> -numa_foreign		A process wanted to allocate on another node,
> -				    but ended up with memory from this one.
> +numa_miss			A process wanted to allocate memory from another node,
> +					but ended up with memory from this node.
> +numa_foreign		A process wanted to allocate on this node,
> +				    but ended up with memory from another one.
>  local_node			A process ran on this node and got memory from it.
>  other_node			A process ran on this node and got memory from another node.
>  interleave_hit 		Interleaving wanted to allocate from this node
> --
> 1.5.4.3
> 
> 
> 
> -- 
> Kind regards,
> Minchan Kim
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH mmotm] Fix NUMA accounting in numastat.txt
  2009-09-01  7:17 ` KAMEZAWA Hiroyuki
@ 2009-09-01  7:24   ` Minchan Kim
  2009-09-01  7:29     ` KAMEZAWA Hiroyuki
  0 siblings, 1 reply; 5+ messages in thread
From: Minchan Kim @ 2009-09-01  7:24 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: Minchan Kim, Andrew Morton, linux-mm, lkml, KOSAKI Motohiro

Hi, Kame.

On Tue, 1 Sep 2009 16:17:21 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:

> On Tue, 1 Sep 2009 13:53:21 +0900
> Minchan Kim <minchan.kim@gmail.com> wrote:
> 
> > 
> > In Documentation/numastat.txt, it confused me.
> > For example, there are nodes [0,1] in system.
> > 
> > barrios:~$ cat /proc/zoneinfo | egrep 'numa|zone'
> > Node 0, zone	DMA
> > 	numa_hit	33226
> > 	numa_miss	1739
> > 	numa_foreign	27978
> > 	..
> > 	..
> > Node 1, zone	DMA
> > 	numa_hit	307
> > 	numa_miss	46900
> > 	numa_foreign	0
> > 
> > 1) In node 0,  NUMA_MISS means it wanted to allocate page
> > in node 1 but ended up with page in node 0
> > 
> > 2) In node 0, NUMA_FOREIGN means it wanted to allocate page
> > in node 0 but ended up with page from Node 1.
> > 
> > But now, numastat explains it oppositely about (MISS, FOREIGN).
> > Let's fix up with viewpoint of zone. 
> > 
> 
> I'm confused....documentation is really bad ?
> Implementation isn't ?

At that time, I though of it. 
But I knew code is right since zone_stat_item said follwing as. 
NUMA_MISS is rather unclear but NUMA_FOREIGN is clear, I think.

        NUMA_MISS,              /* allocated in non intended node */
        NUMA_FOREIGN,           /* was intended here, hit elsewhere */

Also I am worry about legacy tools related to NUMA but I don't know it.
Code change will break them.

> Hmm, this function ?
> ==
> void zone_statistics(struct zone *preferred_zone, struct zone *z)
> {
>         if (z->zone_pgdat == preferred_zone->zone_pgdat) {
>                 __inc_zone_state(z, NUMA_HIT);
>         } else {
>                 __inc_zone_state(z, NUMA_MISS);
>                 __inc_zone_state(preferred_zone, NUMA_FOREIGN);
>         }
>         if (z->node == numa_node_id())
>                 __inc_zone_state(z, NUMA_LOCAL);
>         else
>                 __inc_zone_state(z, NUMA_OTHER);
> }
> ==
> I wonder
> ==
> void zone_statistics(struct zone *preferred_zone, struct zone *z)
> {
>         if (z->zone_pgdat == preferred_zone->zone_pgdat) {
>                 __inc_zone_state(z, NUMA_HIT);
>         } else {
>                 __inc_zone_state(preferred_zone, NUMA_MISS);
>                 __inc_zone_state(z, NUMA_FOREIGN);
>         }
>         if (z->node == numa_node_id())
>                 __inc_zone_state(z, NUMA_LOCAL);
>         else
>                 __inc_zone_state(z, NUMA_OTHER);
> }
> ==
> Is correct fix ....
> 
> Thanks,
> -Kame
> 
> 
> > Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
> > ---
> >  Documentation/numastat.txt |    8 ++++----
> >  1 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/Documentation/numastat.txt b/Documentation/numastat.txt
> > index 80133ac..9fcc9a6 100644
> > --- a/Documentation/numastat.txt
> > +++ b/Documentation/numastat.txt
> > @@ -7,10 +7,10 @@ All units are pages. Hugepages have separate counters.
> > 
> >  numa_hit			A process wanted to allocate memory from this node,
> >  					and succeeded.
> > -numa_miss			A process wanted to allocate memory from this node,
> > -					but ended up with memory from another.
> > -numa_foreign		A process wanted to allocate on another node,
> > -				    but ended up with memory from this one.
> > +numa_miss			A process wanted to allocate memory from another node,
> > +					but ended up with memory from this node.
> > +numa_foreign		A process wanted to allocate on this node,
> > +				    but ended up with memory from another one.
> >  local_node			A process ran on this node and got memory from it.
> >  other_node			A process ran on this node and got memory from another node.
> >  interleave_hit 		Interleaving wanted to allocate from this node
> > --
> > 1.5.4.3
> > 
> > 
> > 
> > -- 
> > Kind regards,
> > Minchan Kim
> > 
> > --
> > To unsubscribe, send a message with 'unsubscribe linux-mm' in
> > the body to majordomo@kvack.org.  For more info on Linux MM,
> > see: http://www.linux-mm.org/ .
> > Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
> > 
> 


-- 
Kind regards,
Minchan Kim

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH mmotm] Fix NUMA accounting in numastat.txt
  2009-09-01  7:24   ` Minchan Kim
@ 2009-09-01  7:29     ` KAMEZAWA Hiroyuki
  2009-09-01 18:18       ` Christoph Lameter
  0 siblings, 1 reply; 5+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-09-01  7:29 UTC (permalink / raw)
  To: Minchan Kim; +Cc: Andrew Morton, linux-mm, lkml, KOSAKI Motohiro, cl

On Tue, 1 Sep 2009 16:24:19 +0900
Minchan Kim <minchan.kim@gmail.com> wrote:

> Hi, Kame.
> 
> On Tue, 1 Sep 2009 16:17:21 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> 
> > On Tue, 1 Sep 2009 13:53:21 +0900
> > Minchan Kim <minchan.kim@gmail.com> wrote:
> > 
> > > 
> > > In Documentation/numastat.txt, it confused me.
> > > For example, there are nodes [0,1] in system.
> > > 
> > > barrios:~$ cat /proc/zoneinfo | egrep 'numa|zone'
> > > Node 0, zone	DMA
> > > 	numa_hit	33226
> > > 	numa_miss	1739
> > > 	numa_foreign	27978
> > > 	..
> > > 	..
> > > Node 1, zone	DMA
> > > 	numa_hit	307
> > > 	numa_miss	46900
> > > 	numa_foreign	0
> > > 
> > > 1) In node 0,  NUMA_MISS means it wanted to allocate page
> > > in node 1 but ended up with page in node 0
> > > 
> > > 2) In node 0, NUMA_FOREIGN means it wanted to allocate page
> > > in node 0 but ended up with page from Node 1.
> > > 
> > > But now, numastat explains it oppositely about (MISS, FOREIGN).
> > > Let's fix up with viewpoint of zone. 
> > > 
> > 
> > I'm confused....documentation is really bad ?
> > Implementation isn't ?
> 
> At that time, I though of it. 
> But I knew code is right since zone_stat_item said follwing as. 
> NUMA_MISS is rather unclear but NUMA_FOREIGN is clear, I think.
> 
>         NUMA_MISS,              /* allocated in non intended node */
>         NUMA_FOREIGN,           /* was intended here, hit elsewhere */
>
Ah, ok, it comments are correct your patch makes sense.
 
> Also I am worry about legacy tools related to NUMA but I don't know it.
> Code change will break them.
Ah, hmm. maybe.

Thanks. Add Christoph to CC:, maybe he can Ack.

Thanks,
-Kame




> > Hmm, this function ?
> > ==
> > void zone_statistics(struct zone *preferred_zone, struct zone *z)
> > {
> >         if (z->zone_pgdat == preferred_zone->zone_pgdat) {
> >                 __inc_zone_state(z, NUMA_HIT);
> >         } else {
> >                 __inc_zone_state(z, NUMA_MISS);
> >                 __inc_zone_state(preferred_zone, NUMA_FOREIGN);
> >         }
> >         if (z->node == numa_node_id())
> >                 __inc_zone_state(z, NUMA_LOCAL);
> >         else
> >                 __inc_zone_state(z, NUMA_OTHER);
> > }
> > ==
> > 
> > 
> > > Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
> > > ---
> > >  Documentation/numastat.txt |    8 ++++----
> > >  1 files changed, 4 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/Documentation/numastat.txt b/Documentation/numastat.txt
> > > index 80133ac..9fcc9a6 100644
> > > --- a/Documentation/numastat.txt
> > > +++ b/Documentation/numastat.txt
> > > @@ -7,10 +7,10 @@ All units are pages. Hugepages have separate counters.
> > > 
> > >  numa_hit			A process wanted to allocate memory from this node,
> > >  					and succeeded.
> > > -numa_miss			A process wanted to allocate memory from this node,
> > > -					but ended up with memory from another.
> > > -numa_foreign		A process wanted to allocate on another node,
> > > -				    but ended up with memory from this one.
> > > +numa_miss			A process wanted to allocate memory from another node,
> > > +					but ended up with memory from this node.
> > > +numa_foreign		A process wanted to allocate on this node,
> > > +				    but ended up with memory from another one.
> > >  local_node			A process ran on this node and got memory from it.
> > >  other_node			A process ran on this node and got memory from another node.
> > >  interleave_hit 		Interleaving wanted to allocate from this node
> > > --
> > > 1.5.4.3
> > > 
> > > 
> > > 
> > > -- 
> > > Kind regards,
> > > Minchan Kim
> > > 
> > > --
> > > To unsubscribe, send a message with 'unsubscribe linux-mm' in
> > > the body to majordomo@kvack.org.  For more info on Linux MM,
> > > see: http://www.linux-mm.org/ .
> > > Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
> > > 
> > 
> 
> 
> -- 
> Kind regards,
> Minchan Kim
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH mmotm] Fix NUMA accounting in numastat.txt
  2009-09-01  7:29     ` KAMEZAWA Hiroyuki
@ 2009-09-01 18:18       ` Christoph Lameter
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Lameter @ 2009-09-01 18:18 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: Minchan Kim, Andrew Morton, linux-mm, lkml, KOSAKI Motohiro

On Tue, 1 Sep 2009, KAMEZAWA Hiroyuki wrote:

> Thanks. Add Christoph to CC:, maybe he can Ack.

Acked-by: Christoph Lameter <cl@linux-foundation.org>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2009-09-01 14:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-01  4:53 [PATCH mmotm] Fix NUMA accounting in numastat.txt Minchan Kim
2009-09-01  7:17 ` KAMEZAWA Hiroyuki
2009-09-01  7:24   ` Minchan Kim
2009-09-01  7:29     ` KAMEZAWA Hiroyuki
2009-09-01 18:18       ` Christoph Lameter

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