Skip to content

Commit 539a6fe

Browse files
minchanktorvalds
authored andcommitted
mm, swap: introduce SWP_SYNCHRONOUS_IO
If rw-page based fast storage is used for swap devices, we need to detect it to enhance swap IO operations. This patch is preparation for optimizing of swap-in operation with next patch. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Minchan Kim <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Dan Williams <[email protected]> Cc: Ilya Dryomov <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Ross Zwisler <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Cc: Huang Ying <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 23c47d2 commit 539a6fe

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

include/linux/swap.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,9 @@ enum {
171171
SWP_AREA_DISCARD = (1 << 8), /* single-time swap area discards */
172172
SWP_PAGE_DISCARD = (1 << 9), /* freed swap page-cluster discards */
173173
SWP_STABLE_WRITES = (1 << 10), /* no overwrite PG_writeback pages */
174+
SWP_SYNCHRONOUS_IO = (1 << 11), /* synchronous IO is efficient */
174175
/* add others here before... */
175-
SWP_SCANNING = (1 << 11), /* refcount in scan_swap_map */
176+
SWP_SCANNING = (1 << 12), /* refcount in scan_swap_map */
176177
};
177178

178179
#define SWAP_CLUSTER_MAX 32UL

mm/swapfile.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3169,6 +3169,9 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
31693169
if (bdi_cap_stable_pages_required(inode_to_bdi(inode)))
31703170
p->flags |= SWP_STABLE_WRITES;
31713171

3172+
if (bdi_cap_synchronous_io(inode_to_bdi(inode)))
3173+
p->flags |= SWP_SYNCHRONOUS_IO;
3174+
31723175
if (p->bdev && blk_queue_nonrot(bdev_get_queue(p->bdev))) {
31733176
int cpu;
31743177
unsigned long ci, nr_cluster;

0 commit comments

Comments
 (0)