linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* A question about alloc_pages()
@ 2008-09-25 22:31 David Howells
  2008-09-26 16:01 ` Christoph Lameter
  2008-09-29 13:21 ` David Howells
  0 siblings, 2 replies; 3+ messages in thread
From: David Howells @ 2008-09-25 22:31 UTC (permalink / raw)
  To: linux-mm; +Cc: dhowells

Hi,

When alloc_pages() is asked to allocate a block of pages (order > 0), should I
be able to expect that page_count(pages[0]) will be 1, and page_count() for
all the other pages will be 0?

As far as I can see, nothing in the allocator alters what's in the page count
for pages beyond the first when pages are freed, and checks are made that
these are 0 upon freeing, so it looks to me like this ought to be the case.

However, I have a report that sometimes this isn't true, and I'm wondering if
the allocator can't be relied on in this way, or whether there's a bug
somewhere keeping a reference to a released page.

David

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: A question about alloc_pages()
  2008-09-25 22:31 A question about alloc_pages() David Howells
@ 2008-09-26 16:01 ` Christoph Lameter
  2008-09-29 13:21 ` David Howells
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Lameter @ 2008-09-26 16:01 UTC (permalink / raw)
  To: David Howells; +Cc: linux-mm

David Howells wrote:

> When alloc_pages() is asked to allocate a block of pages (order > 0), should I
> be able to expect that page_count(pages[0]) will be 1, and page_count() for
> all the other pages will be 0?

Correct.

> However, I have a report that sometimes this isn't true, and I'm wondering if
> the allocator can't be relied on in this way, or whether there's a bug
> somewhere keeping a reference to a released page.

Must be a bug.

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: A question about alloc_pages()
  2008-09-25 22:31 A question about alloc_pages() David Howells
  2008-09-26 16:01 ` Christoph Lameter
@ 2008-09-29 13:21 ` David Howells
  1 sibling, 0 replies; 3+ messages in thread
From: David Howells @ 2008-09-29 13:21 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: dhowells, linux-mm

Christoph Lameter <cl@linux-foundation.org> wrote:

> Must be a bug.

Seems I wasn't returning the blocks of pages correctly: the first page needed
its page_count() setting to 1 and the an order-N sized page block had to be
order-N aligned before calling __free_pages().  However, if you don't turn on
CONFIG_DEBUG_VM, it appears to work, but produces some odd effects.

David

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2008-09-29 13:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-25 22:31 A question about alloc_pages() David Howells
2008-09-26 16:01 ` Christoph Lameter
2008-09-29 13:21 ` David Howells

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