diff options
| -rw-r--r-- | Documentation/sysctl/vm.txt | 28 | ||||
| -rw-r--r-- | include/linux/writeback.h | 2 | ||||
| -rw-r--r-- | kernel/sysctl.c | 23 | ||||
| -rw-r--r-- | mm/pdflush.c | 31 |
4 files changed, 12 insertions, 72 deletions
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt index b716d33912d8..c302ddf629a0 100644 --- a/Documentation/sysctl/vm.txt +++ b/Documentation/sysctl/vm.txt | |||
| @@ -39,8 +39,6 @@ Currently, these files are in /proc/sys/vm: | |||
| 39 | - nr_hugepages | 39 | - nr_hugepages |
| 40 | - nr_overcommit_hugepages | 40 | - nr_overcommit_hugepages |
| 41 | - nr_pdflush_threads | 41 | - nr_pdflush_threads |
| 42 | - nr_pdflush_threads_min | ||
| 43 | - nr_pdflush_threads_max | ||
| 44 | - nr_trim_pages (only if CONFIG_MMU=n) | 42 | - nr_trim_pages (only if CONFIG_MMU=n) |
| 45 | - numa_zonelist_order | 43 | - numa_zonelist_order |
| 46 | - oom_dump_tasks | 44 | - oom_dump_tasks |
| @@ -469,32 +467,6 @@ The default value is 0. | |||
| 469 | 467 | ||
| 470 | ============================================================== | 468 | ============================================================== |
| 471 | 469 | ||
| 472 | nr_pdflush_threads_min | ||
| 473 | |||
| 474 | This value controls the minimum number of pdflush threads. | ||
| 475 | |||
| 476 | At boot time, the kernel will create and maintain 'nr_pdflush_threads_min' | ||
| 477 | threads for the kernel's lifetime. | ||
| 478 | |||
| 479 | The default value is 2. The minimum value you can specify is 1, and | ||
| 480 | the maximum value is the current setting of 'nr_pdflush_threads_max'. | ||
| 481 | |||
| 482 | See 'nr_pdflush_threads_max' below for more information. | ||
| 483 | |||
| 484 | ============================================================== | ||
| 485 | |||
| 486 | nr_pdflush_threads_max | ||
| 487 | |||
| 488 | This value controls the maximum number of pdflush threads that can be | ||
| 489 | created. The pdflush algorithm will create a new pdflush thread (up to | ||
| 490 | this maximum) if no pdflush threads have been available for >= 1 second. | ||
| 491 | |||
| 492 | The default value is 8. The minimum value you can specify is the | ||
| 493 | current value of 'nr_pdflush_threads_min' and the | ||
| 494 | maximum is 1000. | ||
| 495 | |||
| 496 | ============================================================== | ||
| 497 | |||
| 498 | overcommit_memory: | 470 | overcommit_memory: |
| 499 | 471 | ||
| 500 | This value contains a flag that enables memory overcommitment. | 472 | This value contains a flag that enables memory overcommitment. |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 9c1ed1fb6ddb..93445477f86a 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
| @@ -168,8 +168,6 @@ void writeback_set_ratelimit(void); | |||
| 168 | /* pdflush.c */ | 168 | /* pdflush.c */ |
| 169 | extern int nr_pdflush_threads; /* Global so it can be exported to sysctl | 169 | extern int nr_pdflush_threads; /* Global so it can be exported to sysctl |
| 170 | read-only. */ | 170 | read-only. */ |
| 171 | extern int nr_pdflush_threads_max; /* Global so it can be exported to sysctl */ | ||
| 172 | extern int nr_pdflush_threads_min; /* Global so it can be exported to sysctl */ | ||
| 173 | 171 | ||
| 174 | 172 | ||
| 175 | #endif /* WRITEBACK_H */ | 173 | #endif /* WRITEBACK_H */ |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index ea78fa101ad6..b2970d56fb76 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
| @@ -101,7 +101,6 @@ static int __maybe_unused one = 1; | |||
| 101 | static int __maybe_unused two = 2; | 101 | static int __maybe_unused two = 2; |
| 102 | static unsigned long one_ul = 1; | 102 | static unsigned long one_ul = 1; |
| 103 | static int one_hundred = 100; | 103 | static int one_hundred = 100; |
| 104 | static int one_thousand = 1000; | ||
| 105 | 104 | ||
| 106 | /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */ | 105 | /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */ |
| 107 | static unsigned long dirty_bytes_min = 2 * PAGE_SIZE; | 106 | static unsigned long dirty_bytes_min = 2 * PAGE_SIZE; |
| @@ -1034,28 +1033,6 @@ static struct ctl_table vm_table[] = { | |||
| 1034 | .proc_handler = &proc_dointvec, | 1033 | .proc_handler = &proc_dointvec, |
| 1035 | }, | 1034 | }, |
| 1036 | { | 1035 | { |
| 1037 | .ctl_name = CTL_UNNUMBERED, | ||
| 1038 | .procname = "nr_pdflush_threads_min", | ||
| 1039 | .data = &nr_pdflush_threads_min, | ||
| 1040 | .maxlen = sizeof nr_pdflush_threads_min, | ||
| 1041 | .mode = 0644 /* read-write */, | ||
| 1042 | .proc_handler = &proc_dointvec_minmax, | ||
| 1043 | .strategy = &sysctl_intvec, | ||
| 1044 | .extra1 = &one, | ||
| 1045 | .extra2 = &nr_pdflush_threads_max, | ||
| 1046 | }, | ||
| 1047 | { | ||
| 1048 | .ctl_name = CTL_UNNUMBERED, | ||
| 1049 | .procname = "nr_pdflush_threads_max", | ||
| 1050 | .data = &nr_pdflush_threads_max, | ||
| 1051 | .maxlen = sizeof nr_pdflush_threads_max, | ||
| 1052 | .mode = 0644 /* read-write */, | ||
| 1053 | .proc_handler = &proc_dointvec_minmax, | ||
| 1054 | .strategy = &sysctl_intvec, | ||
| 1055 | .extra1 = &nr_pdflush_threads_min, | ||
| 1056 | .extra2 = &one_thousand, | ||
| 1057 | }, | ||
| 1058 | { | ||
| 1059 | .ctl_name = VM_SWAPPINESS, | 1036 | .ctl_name = VM_SWAPPINESS, |
| 1060 | .procname = "swappiness", | 1037 | .procname = "swappiness", |
| 1061 | .data = &vm_swappiness, | 1038 | .data = &vm_swappiness, |
diff --git a/mm/pdflush.c b/mm/pdflush.c index f2caf96993f8..235ac440c44e 100644 --- a/mm/pdflush.c +++ b/mm/pdflush.c | |||
| @@ -58,14 +58,6 @@ static DEFINE_SPINLOCK(pdflush_lock); | |||
| 58 | int nr_pdflush_threads = 0; | 58 | int nr_pdflush_threads = 0; |
| 59 | 59 | ||
| 60 | /* | 60 | /* |
| 61 | * The max/min number of pdflush threads. R/W by sysctl at | ||
| 62 | * /proc/sys/vm/nr_pdflush_threads_max/min | ||
| 63 | */ | ||
| 64 | int nr_pdflush_threads_max __read_mostly = MAX_PDFLUSH_THREADS; | ||
| 65 | int nr_pdflush_threads_min __read_mostly = MIN_PDFLUSH_THREADS; | ||
| 66 | |||
| 67 | |||
| 68 | /* | ||
| 69 | * The time at which the pdflush thread pool last went empty | 61 | * The time at which the pdflush thread pool last went empty |
| 70 | */ | 62 | */ |
| 71 | static unsigned long last_empty_jifs; | 63 | static unsigned long last_empty_jifs; |
| @@ -76,7 +68,7 @@ static unsigned long last_empty_jifs; | |||
| 76 | * Thread pool management algorithm: | 68 | * Thread pool management algorithm: |
| 77 | * | 69 | * |
| 78 | * - The minimum and maximum number of pdflush instances are bound | 70 | * - The minimum and maximum number of pdflush instances are bound |
| 79 | * by nr_pdflush_threads_min and nr_pdflush_threads_max. | 71 | * by MIN_PDFLUSH_THREADS and MAX_PDFLUSH_THREADS. |
| 80 | * | 72 | * |
| 81 | * - If there have been no idle pdflush instances for 1 second, create | 73 | * - If there have been no idle pdflush instances for 1 second, create |
| 82 | * a new one. | 74 | * a new one. |
| @@ -142,13 +134,14 @@ static int __pdflush(struct pdflush_work *my_work) | |||
| 142 | * To throttle creation, we reset last_empty_jifs. | 134 | * To throttle creation, we reset last_empty_jifs. |
| 143 | */ | 135 | */ |
| 144 | if (time_after(jiffies, last_empty_jifs + 1 * HZ)) { | 136 | if (time_after(jiffies, last_empty_jifs + 1 * HZ)) { |
| 145 | if (list_empty(&pdflush_list) && | 137 | if (list_empty(&pdflush_list)) { |
| 146 | nr_pdflush_threads < nr_pdflush_threads_max) { | 138 | if (nr_pdflush_threads < MAX_PDFLUSH_THREADS) { |
| 147 | last_empty_jifs = jiffies; | 139 | last_empty_jifs = jiffies; |
| 148 | nr_pdflush_threads++; | 140 | nr_pdflush_threads++; |
| 149 | spin_unlock_irq(&pdflush_lock); | 141 | spin_unlock_irq(&pdflush_lock); |
| 150 | start_one_pdflush_thread(); | 142 | start_one_pdflush_thread(); |
| 151 | spin_lock_irq(&pdflush_lock); | 143 | spin_lock_irq(&pdflush_lock); |
| 144 | } | ||
| 152 | } | 145 | } |
| 153 | } | 146 | } |
| 154 | 147 | ||
| @@ -160,7 +153,7 @@ static int __pdflush(struct pdflush_work *my_work) | |||
| 160 | */ | 153 | */ |
| 161 | if (list_empty(&pdflush_list)) | 154 | if (list_empty(&pdflush_list)) |
| 162 | continue; | 155 | continue; |
| 163 | if (nr_pdflush_threads <= nr_pdflush_threads_min) | 156 | if (nr_pdflush_threads <= MIN_PDFLUSH_THREADS) |
| 164 | continue; | 157 | continue; |
| 165 | pdf = list_entry(pdflush_list.prev, struct pdflush_work, list); | 158 | pdf = list_entry(pdflush_list.prev, struct pdflush_work, list); |
| 166 | if (time_after(jiffies, pdf->when_i_went_to_sleep + 1 * HZ)) { | 159 | if (time_after(jiffies, pdf->when_i_went_to_sleep + 1 * HZ)) { |
| @@ -266,9 +259,9 @@ static int __init pdflush_init(void) | |||
| 266 | * Pre-set nr_pdflush_threads... If we fail to create, | 259 | * Pre-set nr_pdflush_threads... If we fail to create, |
| 267 | * the count will be decremented. | 260 | * the count will be decremented. |
| 268 | */ | 261 | */ |
| 269 | nr_pdflush_threads = nr_pdflush_threads_min; | 262 | nr_pdflush_threads = MIN_PDFLUSH_THREADS; |
| 270 | 263 | ||
| 271 | for (i = 0; i < nr_pdflush_threads_min; i++) | 264 | for (i = 0; i < MIN_PDFLUSH_THREADS; i++) |
| 272 | start_one_pdflush_thread(); | 265 | start_one_pdflush_thread(); |
| 273 | return 0; | 266 | return 0; |
| 274 | } | 267 | } |
