Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 123110
b: refs/heads/master
c: fecba96
h: refs/heads/master
v: v3
  • Loading branch information
Brian King authored and Paul Mackerras committed Dec 21, 2008
1 parent d27c51e commit 26246e5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 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: 2218108e182fd8a6d9106077833ed7ad05fc8e75
refs/heads/master: fecba96268fc48ab9b4a016356a8f2371df25e64
29 changes: 28 additions & 1 deletion trunk/arch/powerpc/platforms/pseries/cmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <linux/kthread.h>
#include <linux/module.h>
#include <linux/oom.h>
#include <linux/reboot.h>
#include <linux/sched.h>
#include <linux/stringify.h>
#include <linux/swap.h>
Expand Down Expand Up @@ -383,6 +384,26 @@ static void cmm_unregister_sysfs(struct sys_device *sysdev)
sysdev_class_unregister(&cmm_sysdev_class);
}

/**
* cmm_reboot_notifier - Make sure pages are not still marked as "loaned"
*
**/
static int cmm_reboot_notifier(struct notifier_block *nb,
unsigned long action, void *unused)
{
if (action == SYS_RESTART) {
if (cmm_thread_ptr)
kthread_stop(cmm_thread_ptr);
cmm_thread_ptr = NULL;
cmm_free_pages(loaned_pages);
}
return NOTIFY_DONE;
}

static struct notifier_block cmm_reboot_nb = {
.notifier_call = cmm_reboot_notifier,
};

/**
* cmm_init - Module initialization
*
Expand All @@ -399,9 +420,12 @@ static int cmm_init(void)
if ((rc = register_oom_notifier(&cmm_oom_nb)) < 0)
return rc;

if ((rc = cmm_sysfs_register(&cmm_sysdev)))
if ((rc = register_reboot_notifier(&cmm_reboot_nb)))
goto out_oom_notifier;

if ((rc = cmm_sysfs_register(&cmm_sysdev)))
goto out_reboot_notifier;

if (cmm_disabled)
return rc;

Expand All @@ -415,6 +439,8 @@ static int cmm_init(void)

out_unregister_sysfs:
cmm_unregister_sysfs(&cmm_sysdev);
out_reboot_notifier:
unregister_reboot_notifier(&cmm_reboot_nb);
out_oom_notifier:
unregister_oom_notifier(&cmm_oom_nb);
return rc;
Expand All @@ -431,6 +457,7 @@ static void cmm_exit(void)
if (cmm_thread_ptr)
kthread_stop(cmm_thread_ptr);
unregister_oom_notifier(&cmm_oom_nb);
unregister_reboot_notifier(&cmm_reboot_nb);
cmm_free_pages(loaned_pages);
cmm_unregister_sysfs(&cmm_sysdev);
}
Expand Down

0 comments on commit 26246e5

Please sign in to comment.