linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* working of balance_classzone()
@ 2002-05-19  8:58 Abhishek Nayani
  2002-05-19 12:29 ` Hugh Dickins
  0 siblings, 1 reply; 2+ messages in thread
From: Abhishek Nayani @ 2002-05-19  8:58 UTC (permalink / raw)
  To: linux-mm

Hi,

	I was commenting the code of balance_classzone() and am stuck up
at some point. The code in question is:

	if (likely(__freed)) {
	/* pick from the last inserted so we're lifo */
		entry = local_pages->next;
		do {
		     tmp = list_entry(entry, struct page, list);
---->>		     if (tmp->index == order && memclass(page_zone(tmp), classzone)) {
				list_del(entry);
				current->nr_local_pages--;
				set_page_count(tmp, 1);
				page = tmp;
				.................


	According to the code of __free_pages_ok(), when we try to free
pages with PF_FREE_PAGES set (as is done in balance_classzone() before
the call to try_to_free_pages()) only one block of pages of some order
is added to the local_pages member of the current task. Also
nr_local_pages is 1 if there is a block of pages else it is 0 (ie. being
used as a flag).

[related code: local_freelist:
	           if (current->nr_local_pages)
	                goto back_local_freelist;]



	So the code in balance_classzone() looks very suspicious as it
is acting as if there were many blocks of free pages of different orders
on the list and we are trying to get the block of the correct order and
then freeing the rest in reverse order.... 

	Since there is only one block, we can cut the code to just check
the order of that block, if its greater than our requirement, call
rmqueue() else return NULL. 

	If i am missing something or u've not understood my doubt,
please let me know...


					Bye,
						Abhi.
	
--------------------------------------------------------------------------
"I can only show you the door, you have to walk through it..." - Morpheus
--------------------------------------------------------------------------
Home Page: http://www.abhi.tk
-----BEGIN GEEK CODE BLOCK------------------------------------------------
GCS d+ s:- a-- C+++ UL P+ L+++ E- W++ N+ o K- w--- O-- M- V- PS PE Y PGP 
t+ 5 X+ R- tv+ b+++ DI+ D G e++ h! !r y- 
------END GEEK CODE BLOCK-------------------------------------------------

----- End forwarded message -----
					Bye,
						Abhi.
	
--------------------------------------------------------------------------
"I can only show you the door, you have to walk through it..." - Morpheus
--------------------------------------------------------------------------
Home Page: http://www.abhi.tk
-----BEGIN GEEK CODE BLOCK------------------------------------------------
GCS d+ s:- a-- C+++ UL P+ L+++ E- W++ N+ o K- w--- O-- M- V- PS PE Y PGP 
t+ 5 X+ R- tv+ b+++ DI+ D G e++ h! !r y- 
------END GEEK CODE BLOCK-------------------------------------------------
--
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/

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

* Re: working of balance_classzone()
  2002-05-19  8:58 working of balance_classzone() Abhishek Nayani
@ 2002-05-19 12:29 ` Hugh Dickins
  0 siblings, 0 replies; 2+ messages in thread
From: Hugh Dickins @ 2002-05-19 12:29 UTC (permalink / raw)
  To: Abhishek Nayani; +Cc: linux-mm

On Sun, 19 May 2002, Abhishek Nayani wrote:
> 
> 	So the code in balance_classzone() looks very suspicious as it
> is acting as if there were many blocks of free pages of different orders
> on the list and we are trying to get the block of the correct order and
> then freeing the rest in reverse order.... 
> 
> 	Since there is only one block, we can cut the code to just check
> the order of that block, if its greater than our requirement, call
> rmqueue() else return NULL. 

The code hereabouts has been marooned for many releases, somewhere
in between what Andrea intended and what Linus wanted.  You're right
that there's a (harmless) mismatch between what __free_pages_ok is
actually doing, and what balance_classzone is expecting it to do.
But that should get sorted out when Andrea's further VM patches are
merged into 2.4.20... (always seems to be around the next corner).

Hugh

--
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/

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

end of thread, other threads:[~2002-05-19 12:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-19  8:58 working of balance_classzone() Abhishek Nayani
2002-05-19 12:29 ` Hugh Dickins

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