Skip to content

Commit cd17cbf

Browse files
author
Jens Axboe
committed
Revert "mm: add /proc controls for pdflush threads"
This reverts commit fafd688. Work is progressing to switch away from pdflush as the process backing for flushing out dirty data. So it seems pointless to add more knobs to control pdflush threads. The original author of the patch did not have any specific use cases for adding the knobs, so we can easily revert this before 2.6.30 to avoid having to maintain this API forever. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
1 parent 05dc7b6 commit cd17cbf

4 files changed

Lines changed: 12 additions & 72 deletions

File tree

‎Documentation/sysctl/vm.txt‎

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ Currently, these files are in /proc/sys/vm:
3939
- nr_hugepages
4040
- nr_overcommit_hugepages
4141
- nr_pdflush_threads
42-
- nr_pdflush_threads_min
43-
- nr_pdflush_threads_max
4442
- nr_trim_pages (only if CONFIG_MMU=n)
4543
- numa_zonelist_order
4644
- oom_dump_tasks
@@ -469,32 +467,6 @@ The default value is 0.
469467

470468
==============================================================
471469

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-
498470
overcommit_memory:
499471

500472
This value contains a flag that enables memory overcommitment.

‎include/linux/writeback.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,6 @@ void writeback_set_ratelimit(void);
168168
/* pdflush.c */
169169
extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
170170
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 */
173171

174172

175173
#endif /* WRITEBACK_H */

‎kernel/sysctl.c‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ static int __maybe_unused one = 1;
101101
static int __maybe_unused two = 2;
102102
static unsigned long one_ul = 1;
103103
static int one_hundred = 100;
104-
static int one_thousand = 1000;
105104

106105
/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
107106
static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
@@ -1033,28 +1032,6 @@ static struct ctl_table vm_table[] = {
10331032
.mode = 0444 /* read-only*/,
10341033
.proc_handler = &proc_dointvec,
10351034
},
1036-
{
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-
},
10581035
{
10591036
.ctl_name = VM_SWAPPINESS,
10601037
.procname = "swappiness",

‎mm/pdflush.c‎

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,6 @@ static DEFINE_SPINLOCK(pdflush_lock);
5757
*/
5858
int nr_pdflush_threads = 0;
5959

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-
6860
/*
6961
* The time at which the pdflush thread pool last went empty
7062
*/
@@ -76,7 +68,7 @@ static unsigned long last_empty_jifs;
7668
* Thread pool management algorithm:
7769
*
7870
* - 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.
8072
*
8173
* - If there have been no idle pdflush instances for 1 second, create
8274
* a new one.
@@ -142,13 +134,14 @@ static int __pdflush(struct pdflush_work *my_work)
142134
* To throttle creation, we reset last_empty_jifs.
143135
*/
144136
if (time_after(jiffies, last_empty_jifs + 1 * HZ)) {
145-
if (list_empty(&pdflush_list) &&
146-
nr_pdflush_threads < nr_pdflush_threads_max) {
147-
last_empty_jifs = jiffies;
148-
nr_pdflush_threads++;
149-
spin_unlock_irq(&pdflush_lock);
150-
start_one_pdflush_thread();
151-
spin_lock_irq(&pdflush_lock);
137+
if (list_empty(&pdflush_list)) {
138+
if (nr_pdflush_threads < MAX_PDFLUSH_THREADS) {
139+
last_empty_jifs = jiffies;
140+
nr_pdflush_threads++;
141+
spin_unlock_irq(&pdflush_lock);
142+
start_one_pdflush_thread();
143+
spin_lock_irq(&pdflush_lock);
144+
}
152145
}
153146
}
154147

@@ -160,7 +153,7 @@ static int __pdflush(struct pdflush_work *my_work)
160153
*/
161154
if (list_empty(&pdflush_list))
162155
continue;
163-
if (nr_pdflush_threads <= nr_pdflush_threads_min)
156+
if (nr_pdflush_threads <= MIN_PDFLUSH_THREADS)
164157
continue;
165158
pdf = list_entry(pdflush_list.prev, struct pdflush_work, list);
166159
if (time_after(jiffies, pdf->when_i_went_to_sleep + 1 * HZ)) {
@@ -266,9 +259,9 @@ static int __init pdflush_init(void)
266259
* Pre-set nr_pdflush_threads... If we fail to create,
267260
* the count will be decremented.
268261
*/
269-
nr_pdflush_threads = nr_pdflush_threads_min;
262+
nr_pdflush_threads = MIN_PDFLUSH_THREADS;
270263

271-
for (i = 0; i < nr_pdflush_threads_min; i++)
264+
for (i = 0; i < MIN_PDFLUSH_THREADS; i++)
272265
start_one_pdflush_thread();
273266
return 0;
274267
}

0 commit comments

Comments
 (0)