linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Why is the free_list not null-terminated?
@ 2000-06-23 19:28 Timur Tabi
  2000-06-27  1:27 ` Andrea Arcangeli
  0 siblings, 1 reply; 3+ messages in thread
From: Timur Tabi @ 2000-06-23 19:28 UTC (permalink / raw)
  To: Linux MM mailing list

This is probably more of a general Linux kernel programming question that an MM
question, but maybe not.

I've written a program which traverses the free_area[] array of a zone.  The
output looks like this:

Jun 23 13:48:42 two kernel: Zone: c025c86c 
Jun 23 13:48:42 two kernel: O0: free_area c025c888, prev=c12c9ba0,
next=c12c9ba0, *map=0 
Jun 23 13:48:42 two kernel: mem_map_t at c12c9ba0: phys: 42cd4000 zone:
c025c86c 
Jun 23 13:48:42 two kernel: mem_map_t at c12c9ba0: phys: 42cd4000 zone:
c025c86c 
Jun 23 13:48:42 two kernel: O1: free_area c025c894, prev=c12c9ac8,
next=c12c9ac8, *map=0 
Jun 23 13:48:42 two kernel: mem_map_t at c12c9ac8: phys: 42cd1000 zone:
c025c86c 
Jun 23 13:48:42 two kernel: mem_map_t at c12c9ac8: phys: 42cd1000 zone:
c025c86c 
Jun 23 13:48:42 two kernel: O2: free_area c025c8a0, prev=c025c8a0,
next=c025c8a0, *map=0 
Jun 23 13:48:42 two kernel: mem_map_t at c025c8a0: phys: 8657000 zone: c1484080 
Jun 23 13:48:42 two kernel: mem_map_t at c025c8a0: phys: 8657000 zone: c1484080 

This is for the ZONE_NORMAL zone.  O0 means Order 0 or free_area[0].

If you look at O2, you'll see that the &free_area[2] is c024c8a0, and the prev
and next pointers are the same.  

Question #1: Does this mean that there are no free zones of Order 2 (16KB)?

Question #2: Why are prev and next not set to null?  Why do they point back to
free_area?  *prev is supposed to be of type mem_map_t, but in the case of O2,
it's not, so wouldn't that be a type mismatch?  If you look at the last two
lines, you'll see I'm displaying the contents of two *prev and *next, as if they
were mem_map_t structures, but they're not, so I get garbage values.  I would
think that the code would be better if prev and next, in this case, were set to
NULL to indicate the end of the list.  After all, *prev and *next are not
meaningful any more.



--
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com

When replying to a mailing-list message, please don't cc: me, because then I'll just get two copies of the same message.
--
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.eu.org/Linux-MM/

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

* Re: Why is the free_list not null-terminated?
  2000-06-23 19:28 Why is the free_list not null-terminated? Timur Tabi
@ 2000-06-27  1:27 ` Andrea Arcangeli
  2000-06-27 15:39   ` Timur Tabi
  0 siblings, 1 reply; 3+ messages in thread
From: Andrea Arcangeli @ 2000-06-27  1:27 UTC (permalink / raw)
  To: Timur Tabi; +Cc: Linux MM mailing list

On Fri, 23 Jun 2000, Timur Tabi wrote:

>Question #1: Does this mean that there are no free zones of Order 2 (16KB)?

It means there are no free contigous chunks of memory of order 2 in such
zone.

>Question #2: Why are prev and next not set to null?  Why do they point

because of linux/include/list.h ;), more seriously that avoids a path in
the list insert/remove code but the head of the list is double size (and
this is not an issue except for large hashtables).

(btw give a try also to SYSRQ+M if you are interested about similar info)

Andrea

--
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.eu.org/Linux-MM/

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

* Re: Why is the free_list not null-terminated?
  2000-06-27  1:27 ` Andrea Arcangeli
@ 2000-06-27 15:39   ` Timur Tabi
  0 siblings, 0 replies; 3+ messages in thread
From: Timur Tabi @ 2000-06-27 15:39 UTC (permalink / raw)
  To: Linux MM mailing list

** Reply to message from Andrea Arcangeli <andrea@suse.de> on Tue, 27 Jun 2000
03:27:15 +0200 (CEST)


> >Question #1: Does this mean that there are no free zones of Order 2 (16KB)?
> 
> It means there are no free contigous chunks of memory of order 2 in such
> zone.

That's what I meant :-)

> >Question #2: Why are prev and next not set to null?  Why do they point
> 
> because of linux/include/list.h ;), more seriously that avoids a path in
> the list insert/remove code but the head of the list is double size (and
> this is not an issue except for large hashtables).

Well, I don't understand what that means, but I don't think it's important. 
But something else does confuse me.

Both free_area[x].free_list.prev and free_area[x].free_list.next point to
mem_map_t blocks.  Why is that?  How do I find the head this linked list?  I
would think that free_area[x].free_list.prev would point to nothing, and
free_area[x].free_list.next points to the head of the list.

> (btw give a try also to SYSRQ+M if you are interested about similar info)

What is SYSRQ+M?  I've never heard of that!




--
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com

When replying to a mailing-list message, please don't cc: me, because then I'll just get two copies of the same message.
--
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.eu.org/Linux-MM/

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

end of thread, other threads:[~2000-06-27 15:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-23 19:28 Why is the free_list not null-terminated? Timur Tabi
2000-06-27  1:27 ` Andrea Arcangeli
2000-06-27 15:39   ` Timur Tabi

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