[PATCH v2 02/16] MM: Added page swapping markers to memory management
From: Venkatraman S
Date: Thu May 03 2012 - 10:30:55 EST
From: Ilan Smith <ilan.smith@xxxxxxxxxxx>
Add attribute to identify swapin requests
Mark memory management requests with swapin requests
Signed-off-by: Ilan Smith <ilan.smith@xxxxxxxxxxx>
Signed-off-by: Alex Lemberg <alex.lemberg@xxxxxxxxxxx>
Signed-off-by: Venkatraman S <svenkatr@xxxxxx>
---
include/linux/bio.h | 1 +
include/linux/blk_types.h | 2 ++
mm/page_io.c | 3 ++-
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 264e0ef..8494b2f 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -63,6 +63,7 @@ static inline bool bio_rw_flagged(struct bio *bio, unsigned long flag)
}
#define bio_dmpg(bio) bio_rw_flagged(bio, REQ_RW_DMPG)
+#define bio_swapin(bio) bio_rw_flagged(bio, REQ_RW_SWAPIN)
/*
* various member access, note that bio_data should of course not be used
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 87feb80..df2b9ea 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -151,6 +151,7 @@ enum rq_flag_bits {
__REQ_IO_STAT, /* account I/O stat */
__REQ_MIXED_MERGE, /* merge of different types, fail separately */
__REQ_RW_DMPG,
+ __REQ_RW_SWAPIN,
__REQ_NR_BITS, /* stops here */
};
@@ -193,5 +194,6 @@ enum rq_flag_bits {
#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE)
#define REQ_SECURE (1 << __REQ_SECURE)
#define REQ_RW_DMPG (1 << __REQ_RW_DMPG)
+#define REQ_RW_SWAPIN (1 << __REQ_RW_SWAPIN)
#endif /* __LINUX_BLK_TYPES_H */
diff --git a/mm/page_io.c b/mm/page_io.c
index dc76b4d..a148bea 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -128,8 +128,9 @@ int swap_readpage(struct page *page)
ret = -ENOMEM;
goto out;
}
+ bio->bi_rw |= REQ_RW_SWAPIN;
count_vm_event(PSWPIN);
- submit_bio(READ, bio);
+ submit_bio(READ | REQ_RW_SWAPIN, bio);
out:
return ret;
}
--
1.7.10.rc2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/