Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 165642
b: refs/heads/master
c: 2c6854f
h: refs/heads/master
v: v3
  • Loading branch information
Izik Eidus authored and Linus Torvalds committed Sep 24, 2009
1 parent 283c049 commit e50c7ee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 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: d2b5ec3aa0784335f031239e71fb50924cac9e0d
refs/heads/master: 2c6854fdadf940678fd54779b778f6faafb870bb
14 changes: 11 additions & 3 deletions trunk/mm/ksm.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <linux/slab.h>
#include <linux/rbtree.h>
#include <linux/mmu_notifier.h>
#include <linux/swap.h>
#include <linux/ksm.h>

#include <asm/tlbflush.h>
Expand Down Expand Up @@ -162,18 +163,18 @@ static unsigned long ksm_pages_unshared;
static unsigned long ksm_rmap_items;

/* Limit on the number of unswappable pages used */
static unsigned long ksm_max_kernel_pages = 2000;
static unsigned long ksm_max_kernel_pages;

/* Number of pages ksmd should scan in one batch */
static unsigned int ksm_thread_pages_to_scan = 200;
static unsigned int ksm_thread_pages_to_scan = 100;

/* Milliseconds ksmd should sleep between batches */
static unsigned int ksm_thread_sleep_millisecs = 20;

#define KSM_RUN_STOP 0
#define KSM_RUN_MERGE 1
#define KSM_RUN_UNMERGE 2
static unsigned int ksm_run = KSM_RUN_MERGE;
static unsigned int ksm_run = KSM_RUN_STOP;

static DECLARE_WAIT_QUEUE_HEAD(ksm_thread_wait);
static DEFINE_MUTEX(ksm_thread_mutex);
Expand All @@ -183,6 +184,11 @@ static DEFINE_SPINLOCK(ksm_mmlist_lock);
sizeof(struct __struct), __alignof__(struct __struct),\
(__flags), NULL)

static void __init ksm_init_max_kernel_pages(void)
{
ksm_max_kernel_pages = nr_free_buffer_pages() / 4;
}

static int __init ksm_slab_init(void)
{
rmap_item_cache = KSM_KMEM_CACHE(rmap_item, 0);
Expand Down Expand Up @@ -1667,6 +1673,8 @@ static int __init ksm_init(void)
struct task_struct *ksm_thread;
int err;

ksm_init_max_kernel_pages();

err = ksm_slab_init();
if (err)
goto out;
Expand Down

0 comments on commit e50c7ee

Please sign in to comment.