* Tracking page allocation in Zone/Node
@ 2011-08-12 11:00 Pintu Agarwal
2011-08-12 16:08 ` Christoph Lameter
0 siblings, 1 reply; 5+ messages in thread
From: Pintu Agarwal @ 2011-08-12 11:00 UTC (permalink / raw)
To: mgorman; +Cc: linux-mm
Hi,
I wanted to keep track of the page allocation in kernel every time there is an allocation request in kernel.
Under "__alloc_pages_nodemask" , I wanted to print the zone/node information from which the page is actually getting allocated.
And then some more stuffs later, based on this.
But I am facing some problem and I need some help.
On my system I have only DMA zones with 3 nodes as follows:
Node 0, zone DMA 3 4 6 4 5 0 0 0 0 0 0
Node 1, zone DMA 8 4 3 8 7 4 2 0 0 0 0
Node 2, zone DMA 10 2 8 3 2 2 4 1 2 2 28
In __alloc_pages_nodemask(...), just before "First Allocation Attempt" [that is before get_page_from_freelist(....)], I wanted to print all the free pages from the "preferred_zone".
Using something like this :
totalfreepages = zone_page_state(zone, NR_FREE_PAGES);
But in my case, there is only one zone (DMA) but 3 nodes.
Thus the above "zone_page_state" always returns totalfreepages only from first Node 0.
But the allocation actually happening from Node 2.
How can we point to the zone of Node 2 to get the actual value?
If anybody have any ideas please let me know.
Thanks, Regards,
Pintu
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Tracking page allocation in Zone/Node
2011-08-12 11:00 Tracking page allocation in Zone/Node Pintu Agarwal
@ 2011-08-12 16:08 ` Christoph Lameter
2011-08-15 5:01 ` Pintu Agarwal
0 siblings, 1 reply; 5+ messages in thread
From: Christoph Lameter @ 2011-08-12 16:08 UTC (permalink / raw)
To: Pintu Agarwal; +Cc: mgorman, linux-mm
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1312 bytes --]
On Fri, 12 Aug 2011, Pintu Agarwal wrote:
> On my system I have only DMA zones with 3 nodes as follows:
> Node 0, zone DMA 3 4 6 4 5 0 0 0 0 0 0
> Node 1, zone DMA 8 4 3 8 7 4 2 0 0 0 0
> Node 2, zone DMA 10 2 8 3 2 2 4 1 2 2 28
Weird system. One would expect it to only have NORMAL zones. Is this an
ARM system?
> In __alloc_pages_nodemask(...), just before "First Allocation Attempt" [that is before get_page_from_freelist(....)], I wanted to print all the free pages from the "preferred_zone".
> Using something like this :
> totalfreepages = zone_page_state(zone, NR_FREE_PAGES);
>
> But in my case, there is only one zone (DMA) but 3 nodes.
> Thus the above "zone_page_state" always returns totalfreepages only from first Node 0.
> But the allocation actually happening from Node 2.
>
> How can we point to the zone of Node 2 to get the actual value?
>
I am not sure that I understand you correctly but you can get the data
from node 2 via
zone_page_state(NODE_DATA[2]->node_zones[ZONE_DMA], NR_FREE_PAGES);
or in __alloc_pages_nodemask
zone_page_state(preferred_zone, NR_FREE_PAGES);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Tracking page allocation in Zone/Node
2011-08-12 16:08 ` Christoph Lameter
@ 2011-08-15 5:01 ` Pintu Agarwal
2011-08-15 8:06 ` Bob Liu
2011-08-15 13:58 ` Christoph Lameter
0 siblings, 2 replies; 5+ messages in thread
From: Pintu Agarwal @ 2011-08-15 5:01 UTC (permalink / raw)
To: Christoph Lameter; +Cc: mgorman, linux-mm
Thanks Christoph for your reply :)
> Weird system. One would expect it to only have NORMAL zones. Is this an
> ARM system?
Yes this is an ARM based system for linux mobile phone.
> I am not sure that I understand you correctly but you can get the data from node 2 via
> zone_page_state(NODE_DATA[2]->node_zones[ZONE_DMA], NR_FREE_PAGES);
Yes, you got me right. I wanted to access Node 2 data from the preferred zone. This is helpful, thanks.
But I want it to be dynamic. That is if Node 2 is over-loaded, then the allocation happens from Node 1 or Node 0 as well.
Also it should work on normal desktop itself where there are DMA, Normal, HighMem as well.
How to make the above statement generic so that it should work in all scenarios?
> or in __alloc_pages_nodemask
> zone_page_state(preferred_zone, NR_FREE_PAGES);
Yes, I tried exactly like this, but since I have only one zone (DMA), it always returns me the data from the first Node 0.
This will only work, if I have 3 separate zones (DMA, Normal, HighMem)
In "__alloc_pages_nodemask", before the actual allocation happens, how to find out the allocation is going to happen from which zone and which Node.?
(The _preferred_zone_ info is not enough, I need to know the Node number as well)
Please help...
I hope the question is clear know.
Thanks,
Pintu
----- Original Message -----
From: Christoph Lameter <cl@linux.com>
To: Pintu Agarwal <pintu_agarwal@yahoo.com>
Cc: "mgorman@suse.de" <mgorman@suse.de>; "linux-mm@kvack.org" <linux-mm@kvack.org>
Sent: Friday, 12 August 2011 9:38 PM
Subject: Re: Tracking page allocation in Zone/Node
On Fri, 12 Aug 2011, Pintu Agarwal wrote:
> On my system I have only DMA zones with 3 nodes as follows:
> Node 0, zone DMA 3 4 6 4 5 0 0 0 0 0 0
> Node 1, zone DMA 8 4 3 8 7 4 2 0 0 0 0
> Node 2, zone DMA 10 2 8 3 2 2 4 1 2 2 28
Weird system. One would expect it to only have NORMAL zones. Is this an
ARM system?
> In __alloc_pages_nodemask(...), just before "First Allocation Attempt" [that is before get_page_from_freelist(....)], I wanted to print all the free pages from the "preferred_zone".
> Using something like this :
> totalfreepages = zone_page_state(zone, NR_FREE_PAGES);
>
> But in my case, there is only one zone (DMA) but 3 nodes.
> Thus the above "zone_page_state" always returns totalfreepages only from first Node 0.
> But the allocation actually happening from Node 2.
>
> How can we point to the zone of Node 2 to get the actual value?
>
I am not sure that I understand you correctly but you can get the data
from node 2 via
zone_page_state(NODE_DATA[2]->node_zones[ZONE_DMA], NR_FREE_PAGES);
or in __alloc_pages_nodemask
zone_page_state(preferred_zone, NR_FREE_PAGES);
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Tracking page allocation in Zone/Node
2011-08-15 5:01 ` Pintu Agarwal
@ 2011-08-15 8:06 ` Bob Liu
2011-08-15 13:58 ` Christoph Lameter
1 sibling, 0 replies; 5+ messages in thread
From: Bob Liu @ 2011-08-15 8:06 UTC (permalink / raw)
To: Pintu Agarwal; +Cc: Christoph Lameter, mgorman, linux-mm
On Mon, Aug 15, 2011 at 1:01 PM, Pintu Agarwal <pintu_agarwal@yahoo.com> wrote:
> Thanks Christoph for your reply :)
>
>> Weird system. One would expect it to only have NORMAL zones. Is this an
>> ARM system?
>
> Yes this is an ARM based system for linux mobile phone.
>
>> I am not sure that I understand you correctly but you can get the data from node 2 via
>> zone_page_state(NODE_DATA[2]->node_zones[ZONE_DMA], NR_FREE_PAGES);
>
> Yes, you got me right. I wanted to access Node 2 data from the preferred zone. This is helpful, thanks.
> But I want it to be dynamic. That is if Node 2 is over-loaded, then the allocation happens from Node 1 or Node 0 as well.
In my opinion, current code will do this behavior.
If allocation from node 2 failed, it will try other nodes, so you
needn't to do it by yourself.
> Also it should work on normal desktop itself where there are DMA, Normal, HighMem as well.
> How to make the above statement generic so that it should work in all scenarios?
>
>> or in __alloc_pages_nodemask
>> zone_page_state(preferred_zone, NR_FREE_PAGES);
>
> Yes, I tried exactly like this, but since I have only one zone (DMA), it always returns me the data from the first Node 0.
> This will only work, if I have 3 separate zones (DMA, Normal, HighMem)
>
> In "__alloc_pages_nodemask", before the actual allocation happens, how to find out the allocation is going to happen from which zone and which Node.?
> (The _preferred_zone_ info is not enough, I need to know the Node number as well)
>
> Please help...
> I hope the question is clear know.
>
>
>
> Thanks,
> Pintu
>
>
> ----- Original Message -----
> From: Christoph Lameter <cl@linux.com>
> To: Pintu Agarwal <pintu_agarwal@yahoo.com>
> Cc: "mgorman@suse.de" <mgorman@suse.de>; "linux-mm@kvack.org" <linux-mm@kvack.org>
> Sent: Friday, 12 August 2011 9:38 PM
> Subject: Re: Tracking page allocation in Zone/Node
>
> On Fri, 12 Aug 2011, Pintu Agarwal wrote:
>
>> On my system I have only DMA zones with 3 nodes as follows:
>> Node 0, zone DMA 3 4 6 4 5 0 0 0 0 0 0
>> Node 1, zone DMA 8 4 3 8 7 4 2 0 0 0 0
>> Node 2, zone DMA 10 2 8 3 2 2 4 1 2 2 28
>
> Weird system. One would expect it to only have NORMAL zones. Is this an
> ARM system?
>
>
>> In __alloc_pages_nodemask(...), just before "First Allocation Attempt" [that is before get_page_from_freelist(....)], I wanted to print all the free pages from the "preferred_zone".
>> Using something like this :
>> totalfreepages = zone_page_state(zone, NR_FREE_PAGES);
>>
>> But in my case, there is only one zone (DMA) but 3 nodes.
>> Thus the above "zone_page_state" always returns totalfreepages only from first Node 0.
>> But the allocation actually happening from Node 2.
>>
>> How can we point to the zone of Node 2 to get the actual value?
>>
>
>
> I am not sure that I understand you correctly but you can get the data
> from node 2 via
>
> zone_page_state(NODE_DATA[2]->node_zones[ZONE_DMA], NR_FREE_PAGES);
>
> or in __alloc_pages_nodemask
>
> zone_page_state(preferred_zone, NR_FREE_PAGES);
>
>
--
Regards,
--Bob
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Tracking page allocation in Zone/Node
2011-08-15 5:01 ` Pintu Agarwal
2011-08-15 8:06 ` Bob Liu
@ 2011-08-15 13:58 ` Christoph Lameter
1 sibling, 0 replies; 5+ messages in thread
From: Christoph Lameter @ 2011-08-15 13:58 UTC (permalink / raw)
To: Pintu Agarwal; +Cc: mgorman, linux-mm
[-- Attachment #1: Type: TEXT/PLAIN, Size: 898 bytes --]
On Sun, 14 Aug 2011, Pintu Agarwal wrote:
> Thanks Christoph for your reply :)
>
> > Weird system. One would expect it to only have NORMAL zones. Is this an
> > ARM system?
>
> Yes this is an ARM based system for linux mobile phone.
Ok.Maybe The memory setup is broken. Make the DMA zones into NORMAL
zones?
> Yes, I tried exactly like this, but since I have only one zone (DMA), it always returns me the data from the first Node 0.
> This will only work, if I have 3 separate zones (DMA, Normal, HighMem)
Well yes that is the way its designed. DMA is an exceptional zone.
> In "__alloc_pages_nodemask", before the actual allocation happens, how to find out the allocation is going to happen from which zone and which Node.?
> (The _preferred_zone_ info is not enough, I need to know the Node number as well)
You can get the node number from a zone. Use zone_to_nid().
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-08-15 13:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-12 11:00 Tracking page allocation in Zone/Node Pintu Agarwal
2011-08-12 16:08 ` Christoph Lameter
2011-08-15 5:01 ` Pintu Agarwal
2011-08-15 8:06 ` Bob Liu
2011-08-15 13:58 ` Christoph Lameter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox