Skip to content

Commit 3965c9a

Browse files
Wanpeng Litorvalds
authored andcommitted
mm: prepare for removal of obsolete /proc/sys/vm/nr_pdflush_threads
Since per-BDI flusher threads were introduced in 2.6, the pdflush mechanism is not used any more. But the old interface exported through /proc/sys/vm/nr_pdflush_threads still exists and is obviously useless. For back-compatibility, printk warning information and return 2 to notify the users that the interface is removed. Signed-off-by: Wanpeng Li <liwp@linux.vnet.ibm.com> Cc: Wu Fengguang <fengguang.wu@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent deaf386 commit 3965c9a

9 files changed

Lines changed: 40 additions & 27 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
What: /proc/sys/vm/nr_pdflush_threads
2+
Date: June 2012
3+
Contact: Wanpeng Li <liwp@linux.vnet.ibm.com>
4+
Description: Since pdflush is replaced by per-BDI flusher, the interface of old pdflush
5+
exported in /proc/sys/vm/ should be removed.

Documentation/feature-removal-schedule.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ Who: Jim Cromie <jim.cromie@gmail.com>, Jason Baron <jbaron@redhat.com>
1313

1414
---------------------------
1515

16+
What: /proc/sys/vm/nr_pdflush_threads
17+
When: 2012
18+
Why: Since pdflush is deprecated, the interface exported in /proc/sys/vm/
19+
should be removed.
20+
Who: Wanpeng Li <liwp@linux.vnet.ibm.com>
21+
22+
---------------------------
23+
1624
What: CONFIG_APM_CPU_IDLE, and its ability to call APM BIOS in idle
1725
When: 2012
1826
Why: This optional sub-feature of APM is of dubious reliability,

Documentation/sysctl/vm.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ Currently, these files are in /proc/sys/vm:
4242
- mmap_min_addr
4343
- nr_hugepages
4444
- nr_overcommit_hugepages
45-
- nr_pdflush_threads
4645
- nr_trim_pages (only if CONFIG_MMU=n)
4746
- numa_zonelist_order
4847
- oom_dump_tasks
@@ -426,16 +425,6 @@ See Documentation/vm/hugetlbpage.txt
426425

427426
==============================================================
428427

429-
nr_pdflush_threads
430-
431-
The current number of pdflush threads. This value is read-only.
432-
The value changes according to the number of dirty pages in the system.
433-
434-
When necessary, additional pdflush threads are created, one per second, up to
435-
nr_pdflush_threads_max.
436-
437-
==============================================================
438-
439428
nr_trim_pages
440429

441430
This is available only on NOMMU kernels.

fs/fs-writeback.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ struct wb_writeback_work {
5252
struct completion *done; /* set if the caller waits */
5353
};
5454

55-
/*
56-
* We don't actually have pdflush, but this one is exported though /proc...
57-
*/
58-
int nr_pdflush_threads;
59-
6055
/**
6156
* writeback_in_progress - determine whether there is writeback in progress
6257
* @bdi: the device's backing_dev_info structure.

include/linux/backing-dev.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/timer.h>
1818
#include <linux/writeback.h>
1919
#include <linux/atomic.h>
20+
#include <linux/sysctl.h>
2021

2122
struct page;
2223
struct device;
@@ -304,6 +305,8 @@ void clear_bdi_congested(struct backing_dev_info *bdi, int sync);
304305
void set_bdi_congested(struct backing_dev_info *bdi, int sync);
305306
long congestion_wait(int sync, long timeout);
306307
long wait_iff_congested(struct zone *zone, int sync, long timeout);
308+
int pdflush_proc_obsolete(struct ctl_table *table, int write,
309+
void __user *buffer, size_t *lenp, loff_t *ppos);
307310

308311
static inline bool bdi_cap_writeback_dirty(struct backing_dev_info *bdi)
309312
{

include/linux/writeback.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,4 @@ void tag_pages_for_writeback(struct address_space *mapping,
189189

190190
void account_page_redirty(struct page *page);
191191

192-
/* pdflush.c */
193-
extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
194-
read-only. */
195-
196-
197192
#endif /* WRITEBACK_H */

kernel/sysctl.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,11 +1101,9 @@ static struct ctl_table vm_table[] = {
11011101
.extra1 = &zero,
11021102
},
11031103
{
1104-
.procname = "nr_pdflush_threads",
1105-
.data = &nr_pdflush_threads,
1106-
.maxlen = sizeof nr_pdflush_threads,
1107-
.mode = 0444 /* read-only*/,
1108-
.proc_handler = proc_dointvec,
1104+
.procname = "nr_pdflush_threads",
1105+
.mode = 0444 /* read-only */,
1106+
.proc_handler = pdflush_proc_obsolete,
11091107
},
11101108
{
11111109
.procname = "swappiness",

kernel/sysctl_binary.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ static const struct bin_table bin_vm_table[] = {
147147
{ CTL_INT, VM_DIRTY_RATIO, "dirty_ratio" },
148148
/* VM_DIRTY_WB_CS "dirty_writeback_centisecs" no longer used */
149149
/* VM_DIRTY_EXPIRE_CS "dirty_expire_centisecs" no longer used */
150-
{ CTL_INT, VM_NR_PDFLUSH_THREADS, "nr_pdflush_threads" },
150+
/* VM_NR_PDFLUSH_THREADS "nr_pdflush_threads" no longer used */
151151
{ CTL_INT, VM_OVERCOMMIT_RATIO, "overcommit_ratio" },
152152
/* VM_PAGEBUF unused */
153153
/* VM_HUGETLB_PAGES "nr_hugepages" no longer used */

mm/backing-dev.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,3 +886,23 @@ long wait_iff_congested(struct zone *zone, int sync, long timeout)
886886
return ret;
887887
}
888888
EXPORT_SYMBOL(wait_iff_congested);
889+
890+
int pdflush_proc_obsolete(struct ctl_table *table, int write,
891+
void __user *buffer, size_t *lenp, loff_t *ppos)
892+
{
893+
char kbuf[] = "0\n";
894+
895+
if (*ppos) {
896+
*lenp = 0;
897+
return 0;
898+
}
899+
900+
if (copy_to_user(buffer, kbuf, sizeof(kbuf)))
901+
return -EFAULT;
902+
printk_once(KERN_WARNING "%s exported in /proc is scheduled for removal\n",
903+
table->procname);
904+
905+
*lenp = 2;
906+
*ppos += *lenp;
907+
return 2;
908+
}

0 commit comments

Comments
 (0)