diff options
Diffstat (limited to 'mm/ksm.c')
-rw-r--r-- | mm/ksm.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -184,11 +184,6 @@ static DEFINE_SPINLOCK(ksm_mmlist_lock); | |||
184 | sizeof(struct __struct), __alignof__(struct __struct),\ | 184 | sizeof(struct __struct), __alignof__(struct __struct),\ |
185 | (__flags), NULL) | 185 | (__flags), NULL) |
186 | 186 | ||
187 | static void __init ksm_init_max_kernel_pages(void) | ||
188 | { | ||
189 | ksm_max_kernel_pages = nr_free_buffer_pages() / 4; | ||
190 | } | ||
191 | |||
192 | static int __init ksm_slab_init(void) | 187 | static int __init ksm_slab_init(void) |
193 | { | 188 | { |
194 | rmap_item_cache = KSM_KMEM_CACHE(rmap_item, 0); | 189 | rmap_item_cache = KSM_KMEM_CACHE(rmap_item, 0); |
@@ -1017,6 +1012,7 @@ static struct rmap_item *unstable_tree_search_insert(struct page *page, | |||
1017 | struct rmap_item *tree_rmap_item; | 1012 | struct rmap_item *tree_rmap_item; |
1018 | int ret; | 1013 | int ret; |
1019 | 1014 | ||
1015 | cond_resched(); | ||
1020 | tree_rmap_item = rb_entry(*new, struct rmap_item, node); | 1016 | tree_rmap_item = rb_entry(*new, struct rmap_item, node); |
1021 | page2[0] = get_mergeable_page(tree_rmap_item); | 1017 | page2[0] = get_mergeable_page(tree_rmap_item); |
1022 | if (!page2[0]) | 1018 | if (!page2[0]) |
@@ -1673,7 +1669,7 @@ static int __init ksm_init(void) | |||
1673 | struct task_struct *ksm_thread; | 1669 | struct task_struct *ksm_thread; |
1674 | int err; | 1670 | int err; |
1675 | 1671 | ||
1676 | ksm_init_max_kernel_pages(); | 1672 | ksm_max_kernel_pages = totalram_pages / 4; |
1677 | 1673 | ||
1678 | err = ksm_slab_init(); | 1674 | err = ksm_slab_init(); |
1679 | if (err) | 1675 | if (err) |
@@ -1697,6 +1693,9 @@ static int __init ksm_init(void) | |||
1697 | kthread_stop(ksm_thread); | 1693 | kthread_stop(ksm_thread); |
1698 | goto out_free2; | 1694 | goto out_free2; |
1699 | } | 1695 | } |
1696 | #else | ||
1697 | ksm_run = KSM_RUN_MERGE; /* no way for user to start it */ | ||
1698 | |||
1700 | #endif /* CONFIG_SYSFS */ | 1699 | #endif /* CONFIG_SYSFS */ |
1701 | 1700 | ||
1702 | return 0; | 1701 | return 0; |