aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorHugh Dickins <hugh.dickins@tiscali.co.uk>2009-12-14 20:59:34 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-15 11:53:20 -0500
commitd0f209f68f80f9a152799760c230019e7f270b2a (patch)
tree83e4a6b2e15f50738572b31cfadb5fc0db17d2b7 /mm
parent62b61f611eb5e20f7e9f8619bfd03bdfe8af6348 (diff)
ksm: remove unswappable max_kernel_pages
Now that ksm pages are swappable, and the known holes plugged, remove mention of unswappable kernel pages from KSM documentation and comments. Remove the totalram_pages/4 initialization of max_kernel_pages. In fact, remove max_kernel_pages altogether - we can reinstate it if removal turns out to break someone's script; but if we later want to limit KSM's memory usage, limiting the stable nodes would not be an effective approach. Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk> Cc: Izik Eidus <ieidus@redhat.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Chris Wright <chrisw@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/Kconfig2
-rw-r--r--mm/ksm.c41
2 files changed, 3 insertions, 40 deletions
diff --git a/mm/Kconfig b/mm/Kconfig
index d4b5fff6ea09..2310984591ed 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -212,7 +212,7 @@ config KSM
212 Enable Kernel Samepage Merging: KSM periodically scans those areas 212 Enable Kernel Samepage Merging: KSM periodically scans those areas
213 of an application's address space that an app has advised may be 213 of an application's address space that an app has advised may be
214 mergeable. When it finds pages of identical content, it replaces 214 mergeable. When it finds pages of identical content, it replaces
215 the many instances by a single resident page with that content, so 215 the many instances by a single page with that content, so
216 saving memory until one or another app needs to modify the content. 216 saving memory until one or another app needs to modify the content.
217 Recommended for use with KVM, or with other duplicative applications. 217 Recommended for use with KVM, or with other duplicative applications.
218 See Documentation/vm/ksm.txt for more information: KSM is inactive 218 See Documentation/vm/ksm.txt for more information: KSM is inactive
diff --git a/mm/ksm.c b/mm/ksm.c
index d4c228a9d278..56a0da1f9979 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -179,9 +179,6 @@ static unsigned long ksm_pages_unshared;
179/* The number of rmap_items in use: to calculate pages_volatile */ 179/* The number of rmap_items in use: to calculate pages_volatile */
180static unsigned long ksm_rmap_items; 180static unsigned long ksm_rmap_items;
181 181
182/* Limit on the number of unswappable pages used */
183static unsigned long ksm_max_kernel_pages;
184
185/* Number of pages ksmd should scan in one batch */ 182/* Number of pages ksmd should scan in one batch */
186static unsigned int ksm_thread_pages_to_scan = 100; 183static unsigned int ksm_thread_pages_to_scan = 100;
187 184
@@ -943,14 +940,6 @@ static struct page *try_to_merge_two_pages(struct rmap_item *rmap_item,
943{ 940{
944 int err; 941 int err;
945 942
946 /*
947 * The number of nodes in the stable tree
948 * is the number of kernel pages that we hold.
949 */
950 if (ksm_max_kernel_pages &&
951 ksm_max_kernel_pages <= ksm_pages_shared)
952 return NULL;
953
954 err = try_to_merge_with_ksm_page(rmap_item, page, NULL); 943 err = try_to_merge_with_ksm_page(rmap_item, page, NULL);
955 if (!err) { 944 if (!err) {
956 err = try_to_merge_with_ksm_page(tree_rmap_item, 945 err = try_to_merge_with_ksm_page(tree_rmap_item,
@@ -1850,8 +1839,8 @@ static ssize_t run_store(struct kobject *kobj, struct kobj_attribute *attr,
1850 /* 1839 /*
1851 * KSM_RUN_MERGE sets ksmd running, and 0 stops it running. 1840 * KSM_RUN_MERGE sets ksmd running, and 0 stops it running.
1852 * KSM_RUN_UNMERGE stops it running and unmerges all rmap_items, 1841 * KSM_RUN_UNMERGE stops it running and unmerges all rmap_items,
1853 * breaking COW to free the unswappable pages_shared (but leaves 1842 * breaking COW to free the pages_shared (but leaves mm_slots
1854 * mm_slots on the list for when ksmd may be set running again). 1843 * on the list for when ksmd may be set running again).
1855 */ 1844 */
1856 1845
1857 mutex_lock(&ksm_thread_mutex); 1846 mutex_lock(&ksm_thread_mutex);
@@ -1876,29 +1865,6 @@ static ssize_t run_store(struct kobject *kobj, struct kobj_attribute *attr,
1876} 1865}
1877KSM_ATTR(run); 1866KSM_ATTR(run);
1878 1867
1879static ssize_t max_kernel_pages_store(struct kobject *kobj,
1880 struct kobj_attribute *attr,
1881 const char *buf, size_t count)
1882{
1883 int err;
1884 unsigned long nr_pages;
1885
1886 err = strict_strtoul(buf, 10, &nr_pages);
1887 if (err)
1888 return -EINVAL;
1889
1890 ksm_max_kernel_pages = nr_pages;
1891
1892 return count;
1893}
1894
1895static ssize_t max_kernel_pages_show(struct kobject *kobj,
1896 struct kobj_attribute *attr, char *buf)
1897{
1898 return sprintf(buf, "%lu\n", ksm_max_kernel_pages);
1899}
1900KSM_ATTR(max_kernel_pages);
1901
1902static ssize_t pages_shared_show(struct kobject *kobj, 1868static ssize_t pages_shared_show(struct kobject *kobj,
1903 struct kobj_attribute *attr, char *buf) 1869 struct kobj_attribute *attr, char *buf)
1904{ 1870{
@@ -1948,7 +1914,6 @@ static struct attribute *ksm_attrs[] = {
1948 &sleep_millisecs_attr.attr, 1914 &sleep_millisecs_attr.attr,
1949 &pages_to_scan_attr.attr, 1915 &pages_to_scan_attr.attr,
1950 &run_attr.attr, 1916 &run_attr.attr,
1951 &max_kernel_pages_attr.attr,
1952 &pages_shared_attr.attr, 1917 &pages_shared_attr.attr,
1953 &pages_sharing_attr.attr, 1918 &pages_sharing_attr.attr,
1954 &pages_unshared_attr.attr, 1919 &pages_unshared_attr.attr,
@@ -1968,8 +1933,6 @@ static int __init ksm_init(void)
1968 struct task_struct *ksm_thread; 1933 struct task_struct *ksm_thread;
1969 int err; 1934 int err;
1970 1935
1971 ksm_max_kernel_pages = totalram_pages / 4;
1972
1973 err = ksm_slab_init(); 1936 err = ksm_slab_init();
1974 if (err) 1937 if (err)
1975 goto out; 1938 goto out;