Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 199030
b: refs/heads/master
c: db705e8
h: refs/heads/master
v: v3
  • Loading branch information
Heiko Carstens authored and Martin Schwidefsky committed May 26, 2010
1 parent 87ec5b2 commit 489e32d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 54 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: a23ed009a726feeafdbabeaf5f0bde1a3f04d121
refs/heads/master: db705e831ae33fbbeeacf4bb527e0b17de3d6e68
82 changes: 29 additions & 53 deletions trunk/arch/s390/mm/cmm.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/*
* arch/s390/mm/cmm.c
* Collaborative memory management interface.
*
* S390 version
* Copyright (C) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation
* Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
* Copyright IBM Corp 2003,2010
* Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>,
*
* Collaborative memory management interface.
*/

#include <linux/errno.h>
Expand All @@ -20,9 +18,9 @@
#include <linux/kthread.h>
#include <linux/oom.h>
#include <linux/suspend.h>
#include <linux/uaccess.h>

#include <asm/pgalloc.h>
#include <asm/uaccess.h>
#include <asm/diag.h>

static char *sender = "VMRMSVM";
Expand Down Expand Up @@ -59,8 +57,8 @@ static DEFINE_TIMER(cmm_timer, NULL, 0, 0);
static void cmm_timer_fn(unsigned long);
static void cmm_set_timer(void);

static long
cmm_alloc_pages(long nr, long *counter, struct cmm_page_array **list)
static long cmm_alloc_pages(long nr, long *counter,
struct cmm_page_array **list)
{
struct cmm_page_array *pa, *npa;
unsigned long addr;
Expand Down Expand Up @@ -99,8 +97,7 @@ cmm_alloc_pages(long nr, long *counter, struct cmm_page_array **list)
return nr;
}

static long
cmm_free_pages(long nr, long *counter, struct cmm_page_array **list)
static long cmm_free_pages(long nr, long *counter, struct cmm_page_array **list)
{
struct cmm_page_array *pa;
unsigned long addr;
Expand Down Expand Up @@ -140,11 +137,10 @@ static int cmm_oom_notify(struct notifier_block *self,
}

static struct notifier_block cmm_oom_nb = {
.notifier_call = cmm_oom_notify
.notifier_call = cmm_oom_notify,
};

static int
cmm_thread(void *dummy)
static int cmm_thread(void *dummy)
{
int rc;

Expand All @@ -170,22 +166,20 @@ cmm_thread(void *dummy)
cmm_timed_pages_target = cmm_timed_pages;
} else if (cmm_timed_pages_target < cmm_timed_pages) {
cmm_free_pages(1, &cmm_timed_pages,
&cmm_timed_page_list);
&cmm_timed_page_list);
}
if (cmm_timed_pages > 0 && !timer_pending(&cmm_timer))
cmm_set_timer();
}
return 0;
}

static void
cmm_kick_thread(void)
static void cmm_kick_thread(void)
{
wake_up(&cmm_thread_wait);
}

static void
cmm_set_timer(void)
static void cmm_set_timer(void)
{
if (cmm_timed_pages_target <= 0 || cmm_timeout_seconds <= 0) {
if (timer_pending(&cmm_timer))
Expand All @@ -202,8 +196,7 @@ cmm_set_timer(void)
add_timer(&cmm_timer);
}

static void
cmm_timer_fn(unsigned long ignored)
static void cmm_timer_fn(unsigned long ignored)
{
long nr;

Expand All @@ -216,46 +209,41 @@ cmm_timer_fn(unsigned long ignored)
cmm_set_timer();
}

void
cmm_set_pages(long nr)
static void cmm_set_pages(long nr)
{
cmm_pages_target = nr;
cmm_kick_thread();
}

long
cmm_get_pages(void)
static long cmm_get_pages(void)
{
return cmm_pages;
}

void
cmm_add_timed_pages(long nr)
static void cmm_add_timed_pages(long nr)
{
cmm_timed_pages_target += nr;
cmm_kick_thread();
}

long
cmm_get_timed_pages(void)
static long cmm_get_timed_pages(void)
{
return cmm_timed_pages;
}

void
cmm_set_timeout(long nr, long seconds)
static void cmm_set_timeout(long nr, long seconds)
{
cmm_timeout_pages = nr;
cmm_timeout_seconds = seconds;
cmm_set_timer();
}

static int
cmm_skip_blanks(char *cp, char **endp)
static int cmm_skip_blanks(char *cp, char **endp)
{
char *str;

for (str = cp; *str == ' ' || *str == '\t'; str++);
for (str = cp; *str == ' ' || *str == '\t'; str++)
;
*endp = str;
return str != cp;
}
Expand All @@ -264,9 +252,8 @@ cmm_skip_blanks(char *cp, char **endp)

static struct ctl_table cmm_table[];

static int
cmm_pages_handler(ctl_table *ctl, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
static int cmm_pages_handler(ctl_table *ctl, int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
char buf[16], *p;
long nr;
Expand Down Expand Up @@ -305,9 +292,8 @@ cmm_pages_handler(ctl_table *ctl, int write,
return 0;
}

static int
cmm_timeout_handler(ctl_table *ctl, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
static int cmm_timeout_handler(ctl_table *ctl, int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
char buf[64], *p;
long nr, seconds;
Expand Down Expand Up @@ -374,8 +360,7 @@ static struct ctl_table cmm_dir_table[] = {

#ifdef CONFIG_CMM_IUCV
#define SMSG_PREFIX "CMM"
static void
cmm_smsg_target(const char *from, char *msg)
static void cmm_smsg_target(const char *from, char *msg)
{
long nr, seconds;

Expand Down Expand Up @@ -445,8 +430,7 @@ static struct notifier_block cmm_power_notifier = {
.notifier_call = cmm_power_event,
};

static int
cmm_init (void)
static int cmm_init(void)
{
int rc = -ENOMEM;

Expand Down Expand Up @@ -488,9 +472,9 @@ cmm_init (void)
del_timer_sync(&cmm_timer);
return rc;
}
module_init(cmm_init);

static void
cmm_exit(void)
static void cmm_exit(void)
{
#ifdef CONFIG_CMM_PROC
unregister_sysctl_table(cmm_sysctl_header);
Expand All @@ -505,14 +489,6 @@ cmm_exit(void)
cmm_free_pages(cmm_pages, &cmm_pages, &cmm_page_list);
cmm_free_pages(cmm_timed_pages, &cmm_timed_pages, &cmm_timed_page_list);
}

module_init(cmm_init);
module_exit(cmm_exit);

EXPORT_SYMBOL(cmm_set_pages);
EXPORT_SYMBOL(cmm_get_pages);
EXPORT_SYMBOL(cmm_add_timed_pages);
EXPORT_SYMBOL(cmm_get_timed_pages);
EXPORT_SYMBOL(cmm_set_timeout);

MODULE_LICENSE("GPL");

0 comments on commit 489e32d

Please sign in to comment.