* order of matching alloc_pages/free_pages call pairs. Are they always same?
@ 2001-05-26 17:10 Bulent Abali
2001-05-27 3:12 ` Joseph A. Knapka
2001-05-29 16:24 ` Timur Tabi
0 siblings, 2 replies; 3+ messages in thread
From: Bulent Abali @ 2001-05-26 17:10 UTC (permalink / raw)
To: linux-mm
Is it reasonable to assume that matching
alloc_pages/free_pages pairs will always have the same order
as the 2nd argument?
For example
pg = alloc_pages( , aorder); free_pages(pg, forder);
Is (aorder == forder) always true?
Or, are there any bizarro drivers etc which will intentionally
free partial amounts, that is (forder < aorder)?
--
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] 3+ messages in thread
* Re: order of matching alloc_pages/free_pages call pairs. Are they always same?
2001-05-26 17:10 order of matching alloc_pages/free_pages call pairs. Are they always same? Bulent Abali
@ 2001-05-27 3:12 ` Joseph A. Knapka
2001-05-29 16:24 ` Timur Tabi
1 sibling, 0 replies; 3+ messages in thread
From: Joseph A. Knapka @ 2001-05-27 3:12 UTC (permalink / raw)
To: Bulent Abali; +Cc: linux-mm
Bulent Abali wrote:
>
> Is it reasonable to assume that matching
> alloc_pages/free_pages pairs will always have the same order
> as the 2nd argument?
>
> For example
> pg = alloc_pages( , aorder); free_pages(pg, forder);
> Is (aorder == forder) always true?
>
> Or, are there any bizarro drivers etc which will intentionally
> free partial amounts, that is (forder < aorder)?
This would be a somewhat bizarre thing to do, but after thinking
about it a bit, I believe it would work fine - as long as you're
very careful to free blocks with appropriate order and alignment.
I'm not personally aware of any code that actually frees sub-blocks
of allocated blocks, but I expect that when I get around to looking
at the slab allocator (kmalloc(), kfree()) there will be code
in there that does so.
-- Joe
-- Joseph A. Knapka
"If I ever get reincarnated... let me make certain I don't come back
as a paperclip." -- protagonist, H Murakami's "Hard-boiled Wonderland"
// Linux MM Documentation in progress:
// http://home.earthlink.net/~jknapka/linux-mm/vmoutline.html
* Evolution is an "unproven theory" in the same sense that gravity is. *
--
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] 3+ messages in thread
* Re: order of matching alloc_pages/free_pages call pairs. Are they always same?
2001-05-26 17:10 order of matching alloc_pages/free_pages call pairs. Are they always same? Bulent Abali
2001-05-27 3:12 ` Joseph A. Knapka
@ 2001-05-29 16:24 ` Timur Tabi
1 sibling, 0 replies; 3+ messages in thread
From: Timur Tabi @ 2001-05-29 16:24 UTC (permalink / raw)
To: linux-mm
** Reply to message from "Bulent Abali" <abali@us.ibm.com> on Sat, 26 May 2001
13:10:42 -0400
> Is it reasonable to assume that matching
> alloc_pages/free_pages pairs will always have the same order
> as the 2nd argument?
>
> For example
> pg = alloc_pages( , aorder); free_pages(pg, forder);
> Is (aorder == forder) always true?
>
> Or, are there any bizarro drivers etc which will intentionally
> free partial amounts, that is (forder < aorder)?
Yes!! My driver does exactly that!! Please DO NOT do anything to break this
functionality. Here's the code which does that:
void fragment_and_free(void *_region, unsigned current_order, unsigned
new_order)
{
unsigned long current_size = (1 << current_order) << PAGE_SHIFT;
unsigned long new_size = (1 << new_order) << PAGE_SHIFT;
char *region = (char *) _region;
char *p;
printk("Subdividing block of order %u into blocks of order %u\n",
current_order, new_order);
if (new_order <= current_order)
{
for (p = region; p < (region + current_size); p += new_size)
free_pages((u32) p, new_order);
}
}
--
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com
--
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] 3+ messages in thread
end of thread, other threads:[~2001-05-29 16:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-26 17:10 order of matching alloc_pages/free_pages call pairs. Are they always same? Bulent Abali
2001-05-27 3:12 ` Joseph A. Knapka
2001-05-29 16:24 ` Timur Tabi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox