diff options
| author | Andrew Morton <akpm@zip.com.au> | 2002-08-15 06:40:14 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-08-15 06:40:14 -0700 |
| commit | 2329a4f63a4c87e31fd0a22723a5b0bd2fa38736 (patch) | |
| tree | 112358a26a021fe01bbd4f7d12c3b943d408c0f8 /include/linux | |
| parent | 0016745eb7341b5f16fa0a087b12c032090a73b1 (diff) | |
[PATCH] memory leak in current BK
Well I didn't test that very well. __page_cache_release() is doing a
__free_page() on a zero-ref page, so __free_pages() sends the refcount
negative and doesn't free it. With patch #8, page_cache_release()
almost never frees pages, but it must have been leaking a little bit.
Lucky it showed up.
This fixes it, and also adds a missing PageReserved test in put_page().
Which makes put_page() identical to page_cache_release(), but there are
header file woes. I'll fix that up later.
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/mm.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 4d7de397481f..c4395b9fe950 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -199,11 +199,12 @@ struct page { #define page_count(p) atomic_read(&(p)->count) #define set_page_count(p,v) atomic_set(&(p)->count, v) extern void FASTCALL(__page_cache_release(struct page *)); -#define put_page(p) \ - do { \ - if (put_page_testzero(p)) \ - __page_cache_release(p); \ +#define put_page(p) \ + do { \ + if (!PageReserved(p) && put_page_testzero(p)) \ + __page_cache_release(p); \ } while (0) +void FASTCALL(__free_pages_ok(struct page *page, unsigned int order)); /* * Multiple processes may "see" the same page. E.g. for untouched |
