ksm: more on default values
Adjust the max_kernel_pages default to a quarter of totalram_pages, instead of nr_free_buffer_pages() / 4: the KSM pages themselves come from highmem, and even on a 16GB PAE machine, 4GB of KSM pages would only be pinning 32MB of lowmem with their rmap_items, so no need for the more obscure calculation (nor for its own special init function). There is no way for the user to switch KSM on if CONFIG_SYSFS is not enabled, so in that case default run to KSM_RUN_MERGE. Update KSM Documentation and Kconfig to reflect the new defaults. Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk> Cc: Izik Eidus <ieidus@redhat.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
0eca52a927
commit
c73602ad31
10
mm/ksm.c
10
mm/ksm.c
@@ -184,11 +184,6 @@ 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);
|
||||
@@ -1673,7 +1668,7 @@ static int __init ksm_init(void)
|
||||
struct task_struct *ksm_thread;
|
||||
int err;
|
||||
|
||||
ksm_init_max_kernel_pages();
|
||||
ksm_max_kernel_pages = totalram_pages / 4;
|
||||
|
||||
err = ksm_slab_init();
|
||||
if (err)
|
||||
@@ -1697,6 +1692,9 @@ static int __init ksm_init(void)
|
||||
kthread_stop(ksm_thread);
|
||||
goto out_free2;
|
||||
}
|
||||
#else
|
||||
ksm_run = KSM_RUN_MERGE; /* no way for user to start it */
|
||||
|
||||
#endif /* CONFIG_SYSFS */
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user