Re: oops if free a locked page

Ingo Molnar (mingo@chiara.csoma.elte.hu)
Tue, 22 Jun 1999 19:41:29 +0200 (CEST)


On Tue, 22 Jun 1999, Andrea Arcangeli wrote:

> I have a problem with pre-2.3.8-2. It issues an Oops if I attempt to free
> a locked page. I think I am allowed to free a locked page without first
> unlock it, because if there's a waiter waiting for the page, the waiter
> will have just increased the reference count of the page before go to
> sleep on the page.
>
> I want to run try_to_free_buffers() with the page locked and so I want to
> be allowed to run:
>
> /* And free the page */
> page->buffers = NULL;
> if (__free_page(page)) {
> buffermem -= PAGE_SIZE;
> return 1;
> }
>
> with the page locked. If try_to_free_buffers() will return 1, then I'll
> avoid the unlock, otherwise I'll do the unlock but after a lot of time
> (I'll take the page locked just ready for the shrink_mmap-inode path).
> Right now I removed the BUG() in free-page.

freeing locked pages is very dangerous. A newly allocated page should be
unlocked, thats a fair requirement a generic page allocator should have.
[we have a couple of places that would break in subtle ways if we freed
locked pages.]

calling __free_page() with a locked page is fine though - but it must not
be the 'final' free.

-- mingo

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/