[PATCH] Drop free_pages()

nr_free_pages is now a simple access to a global variable.  Make it a macro
instead of a function.

The nr_free_pages now requires vmstat.h to be included.  There is one
occurrence in power management where we need to add the include.  Directly
refrer to global_page_state() there to clarify why the #include was added.

[[email protected]: arm build fix]
[[email protected]: sparc64 build fix]
Signed-off-by: Christoph Lameter <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Christoph Lameter 2007-02-10 01:43:03 -08:00 • committed by Linus Torvalds
commit 9617729941
5 changed files with 10 additions and 14 deletions

View file

@ -20,6 +20,7 @@
#include <linux/cpu.h>
#include <linux/resume-trace.h>
#include <linux/freezer.h>
#include <linux/vmstat.h>
#include "power.h"
@ -72,7 +73,8 @@ static int suspend_prepare(suspend_state_t state)
goto Thaw;
}
if ((free_pages = nr_free_pages()) < FREE_PAGE_NUMBER) {
if ((free_pages = global_page_state(NR_FREE_PAGES))
< FREE_PAGE_NUMBER) {
pr_debug("PM: free some memory\n");
shrink_all_memory(FREE_PAGE_NUMBER - free_pages);
if (nr_free_pages() < FREE_PAGE_NUMBER) {