Commit 0f8053a509ceba4a077a50ea7b77039b5559b428

Authored by Nick Piggin
Committed by Linus Torvalds
1 parent 4fa4f53bf9

[PATCH] mm: make __put_page internal

Remove __put_page from outside the core mm/.  It is dangerous because it does
not handle compound pages nicely, and misses 1->0 transitions.  If a user
later appears that really needs the extra speed we can reevaluate.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 4 changed files with 15 additions and 1 deletions Side-by-side Diff

... ... @@ -308,7 +308,6 @@
308 308 }
309 309  
310 310 #define set_page_count(p,v) atomic_set(&(p)->_count, (v))
311   -#define __put_page(p) atomic_dec(&(p)->_count)
312 311  
313 312 extern void FASTCALL(__page_cache_release(struct page *));
314 313  
... ... @@ -30,6 +30,8 @@
30 30 #include <linux/security.h>
31 31 #include <linux/syscalls.h>
32 32 #include "filemap.h"
  33 +#include "internal.h"
  34 +
33 35 /*
34 36 * FIXME: remove all knowledge of the buffer layer from the core VM
35 37 */
... ... @@ -8,7 +8,11 @@
8 8 * as published by the Free Software Foundation; either version
9 9 * 2 of the License, or (at your option) any later version.
10 10 */
  11 +#ifndef __MM_INTERNAL_H
  12 +#define __MM_INTERNAL_H
11 13  
  14 +#include <linux/mm.h>
  15 +
12 16 static inline void set_page_refs(struct page *page, int order)
13 17 {
14 18 #ifdef CONFIG_MMU
15 19  
... ... @@ -26,6 +30,13 @@
26 30 #endif /* CONFIG_MMU */
27 31 }
28 32  
  33 +static inline void __put_page(struct page *page)
  34 +{
  35 + atomic_dec(&page->_count);
  36 +}
  37 +
29 38 extern void fastcall __init __free_pages_bootmem(struct page *page,
30 39 unsigned int order);
  40 +
  41 +#endif
... ... @@ -39,6 +39,8 @@
39 39  
40 40 #include <linux/swapops.h>
41 41  
  42 +#include "internal.h"
  43 +
42 44 /* possible outcome of pageout() */
43 45 typedef enum {
44 46 /* failed to write page out, page is locked */