Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 148675
b: refs/heads/master
c: c6f37f1
h: refs/heads/master
i:
  148673: 8fcfd77
  148671: 7ceb5a8
v: v3
  • Loading branch information
Rafael J. Wysocki committed Jun 12, 2009
1 parent cf14f20 commit 8d2f28b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e240b58c79144708530138e05f17c6d0d8d744a8
refs/heads/master: c6f37f12197ac3bd2e5a35f2f0e195ae63d437de
20 changes: 1 addition & 19 deletions trunk/kernel/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,6 @@ static void suspend_test_finish(const char *label)

#endif

/* This is just an arbitrary number */
#define FREE_PAGE_NUMBER (100)

static struct platform_suspend_ops *suspend_ops;

/**
Expand Down Expand Up @@ -226,7 +223,6 @@ int suspend_valid_only_mem(suspend_state_t state)
static int suspend_prepare(void)
{
int error;
unsigned int free_pages;

if (!suspend_ops || !suspend_ops->enter)
return -EPERM;
Expand All @@ -241,24 +237,10 @@ static int suspend_prepare(void)
if (error)
goto Finish;

if (suspend_freeze_processes()) {
error = -EAGAIN;
goto Thaw;
}

free_pages = global_page_state(NR_FREE_PAGES);
if (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) {
error = -ENOMEM;
printk(KERN_ERR "PM: No enough memory\n");
}
}
error = suspend_freeze_processes();
if (!error)
return 0;

Thaw:
suspend_thaw_processes();
usermodehelper_enable();
Finish:
Expand Down
4 changes: 2 additions & 2 deletions trunk/mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2056,7 +2056,7 @@ unsigned long global_lru_pages(void)
+ global_page_state(NR_INACTIVE_FILE);
}

#ifdef CONFIG_PM
#ifdef CONFIG_HIBERNATION
/*
* Helper function for shrink_all_memory(). Tries to reclaim 'nr_pages' pages
* from LRU lists system-wide, for given pass and priority.
Expand Down Expand Up @@ -2196,7 +2196,7 @@ unsigned long shrink_all_memory(unsigned long nr_pages)

return sc.nr_reclaimed;
}
#endif
#endif /* CONFIG_HIBERNATION */

/* It's optimal to keep kswapds on the same CPUs as their memory, but
not required for correctness. So if the last cpu in a node goes
Expand Down

0 comments on commit 8d2f28b

Please sign in to comment.