diff options
author | Christoph Lameter <clameter@sgi.com> | 2006-01-08 04:00:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-08 23:12:41 -0500 |
commit | 930d915252edda7042c944ed3c30194a2f9fe163 (patch) | |
tree | 620452f11a9949943765b7a28e5b919f40f32b12 | |
parent | 21eac81f252fe31c3cf64b805a1e8652192f3a3b (diff) |
[PATCH] Swap Migration V5: PF_SWAPWRITE to allow writing to swap
Add PF_SWAPWRITE to control a processes permission to write to swap.
- Use PF_SWAPWRITE in may_write_to_queue() instead of checking for kswapd
and pdflush
- Set PF_SWAPWRITE flag for kswapd and pdflush
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | include/linux/sched.h | 1 | ||||
-rw-r--r-- | mm/pdflush.c | 2 | ||||
-rw-r--r-- | mm/vmscan.c | 6 |
3 files changed, 4 insertions, 5 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 7da33619d5d0..a74662077d60 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -895,6 +895,7 @@ do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0) | |||
895 | #define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */ | 895 | #define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */ |
896 | #define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */ | 896 | #define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */ |
897 | #define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */ | 897 | #define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */ |
898 | #define PF_SWAPWRITE 0x01000000 /* Allowed to write to swap */ | ||
898 | 899 | ||
899 | /* | 900 | /* |
900 | * Only the _current_ task can read/write to tsk->flags, but other | 901 | * Only the _current_ task can read/write to tsk->flags, but other |
diff --git a/mm/pdflush.c b/mm/pdflush.c index 52822c98c489..c4b6d0afd736 100644 --- a/mm/pdflush.c +++ b/mm/pdflush.c | |||
@@ -90,7 +90,7 @@ struct pdflush_work { | |||
90 | 90 | ||
91 | static int __pdflush(struct pdflush_work *my_work) | 91 | static int __pdflush(struct pdflush_work *my_work) |
92 | { | 92 | { |
93 | current->flags |= PF_FLUSHER; | 93 | current->flags |= PF_FLUSHER | PF_SWAPWRITE; |
94 | my_work->fn = NULL; | 94 | my_work->fn = NULL; |
95 | my_work->who = current; | 95 | my_work->who = current; |
96 | INIT_LIST_HEAD(&my_work->list); | 96 | INIT_LIST_HEAD(&my_work->list); |
diff --git a/mm/vmscan.c b/mm/vmscan.c index 261a56ee11b6..6c30a8c59795 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -268,9 +268,7 @@ static inline int is_page_cache_freeable(struct page *page) | |||
268 | 268 | ||
269 | static int may_write_to_queue(struct backing_dev_info *bdi) | 269 | static int may_write_to_queue(struct backing_dev_info *bdi) |
270 | { | 270 | { |
271 | if (current_is_kswapd()) | 271 | if (current->flags & PF_SWAPWRITE) |
272 | return 1; | ||
273 | if (current_is_pdflush()) /* This is unlikely, but why not... */ | ||
274 | return 1; | 272 | return 1; |
275 | if (!bdi_write_congested(bdi)) | 273 | if (!bdi_write_congested(bdi)) |
276 | return 1; | 274 | return 1; |
@@ -1299,7 +1297,7 @@ static int kswapd(void *p) | |||
1299 | * us from recursively trying to free more memory as we're | 1297 | * us from recursively trying to free more memory as we're |
1300 | * trying to free the first piece of memory in the first place). | 1298 | * trying to free the first piece of memory in the first place). |
1301 | */ | 1299 | */ |
1302 | tsk->flags |= PF_MEMALLOC|PF_KSWAPD; | 1300 | tsk->flags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD; |
1303 | 1301 | ||
1304 | order = 0; | 1302 | order = 0; |
1305 | for ( ; ; ) { | 1303 | for ( ; ; ) { |