* Should page->count ever be -1?
@ 2001-01-03 21:07 Timur Tabi
2001-01-03 21:55 ` Andrea Arcangeli
2001-01-03 21:59 ` Timur Tabi
0 siblings, 2 replies; 3+ messages in thread
From: Timur Tabi @ 2001-01-03 21:07 UTC (permalink / raw)
To: Linux Kernel Mailing list
I'm experiencing some kind of memory leaks playing with ioremap and iounmap,
and I've narrowed down the problem to iounmap refusing to unmap the memory that
I just mapped. The line of code in question is
if (!PageReserved(page) && atomic_dec_and_test(&page->count)) {
from page_alloc.c (this is 2.2.18pre15). It appears that page->count is
already zero when this code is executed, and after it's executed, page->count
becomes -1 (or more accurately, 0xFFFFFFFF). Is this acceptable, or is it an
error condition?
--
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com
When replying to a mailing-list message, please direct the reply to the mailing list only. Don't send another copy to me.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Should page->count ever be -1?
2001-01-03 21:07 Should page->count ever be -1? Timur Tabi
@ 2001-01-03 21:55 ` Andrea Arcangeli
2001-01-03 21:59 ` Timur Tabi
1 sibling, 0 replies; 3+ messages in thread
From: Andrea Arcangeli @ 2001-01-03 21:55 UTC (permalink / raw)
To: Timur Tabi; +Cc: Linux Kernel Mailing list
On Wed, Jan 03, 2001 at 03:07:03PM -0600, Timur Tabi wrote:
> I'm experiencing some kind of memory leaks playing with ioremap and iounmap,
> and I've narrowed down the problem to iounmap refusing to unmap the memory that
> I just mapped. The line of code in question is
>
> if (!PageReserved(page) && atomic_dec_and_test(&page->count)) {
>
> from page_alloc.c (this is 2.2.18pre15). It appears that page->count is
> already zero when this code is executed, and after it's executed, page->count
> becomes -1 (or more accurately, 0xFFFFFFFF). Is this acceptable, or is it an
> error condition?
It's an error condition. Make sure you marked the page as reserved in the mmap
callback if it's not an mmio region outside RAM.
Andrea
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Should page->count ever be -1?
2001-01-03 21:07 Should page->count ever be -1? Timur Tabi
2001-01-03 21:55 ` Andrea Arcangeli
@ 2001-01-03 21:59 ` Timur Tabi
1 sibling, 0 replies; 3+ messages in thread
From: Timur Tabi @ 2001-01-03 21:59 UTC (permalink / raw)
To: Andrea Arcangeli, Linux Kernel Mailing list
** Reply to message from Andrea Arcangeli <andrea@suse.de> on Wed, 3 Jan 2001
22:55:05 +0100
> > from page_alloc.c (this is 2.2.18pre15). It appears that page->count is
> > already zero when this code is executed, and after it's executed, page->count
> > becomes -1 (or more accurately, 0xFFFFFFFF). Is this acceptable, or is it an
> > error condition?
>
> It's an error condition. Make sure you marked the page as reserved in the mmap
> callback if it's not an mmio region outside RAM.
I mark the page as reserved when I call ioremap and then unmark it after
ioremap returns, but iounmap will fail if it's still reserved (the same line of
code also checks the reserved bit):
if (!PageReserved(page) && atomic_dec_and_test(&page->count)) {
^^^^^^^^^^^^^^^^^^^
Is this what you're saying?
iounmap just calls vfree, which does all the work. However, I'm confused at
this code in vfree:
vmfree_area_pages(VMALLOC_VMADDR(tmp->addr), tmp->size);
kfree(tmp);
What's the difference between vmfree_area_pages and kfree?
--
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com
When replying to a mailing-list message, please direct the reply to the mailing list only. Don't send another copy to me.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-01-03 21:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-03 21:07 Should page->count ever be -1? Timur Tabi
2001-01-03 21:55 ` Andrea Arcangeli
2001-01-03 21:59 ` Timur Tabi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox