|
@@ -57,14 +57,6 @@ static DEFINE_SPINLOCK(pdflush_lock);
|
|
*/
|
|
*/
|
|
int nr_pdflush_threads = 0;
|
|
int nr_pdflush_threads = 0;
|
|
|
|
|
|
-/*
|
|
|
|
- * The max/min number of pdflush threads. R/W by sysctl at
|
|
|
|
- * /proc/sys/vm/nr_pdflush_threads_max/min
|
|
|
|
- */
|
|
|
|
-int nr_pdflush_threads_max __read_mostly = MAX_PDFLUSH_THREADS;
|
|
|
|
-int nr_pdflush_threads_min __read_mostly = MIN_PDFLUSH_THREADS;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* The time at which the pdflush thread pool last went empty
|
|
* The time at which the pdflush thread pool last went empty
|
|
*/
|
|
*/
|
|
@@ -76,7 +68,7 @@ static unsigned long last_empty_jifs;
|
|
* Thread pool management algorithm:
|
|
* Thread pool management algorithm:
|
|
*
|
|
*
|
|
* - The minimum and maximum number of pdflush instances are bound
|
|
* - The minimum and maximum number of pdflush instances are bound
|
|
- * by nr_pdflush_threads_min and nr_pdflush_threads_max.
|
|
|
|
|
|
+ * by MIN_PDFLUSH_THREADS and MAX_PDFLUSH_THREADS.
|
|
*
|
|
*
|
|
* - If there have been no idle pdflush instances for 1 second, create
|
|
* - If there have been no idle pdflush instances for 1 second, create
|
|
* a new one.
|
|
* a new one.
|
|
@@ -142,13 +134,14 @@ static int __pdflush(struct pdflush_work *my_work)
|
|
* To throttle creation, we reset last_empty_jifs.
|
|
* To throttle creation, we reset last_empty_jifs.
|
|
*/
|
|
*/
|
|
if (time_after(jiffies, last_empty_jifs + 1 * HZ)) {
|
|
if (time_after(jiffies, last_empty_jifs + 1 * HZ)) {
|
|
- if (list_empty(&pdflush_list) &&
|
|
|
|
- nr_pdflush_threads < nr_pdflush_threads_max) {
|
|
|
|
- last_empty_jifs = jiffies;
|
|
|
|
- nr_pdflush_threads++;
|
|
|
|
- spin_unlock_irq(&pdflush_lock);
|
|
|
|
- start_one_pdflush_thread();
|
|
|
|
- spin_lock_irq(&pdflush_lock);
|
|
|
|
|
|
+ if (list_empty(&pdflush_list)) {
|
|
|
|
+ if (nr_pdflush_threads < MAX_PDFLUSH_THREADS) {
|
|
|
|
+ last_empty_jifs = jiffies;
|
|
|
|
+ nr_pdflush_threads++;
|
|
|
|
+ spin_unlock_irq(&pdflush_lock);
|
|
|
|
+ start_one_pdflush_thread();
|
|
|
|
+ spin_lock_irq(&pdflush_lock);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -160,7 +153,7 @@ static int __pdflush(struct pdflush_work *my_work)
|
|
*/
|
|
*/
|
|
if (list_empty(&pdflush_list))
|
|
if (list_empty(&pdflush_list))
|
|
continue;
|
|
continue;
|
|
- if (nr_pdflush_threads <= nr_pdflush_threads_min)
|
|
|
|
|
|
+ if (nr_pdflush_threads <= MIN_PDFLUSH_THREADS)
|
|
continue;
|
|
continue;
|
|
pdf = list_entry(pdflush_list.prev, struct pdflush_work, list);
|
|
pdf = list_entry(pdflush_list.prev, struct pdflush_work, list);
|
|
if (time_after(jiffies, pdf->when_i_went_to_sleep + 1 * HZ)) {
|
|
if (time_after(jiffies, pdf->when_i_went_to_sleep + 1 * HZ)) {
|
|
@@ -266,9 +259,9 @@ static int __init pdflush_init(void)
|
|
* Pre-set nr_pdflush_threads... If we fail to create,
|
|
* Pre-set nr_pdflush_threads... If we fail to create,
|
|
* the count will be decremented.
|
|
* the count will be decremented.
|
|
*/
|
|
*/
|
|
- nr_pdflush_threads = nr_pdflush_threads_min;
|
|
|
|
|
|
+ nr_pdflush_threads = MIN_PDFLUSH_THREADS;
|
|
|
|
|
|
- for (i = 0; i < nr_pdflush_threads_min; i++)
|
|
|
|
|
|
+ for (i = 0; i < MIN_PDFLUSH_THREADS; i++)
|
|
start_one_pdflush_thread();
|
|
start_one_pdflush_thread();
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|