* [PATCH v2 0/7] Replace rw_page with on-stack bio
@ 2017-08-11 5:17 Minchan Kim
2017-08-11 5:17 ` [PATCH v2 1/7] zram: set BDI_CAP_STABLE_WRITES once Minchan Kim
` (6 more replies)
0 siblings, 7 replies; 12+ messages in thread
From: Minchan Kim @ 2017-08-11 5:17 UTC (permalink / raw)
To: Andrew Morton
Cc: Jens Axboe, jack, linux-nvdimm, Dave Chinner, Minchan Kim,
linux-kernel, Matthew Wilcox, Christoph Hellwig, linux-mm,
kernel-team, seungho1.park, karam . lee
Recently, there was a dicussion about removing rw_page due to maintainance
burden[1] but the problem was zram because zram has a clear win for the
benchmark at that time. The reason why only zram have a win is due to
bio allocation wait time from mempool under extreme memory pressure.
Christoph Hellwig suggested we can use on-stack-bio for rw_page devices.
This patch implements it and replace rw_page operations with on-stack-bio
and then finally, remove rw_page interface completely.
This patch is based on linux-next-20170804
[1] http://lkml.kernel.org/r/<20170728165604.10455-1-ross.zwisler@linux.intel.com>
* from v1
* Fix trivial mistake
* simplify on-stack bio code - Matthew
Minchan Kim (7):
zram: set BDI_CAP_STABLE_WRITES once
bdi: introduce BDI_CAP_SYNCHRONOUS_IO
fs: use on-stack-bio if backing device has BDI_CAP_SYNCHRONOUS
capability
mm:swap: remove end_swap_bio_write argument
mm:swap: use on-stack-bio for BDI_CAP_SYNCHRONOUS device
zram: remove zram_rw_page
fs: remove rw_page
drivers/block/brd.c | 2 +
drivers/block/zram/zram_drv.c | 68 +++-----------------------------
drivers/nvdimm/btt.c | 3 ++
drivers/nvdimm/pmem.c | 2 +
fs/block_dev.c | 76 ------------------------------------
fs/mpage.c | 56 ++++++++++++++++++---------
include/linux/backing-dev.h | 8 ++++
include/linux/blkdev.h | 4 --
include/linux/swap.h | 6 +--
mm/page_io.c | 90 ++++++++++++++++++++++++-------------------
mm/swapfile.c | 3 ++
mm/zswap.c | 2 +-
12 files changed, 116 insertions(+), 204 deletions(-)
--
2.7.4
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 1/7] zram: set BDI_CAP_STABLE_WRITES once
2017-08-11 5:17 [PATCH v2 0/7] Replace rw_page with on-stack bio Minchan Kim
@ 2017-08-11 5:17 ` Minchan Kim
2017-08-14 1:39 ` Sergey Senozhatsky
2017-08-11 5:17 ` [PATCH v2 2/7] bdi: introduce BDI_CAP_SYNCHRONOUS_IO Minchan Kim
` (5 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Minchan Kim @ 2017-08-11 5:17 UTC (permalink / raw)
To: Andrew Morton
Cc: Jens Axboe, Senozhatsky, jack, linux-nvdimm, Dave Chinner,
Minchan Kim, linux-kernel, Matthew Wilcox, Christoph Hellwig,
linux-mm, kernel-team, seungho1.park, Ilya Dryomov, karam . lee
[1] fixed weird thing(i.e., reset BDI_CAP_STABLE_WRITES flag
unconditionally whenever revalidat_disk is called) so zram doesn't
need to reset the flag any more whenever revalidating the bdev.
Instead, set the flag just once when the zram device is created.
It shouldn't change any behavior.
[1] 19b7ccf8651d, block: get rid of blk_integrity_revalidate()
Cc: Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
drivers/block/zram/zram_drv.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index e27daca996ed..bbbc2f230b8e 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -122,14 +122,6 @@ static inline bool is_partial_io(struct bio_vec *bvec)
}
#endif
-static void zram_revalidate_disk(struct zram *zram)
-{
- revalidate_disk(zram->disk);
- /* revalidate_disk reset the BDI_CAP_STABLE_WRITES so set again */
- zram->disk->queue->backing_dev_info->capabilities |=
- BDI_CAP_STABLE_WRITES;
-}
-
/*
* Check if request is within bounds and aligned on zram logical blocks.
*/
@@ -1392,7 +1384,8 @@ static ssize_t disksize_store(struct device *dev,
zram->comp = comp;
zram->disksize = disksize;
set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT);
- zram_revalidate_disk(zram);
+
+ revalidate_disk(zram->disk);
up_write(&zram->init_lock);
return len;
@@ -1439,7 +1432,7 @@ static ssize_t reset_store(struct device *dev,
/* Make sure all the pending I/O are finished */
fsync_bdev(bdev);
zram_reset_device(zram);
- zram_revalidate_disk(zram);
+ revalidate_disk(zram->disk);
bdput(bdev);
mutex_lock(&bdev->bd_mutex);
@@ -1558,6 +1551,7 @@ static int zram_add(void)
/* zram devices sort of resembles non-rotational disks */
queue_flag_set_unlocked(QUEUE_FLAG_NONROT, zram->disk->queue);
queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, zram->disk->queue);
+
/*
* To ensure that we always get PAGE_SIZE aligned
* and n*PAGE_SIZED sized I/O requests.
@@ -1582,6 +1576,8 @@ static int zram_add(void)
if (ZRAM_LOGICAL_BLOCK_SIZE == PAGE_SIZE)
blk_queue_max_write_zeroes_sectors(zram->disk->queue, UINT_MAX);
+ zram->disk->queue->backing_dev_info->capabilities |=
+ BDI_CAP_STABLE_WRITES;
add_disk(zram->disk);
ret = sysfs_create_group(&disk_to_dev(zram->disk)->kobj,
--
2.7.4
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 2/7] bdi: introduce BDI_CAP_SYNCHRONOUS_IO
2017-08-11 5:17 [PATCH v2 0/7] Replace rw_page with on-stack bio Minchan Kim
2017-08-11 5:17 ` [PATCH v2 1/7] zram: set BDI_CAP_STABLE_WRITES once Minchan Kim
@ 2017-08-11 5:17 ` Minchan Kim
2017-08-11 5:17 ` [PATCH v2 3/7] fs: use on-stack-bio if backing device has BDI_CAP_SYNCHRONOUS capability Minchan Kim
` (4 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Minchan Kim @ 2017-08-11 5:17 UTC (permalink / raw)
To: Andrew Morton
Cc: Jens Axboe, jack, linux-nvdimm, Dave Chinner, Minchan Kim,
linux-kernel, Matthew Wilcox, Christoph Hellwig, linux-mm,
kernel-team, seungho1.park, karam . lee
By discussion[1], we will replace rw_page devices with on-stack-bio.
For such super-fast devices to be detected, this patch introduces
BDI_CAP_SYNC which means synchronous IO would be more efficient for
asnychronous IO and uses the flags to brd, zram, btt and pmem.
[1] lkml.kernel.org/r/<20170728165604.10455-1-ross.zwisler@linux.intel.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
drivers/block/brd.c | 2 ++
drivers/block/zram/zram_drv.c | 2 +-
drivers/nvdimm/btt.c | 3 +++
drivers/nvdimm/pmem.c | 2 ++
include/linux/backing-dev.h | 8 ++++++++
5 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 293250582f00..13e03b46e3e7 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -20,6 +20,7 @@
#include <linux/radix-tree.h>
#include <linux/fs.h>
#include <linux/slab.h>
+#include <linux/backing-dev.h>
#ifdef CONFIG_BLK_DEV_RAM_DAX
#include <linux/pfn_t.h>
#include <linux/dax.h>
@@ -436,6 +437,7 @@ static struct brd_device *brd_alloc(int i)
disk->flags = GENHD_FL_EXT_DEVT;
sprintf(disk->disk_name, "ram%d", i);
set_capacity(disk, rd_size * 2);
+ disk->queue->backing_dev_info->capabilities |= BDI_CAP_SYNCHRONOUS_IO;
#ifdef CONFIG_BLK_DEV_RAM_DAX
queue_flag_set_unlocked(QUEUE_FLAG_DAX, brd->brd_queue);
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index bbbc2f230b8e..a60441bd6f0c 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1577,7 +1577,7 @@ static int zram_add(void)
blk_queue_max_write_zeroes_sectors(zram->disk->queue, UINT_MAX);
zram->disk->queue->backing_dev_info->capabilities |=
- BDI_CAP_STABLE_WRITES;
+ (BDI_CAP_STABLE_WRITES | BDI_CAP_SYNCHRONOUS_IO);
add_disk(zram->disk);
ret = sysfs_create_group(&disk_to_dev(zram->disk)->kobj,
diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
index e10d3300b64c..f9437d36fc37 100644
--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -23,6 +23,7 @@
#include <linux/ndctl.h>
#include <linux/fs.h>
#include <linux/nd.h>
+#include <linux/backing-dev.h>
#include "btt.h"
#include "nd.h"
@@ -1273,6 +1274,8 @@ static int btt_blk_init(struct btt *btt)
btt->btt_disk->private_data = btt;
btt->btt_disk->queue = btt->btt_queue;
btt->btt_disk->flags = GENHD_FL_EXT_DEVT;
+ btt->btt_disk->queue->backing_dev_info->capabilities |=
+ BDI_CAP_SYNCHRONOUS_IO;
blk_queue_make_request(btt->btt_queue, btt_make_request);
blk_queue_logical_block_size(btt->btt_queue, btt->sector_size);
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index b5f04559a497..37eb836f9657 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -31,6 +31,7 @@
#include <linux/uio.h>
#include <linux/dax.h>
#include <linux/nd.h>
+#include <linux/backing-dev.h>
#include "pmem.h"
#include "pfn.h"
#include "nd.h"
@@ -379,6 +380,7 @@ static int pmem_attach_disk(struct device *dev,
disk->fops = &pmem_fops;
disk->queue = q;
disk->flags = GENHD_FL_EXT_DEVT;
+ disk->queue->backing_dev_info->capabilities |= BDI_CAP_SYNCHRONOUS_IO;
nvdimm_namespace_disk_name(ndns, disk->disk_name);
set_capacity(disk, (pmem->size - pmem->pfn_pad - pmem->data_offset)
/ 512);
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 854e1bdd0b2a..cd41617c6594 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -123,6 +123,8 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
* BDI_CAP_STRICTLIMIT: Keep number of dirty pages below bdi threshold.
*
* BDI_CAP_CGROUP_WRITEBACK: Supports cgroup-aware writeback.
+ * BDI_CAP_SYNCHRONOUS_IO: Device is so fast that asynchronous IO would be
+ * inefficient.
*/
#define BDI_CAP_NO_ACCT_DIRTY 0x00000001
#define BDI_CAP_NO_WRITEBACK 0x00000002
@@ -130,6 +132,7 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
#define BDI_CAP_STABLE_WRITES 0x00000008
#define BDI_CAP_STRICTLIMIT 0x00000010
#define BDI_CAP_CGROUP_WRITEBACK 0x00000020
+#define BDI_CAP_SYNCHRONOUS_IO 0x00000040
#define BDI_CAP_NO_ACCT_AND_WRITEBACK \
(BDI_CAP_NO_WRITEBACK | BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_ACCT_WB)
@@ -177,6 +180,11 @@ long wait_iff_congested(struct pglist_data *pgdat, int sync, long timeout);
int pdflush_proc_obsolete(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos);
+static inline bool bdi_cap_synchronous_io(struct backing_dev_info *bdi)
+{
+ return bdi->capabilities & BDI_CAP_SYNCHRONOUS_IO;
+}
+
static inline bool bdi_cap_stable_pages_required(struct backing_dev_info *bdi)
{
return bdi->capabilities & BDI_CAP_STABLE_WRITES;
--
2.7.4
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 3/7] fs: use on-stack-bio if backing device has BDI_CAP_SYNCHRONOUS capability
2017-08-11 5:17 [PATCH v2 0/7] Replace rw_page with on-stack bio Minchan Kim
2017-08-11 5:17 ` [PATCH v2 1/7] zram: set BDI_CAP_STABLE_WRITES once Minchan Kim
2017-08-11 5:17 ` [PATCH v2 2/7] bdi: introduce BDI_CAP_SYNCHRONOUS_IO Minchan Kim
@ 2017-08-11 5:17 ` Minchan Kim
2017-08-11 5:17 ` [PATCH v2 4/7] mm:swap: remove end_swap_bio_write argument Minchan Kim
` (3 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Minchan Kim @ 2017-08-11 5:17 UTC (permalink / raw)
To: Andrew Morton
Cc: Jens Axboe, jack, linux-nvdimm, Dave Chinner, Minchan Kim,
linux-kernel, Matthew Wilcox, Christoph Hellwig, linux-mm,
kernel-team, seungho1.park, karam . lee
There is no need to use dynamic bio allocation for BDI_CAP_SYNCHRONOUS
devices. They can with on-stack bio without concern about waiting
bio allocation from mempool under heavy memory pressure.
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
Hi Mattew,
I didn't use sbvec[nr_pages] as you suggested[1] because I don't think
it's pointless in do_mpage_readpage which works per-page base as
I replied to you.
If I misunderstood something, please correct me.
[1] http://lkml.kernel.org/r/<20170808132904.GC31390@bombadil.infradead.org>
fs/mpage.c | 47 ++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 40 insertions(+), 7 deletions(-)
diff --git a/fs/mpage.c b/fs/mpage.c
index 2e4c41ccb5c9..d3b777fdfd5a 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -162,6 +162,9 @@ do_mpage_readpage(struct bio *bio, struct page *page, unsigned nr_pages,
int fully_mapped = 1;
unsigned nblocks;
unsigned relative_block;
+ /* on-stack bio for synchronous devices */
+ struct bio sbio;
+ struct bio_vec sbvec;
if (page_has_buffers(page))
goto confused;
@@ -282,10 +285,22 @@ do_mpage_readpage(struct bio *bio, struct page *page, unsigned nr_pages,
page))
goto out;
}
- bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9),
+
+ if (bdi_cap_synchronous_io(inode_to_bdi(inode))) {
+ bio = &sbio;
+ /* mpage_end_io calls bio_put unconditionally */
+ bio_get(&sbio);
+
+ bio_init(&sbio, &sbvec, 1);
+ sbio.bi_bdev = bdev;
+ sbio.bi_iter.bi_sector = blocks[0] << (blkbits - 9);
+ } else {
+
+ bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9),
min_t(int, nr_pages, BIO_MAX_PAGES), gfp);
- if (bio == NULL)
- goto confused;
+ if (bio == NULL)
+ goto confused;
+ }
}
length = first_hole << blkbits;
@@ -302,6 +317,8 @@ do_mpage_readpage(struct bio *bio, struct page *page, unsigned nr_pages,
else
*last_block_in_bio = blocks[blocks_per_page - 1];
out:
+ if (bio == &sbio)
+ bio = mpage_bio_submit(REQ_OP_READ, 0, bio);
return bio;
confused:
@@ -492,6 +509,9 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
loff_t i_size = i_size_read(inode);
int ret = 0;
int op_flags = wbc_to_write_flags(wbc);
+ /* on-stack-bio */
+ struct bio sbio;
+ struct bio_vec sbvec;
if (page_has_buffers(page)) {
struct buffer_head *head = page_buffers(page);
@@ -610,10 +630,21 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
goto out;
}
}
- bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9),
- BIO_MAX_PAGES, GFP_NOFS|__GFP_HIGH);
- if (bio == NULL)
- goto confused;
+
+ if (bdi_cap_synchronous_io(inode_to_bdi(inode))) {
+ bio = &sbio;
+ /* mpage_end_io calls bio_put unconditionally */
+ bio_get(&sbio);
+
+ bio_init(&sbio, &sbvec, 1);
+ sbio.bi_bdev = bdev;
+ sbio.bi_iter.bi_sector = blocks[0] << (blkbits - 9);
+ } else {
+ bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9),
+ BIO_MAX_PAGES, GFP_NOFS|__GFP_HIGH);
+ if (bio == NULL)
+ goto confused;
+ }
wbc_init_bio(wbc, bio);
bio->bi_write_hint = inode->i_write_hint;
@@ -662,6 +693,8 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
*/
mapping_set_error(mapping, ret);
out:
+ if (bio == &sbio)
+ bio = mpage_bio_submit(REQ_OP_WRITE, op_flags, bio);
mpd->bio = bio;
return ret;
}
--
2.7.4
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 4/7] mm:swap: remove end_swap_bio_write argument
2017-08-11 5:17 [PATCH v2 0/7] Replace rw_page with on-stack bio Minchan Kim
` (2 preceding siblings ...)
2017-08-11 5:17 ` [PATCH v2 3/7] fs: use on-stack-bio if backing device has BDI_CAP_SYNCHRONOUS capability Minchan Kim
@ 2017-08-11 5:17 ` Minchan Kim
2017-08-11 5:17 ` [PATCH v2 5/7] mm:swap: use on-stack-bio for BDI_CAP_SYNCHRONOUS device Minchan Kim
` (2 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Minchan Kim @ 2017-08-11 5:17 UTC (permalink / raw)
To: Andrew Morton
Cc: Jens Axboe, jack, linux-nvdimm, Dave Chinner, Minchan Kim,
linux-kernel, Matthew Wilcox, Christoph Hellwig, linux-mm,
kernel-team, seungho1.park, karam . lee
Every caller of __swap_writepage uses end_swap_bio_write as
end_write_func argument so the argument is pointless.
Remove it.
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
include/linux/swap.h | 3 +--
mm/page_io.c | 7 +++----
mm/zswap.c | 2 +-
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 76f1632eea5a..ae3da979a7b7 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -336,8 +336,7 @@ extern void kswapd_stop(int nid);
extern int swap_readpage(struct page *page, bool do_poll);
extern int swap_writepage(struct page *page, struct writeback_control *wbc);
extern void end_swap_bio_write(struct bio *bio);
-extern int __swap_writepage(struct page *page, struct writeback_control *wbc,
- bio_end_io_t end_write_func);
+extern int __swap_writepage(struct page *page, struct writeback_control *wbc);
extern int swap_set_page_dirty(struct page *page);
int add_swap_extent(struct swap_info_struct *sis, unsigned long start_page,
diff --git a/mm/page_io.c b/mm/page_io.c
index 20139b90125a..3502a97f7c48 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -254,7 +254,7 @@ int swap_writepage(struct page *page, struct writeback_control *wbc)
end_page_writeback(page);
goto out;
}
- ret = __swap_writepage(page, wbc, end_swap_bio_write);
+ ret = __swap_writepage(page, wbc);
out:
return ret;
}
@@ -273,8 +273,7 @@ static inline void count_swpout_vm_event(struct page *page)
count_vm_events(PSWPOUT, hpage_nr_pages(page));
}
-int __swap_writepage(struct page *page, struct writeback_control *wbc,
- bio_end_io_t end_write_func)
+int __swap_writepage(struct page *page, struct writeback_control *wbc)
{
struct bio *bio;
int ret;
@@ -329,7 +328,7 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc,
}
ret = 0;
- bio = get_swap_bio(GFP_NOIO, page, end_write_func);
+ bio = get_swap_bio(GFP_NOIO, page, end_swap_bio_write);
if (bio == NULL) {
set_page_dirty(page);
unlock_page(page);
diff --git a/mm/zswap.c b/mm/zswap.c
index d39581a076c3..38db258515b5 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -900,7 +900,7 @@ static int zswap_writeback_entry(struct zpool *pool, unsigned long handle)
SetPageReclaim(page);
/* start writeback */
- __swap_writepage(page, &wbc, end_swap_bio_write);
+ __swap_writepage(page, &wbc);
put_page(page);
zswap_written_back_pages++;
--
2.7.4
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 5/7] mm:swap: use on-stack-bio for BDI_CAP_SYNCHRONOUS device
2017-08-11 5:17 [PATCH v2 0/7] Replace rw_page with on-stack bio Minchan Kim
` (3 preceding siblings ...)
2017-08-11 5:17 ` [PATCH v2 4/7] mm:swap: remove end_swap_bio_write argument Minchan Kim
@ 2017-08-11 5:17 ` Minchan Kim
2017-08-12 8:21 ` kbuild test robot
2017-08-12 8:46 ` kbuild test robot
2017-08-11 5:17 ` [PATCH v2 6/7] zram: remove zram_rw_page Minchan Kim
2017-08-11 5:17 ` [PATCH v2 7/7] fs: remove rw_page Minchan Kim
6 siblings, 2 replies; 12+ messages in thread
From: Minchan Kim @ 2017-08-11 5:17 UTC (permalink / raw)
To: Andrew Morton
Cc: Jens Axboe, jack, linux-nvdimm, Dave Chinner, Minchan Kim,
linux-kernel, Matthew Wilcox, Christoph Hellwig, linux-mm,
kernel-team, seungho1.park, karam . lee
There is no need to use dynamic bio allocation for BDI_CAP_SYNCHRONOUS
devices. They can live with on-stack-bio without concern about
waiting bio allocation from mempool under heavy memory pressure.
It would be much better for swap devices because the bio mempool
for swap IO have been used with fs. It means super-fast swap
IO like zram don't need to depends on slow eMMC read/write
completion.
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
include/linux/swap.h | 3 ++-
mm/page_io.c | 70 +++++++++++++++++++++++++++++++++++++---------------
mm/swapfile.c | 3 +++
3 files changed, 55 insertions(+), 21 deletions(-)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index ae3da979a7b7..6ed9b6423f7d 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -152,8 +152,9 @@ enum {
SWP_AREA_DISCARD = (1 << 8), /* single-time swap area discards */
SWP_PAGE_DISCARD = (1 << 9), /* freed swap page-cluster discards */
SWP_STABLE_WRITES = (1 << 10), /* no overwrite PG_writeback pages */
+ SWP_SYNC_IO = (1<<11), /* synchronous IO is efficient */
/* add others here before... */
- SWP_SCANNING = (1 << 11), /* refcount in scan_swap_map */
+ SWP_SCANNING = (1 << 12), /* refcount in scan_swap_map */
};
#define SWAP_CLUSTER_MAX 32UL
diff --git a/mm/page_io.c b/mm/page_io.c
index 3502a97f7c48..64330c751548 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -119,8 +119,8 @@ static void swap_slot_free_notify(struct page *page)
static void end_swap_bio_read(struct bio *bio)
{
- struct page *page = bio->bi_io_vec[0].bv_page;
struct task_struct *waiter = bio->bi_private;
+ struct page *page = bio->bi_io_vec[0].bv_page;
if (bio->bi_status) {
SetPageError(page);
@@ -275,9 +275,12 @@ static inline void count_swpout_vm_event(struct page *page)
int __swap_writepage(struct page *page, struct writeback_control *wbc)
{
- struct bio *bio;
int ret;
struct swap_info_struct *sis = page_swap_info(page);
+ struct bio *bio;
+ /* on-stack-bio */
+ struct bio sbio;
+ struct bio_vec sbvec;
VM_BUG_ON_PAGE(!PageSwapCache(page), page);
if (sis->flags & SWP_FILE) {
@@ -328,29 +331,45 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc)
}
ret = 0;
- bio = get_swap_bio(GFP_NOIO, page, end_swap_bio_write);
- if (bio == NULL) {
- set_page_dirty(page);
- unlock_page(page);
- ret = -ENOMEM;
- goto out;
+ if (!(sis->flags & SWP_SYNC_IO)) {
+
+ bio = get_swap_bio(GFP_NOIO, page, end_swap_bio_write);
+ if (bio == NULL) {
+ set_page_dirty(page);
+ unlock_page(page);
+ ret = -ENOMEM;
+ goto out;
+ }
+ } else {
+ bio = &sbio;
+ bio_get(&bio);
+
+ bio_init(&sbio, &sbvec, 1);
+ sbio.bi_bdev = sis->bdev;
+ sbio.bi_iter.bi_sector = swap_page_sector(page);
+ sbio.bi_end_io = end_swap_bio_write;
+ bio_add_page(&sbio, page, PAGE_SIZE, 0);
}
- bio->bi_opf = REQ_OP_WRITE | wbc_to_write_flags(wbc);
- count_swpout_vm_event(page);
+
+ bio_set_op_attrs(bio, REQ_OP_WRITE, wbc_to_write_flags(wbc));
set_page_writeback(page);
unlock_page(page);
submit_bio(bio);
+ count_swpout_vm_event(page);
out:
return ret;
}
int swap_readpage(struct page *page, bool do_poll)
{
- struct bio *bio;
int ret = 0;
struct swap_info_struct *sis = page_swap_info(page);
blk_qc_t qc;
struct block_device *bdev;
+ struct bio *bio;
+ /* on-stack-bio */
+ struct bio sbio;
+ struct bio_vec sbvec;
VM_BUG_ON_PAGE(!PageSwapCache(page), page);
VM_BUG_ON_PAGE(!PageLocked(page), page);
@@ -383,21 +402,33 @@ int swap_readpage(struct page *page, bool do_poll)
}
ret = 0;
- bio = get_swap_bio(GFP_KERNEL, page, end_swap_bio_read);
- if (bio == NULL) {
- unlock_page(page);
- ret = -ENOMEM;
- goto out;
+ count_vm_event(PSWPIN);
+ if (!(sis->flags & SWP_SYNC_IO)) {
+ bio = get_swap_bio(GFP_KERNEL, page, end_swap_bio_read);
+ if (bio == NULL) {
+ unlock_page(page);
+ ret = -ENOMEM;
+ goto out;
+ }
+ } else {
+ bio = &sbio;
+ bio_get(bio);
+
+ bio_init(&sbio, &sbvec, 1);
+ sbio.bi_bdev = sis->bdev;
+ sbio.bi_iter.bi_sector = swap_page_sector(page);
+ bio->bi_end_io = end_swap_bio_read;
+ bio_add_page(&sbio, page, PAGE_SIZE, 0);
}
bdev = bio->bi_bdev;
/*
- * Keep this task valid during swap readpage because the oom killer may
- * attempt to access it in the page fault retry time check.
+ * Keep this task valid during swap readpage because
+ * the oom killer may attempt to access it
+ * in the page fault retry time check.
*/
get_task_struct(current);
bio->bi_private = current;
bio_set_op_attrs(bio, REQ_OP_READ, 0);
- count_vm_event(PSWPIN);
bio_get(bio);
qc = submit_bio(bio);
while (do_poll) {
@@ -410,7 +441,6 @@ int swap_readpage(struct page *page, bool do_poll)
}
__set_current_state(TASK_RUNNING);
bio_put(bio);
-
out:
return ret;
}
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 42eff9e4e972..e916b325b0b7 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -3113,6 +3113,9 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
if (bdi_cap_stable_pages_required(inode_to_bdi(inode)))
p->flags |= SWP_STABLE_WRITES;
+ if (bdi_cap_synchronous_io(inode_to_bdi(inode)))
+ p->flags |= SWP_SYNC_IO;
+
if (p->bdev && blk_queue_nonrot(bdev_get_queue(p->bdev))) {
int cpu;
unsigned long ci, nr_cluster;
--
2.7.4
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 6/7] zram: remove zram_rw_page
2017-08-11 5:17 [PATCH v2 0/7] Replace rw_page with on-stack bio Minchan Kim
` (4 preceding siblings ...)
2017-08-11 5:17 ` [PATCH v2 5/7] mm:swap: use on-stack-bio for BDI_CAP_SYNCHRONOUS device Minchan Kim
@ 2017-08-11 5:17 ` Minchan Kim
2017-08-11 5:17 ` [PATCH v2 7/7] fs: remove rw_page Minchan Kim
6 siblings, 0 replies; 12+ messages in thread
From: Minchan Kim @ 2017-08-11 5:17 UTC (permalink / raw)
To: Andrew Morton
Cc: Jens Axboe, Sergey Senozhatsky, jack, linux-nvdimm, Dave Chinner,
Minchan Kim, linux-kernel, Matthew Wilcox, Christoph Hellwig,
linux-mm, kernel-team, seungho1.park, karam . lee
With on-stack-bio, rw_page interface doesn't provide a clear performance
benefit for zram and surely has a maintenance burden, so remove the
last user to remove rw_page completely.
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
drivers/block/zram/zram_drv.c | 52 -------------------------------------------
1 file changed, 52 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index a60441bd6f0c..b30f70d593d0 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1268,57 +1268,6 @@ static void zram_slot_free_notify(struct block_device *bdev,
atomic64_inc(&zram->stats.notify_free);
}
-static int zram_rw_page(struct block_device *bdev, sector_t sector,
- struct page *page, bool is_write)
-{
- int offset, ret;
- u32 index;
- struct zram *zram;
- struct bio_vec bv;
-
- if (PageTransHuge(page))
- return -ENOTSUPP;
- zram = bdev->bd_disk->private_data;
-
- if (!valid_io_request(zram, sector, PAGE_SIZE)) {
- atomic64_inc(&zram->stats.invalid_io);
- ret = -EINVAL;
- goto out;
- }
-
- index = sector >> SECTORS_PER_PAGE_SHIFT;
- offset = (sector & (SECTORS_PER_PAGE - 1)) << SECTOR_SHIFT;
-
- bv.bv_page = page;
- bv.bv_len = PAGE_SIZE;
- bv.bv_offset = 0;
-
- ret = zram_bvec_rw(zram, &bv, index, offset, is_write, NULL);
-out:
- /*
- * If I/O fails, just return error(ie, non-zero) without
- * calling page_endio.
- * It causes resubmit the I/O with bio request by upper functions
- * of rw_page(e.g., swap_readpage, __swap_writepage) and
- * bio->bi_end_io does things to handle the error
- * (e.g., SetPageError, set_page_dirty and extra works).
- */
- if (unlikely(ret < 0))
- return ret;
-
- switch (ret) {
- case 0:
- page_endio(page, is_write, 0);
- break;
- case 1:
- ret = 0;
- break;
- default:
- WARN_ON(1);
- }
- return ret;
-}
-
static void zram_reset_device(struct zram *zram)
{
struct zcomp *comp;
@@ -1460,7 +1409,6 @@ static int zram_open(struct block_device *bdev, fmode_t mode)
static const struct block_device_operations zram_devops = {
.open = zram_open,
.swap_slot_free_notify = zram_slot_free_notify,
- .rw_page = zram_rw_page,
.owner = THIS_MODULE
};
--
2.7.4
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 7/7] fs: remove rw_page
2017-08-11 5:17 [PATCH v2 0/7] Replace rw_page with on-stack bio Minchan Kim
` (5 preceding siblings ...)
2017-08-11 5:17 ` [PATCH v2 6/7] zram: remove zram_rw_page Minchan Kim
@ 2017-08-11 5:17 ` Minchan Kim
6 siblings, 0 replies; 12+ messages in thread
From: Minchan Kim @ 2017-08-11 5:17 UTC (permalink / raw)
To: Andrew Morton
Cc: Jens Axboe, jack, linux-nvdimm, Dave Chinner, Minchan Kim,
linux-kernel, Matthew Wilcox, Christoph Hellwig, linux-mm,
kernel-team, seungho1.park, karam . lee
Currently, there is no user of rw_page so remove it.
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
fs/block_dev.c | 76 --------------------------------------------------
fs/mpage.c | 15 ----------
include/linux/blkdev.h | 4 ---
mm/page_io.c | 17 -----------
4 files changed, 112 deletions(-)
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 9941dc8342df..6fb408041e7d 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -649,82 +649,6 @@ int blkdev_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
}
EXPORT_SYMBOL(blkdev_fsync);
-/**
- * bdev_read_page() - Start reading a page from a block device
- * @bdev: The device to read the page from
- * @sector: The offset on the device to read the page to (need not be aligned)
- * @page: The page to read
- *
- * On entry, the page should be locked. It will be unlocked when the page
- * has been read. If the block driver implements rw_page synchronously,
- * that will be true on exit from this function, but it need not be.
- *
- * Errors returned by this function are usually "soft", eg out of memory, or
- * queue full; callers should try a different route to read this page rather
- * than propagate an error back up the stack.
- *
- * Return: negative errno if an error occurs, 0 if submission was successful.
- */
-int bdev_read_page(struct block_device *bdev, sector_t sector,
- struct page *page)
-{
- const struct block_device_operations *ops = bdev->bd_disk->fops;
- int result = -EOPNOTSUPP;
-
- if (!ops->rw_page || bdev_get_integrity(bdev))
- return result;
-
- result = blk_queue_enter(bdev->bd_queue, false);
- if (result)
- return result;
- result = ops->rw_page(bdev, sector + get_start_sect(bdev), page, false);
- blk_queue_exit(bdev->bd_queue);
- return result;
-}
-EXPORT_SYMBOL_GPL(bdev_read_page);
-
-/**
- * bdev_write_page() - Start writing a page to a block device
- * @bdev: The device to write the page to
- * @sector: The offset on the device to write the page to (need not be aligned)
- * @page: The page to write
- * @wbc: The writeback_control for the write
- *
- * On entry, the page should be locked and not currently under writeback.
- * On exit, if the write started successfully, the page will be unlocked and
- * under writeback. If the write failed already (eg the driver failed to
- * queue the page to the device), the page will still be locked. If the
- * caller is a ->writepage implementation, it will need to unlock the page.
- *
- * Errors returned by this function are usually "soft", eg out of memory, or
- * queue full; callers should try a different route to write this page rather
- * than propagate an error back up the stack.
- *
- * Return: negative errno if an error occurs, 0 if submission was successful.
- */
-int bdev_write_page(struct block_device *bdev, sector_t sector,
- struct page *page, struct writeback_control *wbc)
-{
- int result;
- const struct block_device_operations *ops = bdev->bd_disk->fops;
-
- if (!ops->rw_page || bdev_get_integrity(bdev))
- return -EOPNOTSUPP;
- result = blk_queue_enter(bdev->bd_queue, false);
- if (result)
- return result;
-
- set_page_writeback(page);
- result = ops->rw_page(bdev, sector + get_start_sect(bdev), page, true);
- if (result)
- end_page_writeback(page);
- else
- unlock_page(page);
- blk_queue_exit(bdev->bd_queue);
- return result;
-}
-EXPORT_SYMBOL_GPL(bdev_write_page);
-
/*
* pseudo-fs
*/
diff --git a/fs/mpage.c b/fs/mpage.c
index d3b777fdfd5a..31282ea5d6db 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -280,12 +280,6 @@ do_mpage_readpage(struct bio *bio, struct page *page, unsigned nr_pages,
alloc_new:
if (bio == NULL) {
- if (first_hole == blocks_per_page) {
- if (!bdev_read_page(bdev, blocks[0] << (blkbits - 9),
- page))
- goto out;
- }
-
if (bdi_cap_synchronous_io(inode_to_bdi(inode))) {
bio = &sbio;
/* mpage_end_io calls bio_put unconditionally */
@@ -623,14 +617,6 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
alloc_new:
if (bio == NULL) {
- if (first_unmapped == blocks_per_page) {
- if (!bdev_write_page(bdev, blocks[0] << (blkbits - 9),
- page, wbc)) {
- clean_buffers(page, first_unmapped);
- goto out;
- }
- }
-
if (bdi_cap_synchronous_io(inode_to_bdi(inode))) {
bio = &sbio;
/* mpage_end_io calls bio_put unconditionally */
@@ -645,7 +631,6 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
if (bio == NULL)
goto confused;
}
-
wbc_init_bio(wbc, bio);
bio->bi_write_hint = inode->i_write_hint;
}
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 25f6a0cb27d3..21fffa849033 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1936,7 +1936,6 @@ static inline bool integrity_req_gap_front_merge(struct request *req,
struct block_device_operations {
int (*open) (struct block_device *, fmode_t);
void (*release) (struct gendisk *, fmode_t);
- int (*rw_page)(struct block_device *, sector_t, struct page *, bool);
int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
unsigned int (*check_events) (struct gendisk *disk,
@@ -1954,9 +1953,6 @@ struct block_device_operations {
extern int __blkdev_driver_ioctl(struct block_device *, fmode_t, unsigned int,
unsigned long);
-extern int bdev_read_page(struct block_device *, sector_t, struct page *);
-extern int bdev_write_page(struct block_device *, sector_t, struct page *,
- struct writeback_control *);
#else /* CONFIG_BLOCK */
struct block_device;
diff --git a/mm/page_io.c b/mm/page_io.c
index 64330c751548..a70874f9cb18 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -324,12 +324,6 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc)
return ret;
}
- ret = bdev_write_page(sis->bdev, swap_page_sector(page), page, wbc);
- if (!ret) {
- count_swpout_vm_event(page);
- return 0;
- }
-
ret = 0;
if (!(sis->flags & SWP_SYNC_IO)) {
@@ -390,17 +384,6 @@ int swap_readpage(struct page *page, bool do_poll)
return ret;
}
- ret = bdev_read_page(sis->bdev, swap_page_sector(page), page);
- if (!ret) {
- if (trylock_page(page)) {
- swap_slot_free_notify(page);
- unlock_page(page);
- }
-
- count_vm_event(PSWPIN);
- return 0;
- }
-
ret = 0;
count_vm_event(PSWPIN);
if (!(sis->flags & SWP_SYNC_IO)) {
--
2.7.4
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 5/7] mm:swap: use on-stack-bio for BDI_CAP_SYNCHRONOUS device
2017-08-11 5:17 ` [PATCH v2 5/7] mm:swap: use on-stack-bio for BDI_CAP_SYNCHRONOUS device Minchan Kim
@ 2017-08-12 8:21 ` kbuild test robot
2017-08-12 8:46 ` kbuild test robot
1 sibling, 0 replies; 12+ messages in thread
From: kbuild test robot @ 2017-08-12 8:21 UTC (permalink / raw)
To: Minchan Kim
Cc: Jens Axboe, jack, linux-nvdimm, Dave Chinner, linux-kernel,
Matthew Wilcox, Christoph Hellwig, linux-mm, kernel-team,
kbuild-all, seungho1.park, Andrew Morton, karam . lee
Hi Minchan,
[auto build test WARNING on mmotm/master]
[also build test WARNING on next-20170811]
[cannot apply to linus/master v4.13-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Minchan-Kim/Replace-rw_page-with-on-stack-bio/20170812-152541
base: git://git.cmpxchg.org/linux-mmotm.git master
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa
All warnings (new ones prefixed by >>):
mm/page_io.c: In function '__swap_writepage':
>> mm/page_io.c:345:3: warning: passing argument 1 of 'bio_get' from incompatible pointer type
bio_get(&bio);
^
In file included from include/linux/writeback.h:205:0,
from include/linux/memcontrol.h:31,
from include/linux/swap.h:8,
from mm/page_io.c:17:
include/linux/bio.h:252:20: note: expected 'struct bio *' but argument is of type 'struct bio **'
static inline void bio_get(struct bio *bio)
^
vim +/bio_get +345 mm/page_io.c
275
276 int __swap_writepage(struct page *page, struct writeback_control *wbc)
277 {
278 int ret;
279 struct swap_info_struct *sis = page_swap_info(page);
280 struct bio *bio;
281 /* on-stack-bio */
282 struct bio sbio;
283 struct bio_vec sbvec;
284
285 VM_BUG_ON_PAGE(!PageSwapCache(page), page);
286 if (sis->flags & SWP_FILE) {
287 struct kiocb kiocb;
288 struct file *swap_file = sis->swap_file;
289 struct address_space *mapping = swap_file->f_mapping;
290 struct bio_vec bv = {
291 .bv_page = page,
292 .bv_len = PAGE_SIZE,
293 .bv_offset = 0
294 };
295 struct iov_iter from;
296
297 iov_iter_bvec(&from, ITER_BVEC | WRITE, &bv, 1, PAGE_SIZE);
298 init_sync_kiocb(&kiocb, swap_file);
299 kiocb.ki_pos = page_file_offset(page);
300
301 set_page_writeback(page);
302 unlock_page(page);
303 ret = mapping->a_ops->direct_IO(&kiocb, &from);
304 if (ret == PAGE_SIZE) {
305 count_vm_event(PSWPOUT);
306 ret = 0;
307 } else {
308 /*
309 * In the case of swap-over-nfs, this can be a
310 * temporary failure if the system has limited
311 * memory for allocating transmit buffers.
312 * Mark the page dirty and avoid
313 * rotate_reclaimable_page but rate-limit the
314 * messages but do not flag PageError like
315 * the normal direct-to-bio case as it could
316 * be temporary.
317 */
318 set_page_dirty(page);
319 ClearPageReclaim(page);
320 pr_err_ratelimited("Write error on dio swapfile (%llu)\n",
321 page_file_offset(page));
322 }
323 end_page_writeback(page);
324 return ret;
325 }
326
327 ret = bdev_write_page(sis->bdev, swap_page_sector(page), page, wbc);
328 if (!ret) {
329 count_swpout_vm_event(page);
330 return 0;
331 }
332
333 ret = 0;
334 if (!(sis->flags & SWP_SYNC_IO)) {
335
336 bio = get_swap_bio(GFP_NOIO, page, end_swap_bio_write);
337 if (bio == NULL) {
338 set_page_dirty(page);
339 unlock_page(page);
340 ret = -ENOMEM;
341 goto out;
342 }
343 } else {
344 bio = &sbio;
> 345 bio_get(&bio);
346
347 bio_init(&sbio, &sbvec, 1);
348 sbio.bi_bdev = sis->bdev;
349 sbio.bi_iter.bi_sector = swap_page_sector(page);
350 sbio.bi_end_io = end_swap_bio_write;
351 bio_add_page(&sbio, page, PAGE_SIZE, 0);
352 }
353
354 bio_set_op_attrs(bio, REQ_OP_WRITE, wbc_to_write_flags(wbc));
355 set_page_writeback(page);
356 unlock_page(page);
357 submit_bio(bio);
358 count_swpout_vm_event(page);
359 out:
360 return ret;
361 }
362
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 5/7] mm:swap: use on-stack-bio for BDI_CAP_SYNCHRONOUS device
2017-08-11 5:17 ` [PATCH v2 5/7] mm:swap: use on-stack-bio for BDI_CAP_SYNCHRONOUS device Minchan Kim
2017-08-12 8:21 ` kbuild test robot
@ 2017-08-12 8:46 ` kbuild test robot
2017-08-14 8:41 ` Minchan Kim
1 sibling, 1 reply; 12+ messages in thread
From: kbuild test robot @ 2017-08-12 8:46 UTC (permalink / raw)
To: Minchan Kim
Cc: Jens Axboe, jack, linux-nvdimm, Dave Chinner, linux-kernel,
Matthew Wilcox, Christoph Hellwig, linux-mm, kernel-team,
kbuild-all, seungho1.park, Andrew Morton, karam . lee
Hi Minchan,
[auto build test ERROR on mmotm/master]
[also build test ERROR on next-20170811]
[cannot apply to linus/master v4.13-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Minchan-Kim/Replace-rw_page-with-on-stack-bio/20170812-152541
base: git://git.cmpxchg.org/linux-mmotm.git master
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64
All errors (new ones prefixed by >>):
mm/page_io.c: In function '__swap_writepage':
>> mm/page_io.c:345:11: error: passing argument 1 of 'bio_get' from incompatible pointer type [-Werror=incompatible-pointer-types]
bio_get(&bio);
^
In file included from include/linux/writeback.h:205:0,
from include/linux/memcontrol.h:31,
from include/linux/swap.h:8,
from mm/page_io.c:17:
include/linux/bio.h:252:20: note: expected 'struct bio *' but argument is of type 'struct bio **'
static inline void bio_get(struct bio *bio)
^~~~~~~
cc1: some warnings being treated as errors
vim +/bio_get +345 mm/page_io.c
275
276 int __swap_writepage(struct page *page, struct writeback_control *wbc)
277 {
278 int ret;
279 struct swap_info_struct *sis = page_swap_info(page);
280 struct bio *bio;
281 /* on-stack-bio */
282 struct bio sbio;
283 struct bio_vec sbvec;
284
285 VM_BUG_ON_PAGE(!PageSwapCache(page), page);
286 if (sis->flags & SWP_FILE) {
287 struct kiocb kiocb;
288 struct file *swap_file = sis->swap_file;
289 struct address_space *mapping = swap_file->f_mapping;
290 struct bio_vec bv = {
291 .bv_page = page,
292 .bv_len = PAGE_SIZE,
293 .bv_offset = 0
294 };
295 struct iov_iter from;
296
297 iov_iter_bvec(&from, ITER_BVEC | WRITE, &bv, 1, PAGE_SIZE);
298 init_sync_kiocb(&kiocb, swap_file);
299 kiocb.ki_pos = page_file_offset(page);
300
301 set_page_writeback(page);
302 unlock_page(page);
303 ret = mapping->a_ops->direct_IO(&kiocb, &from);
304 if (ret == PAGE_SIZE) {
305 count_vm_event(PSWPOUT);
306 ret = 0;
307 } else {
308 /*
309 * In the case of swap-over-nfs, this can be a
310 * temporary failure if the system has limited
311 * memory for allocating transmit buffers.
312 * Mark the page dirty and avoid
313 * rotate_reclaimable_page but rate-limit the
314 * messages but do not flag PageError like
315 * the normal direct-to-bio case as it could
316 * be temporary.
317 */
318 set_page_dirty(page);
319 ClearPageReclaim(page);
320 pr_err_ratelimited("Write error on dio swapfile (%llu)\n",
321 page_file_offset(page));
322 }
323 end_page_writeback(page);
324 return ret;
325 }
326
327 ret = bdev_write_page(sis->bdev, swap_page_sector(page), page, wbc);
328 if (!ret) {
329 count_swpout_vm_event(page);
330 return 0;
331 }
332
333 ret = 0;
334 if (!(sis->flags & SWP_SYNC_IO)) {
335
336 bio = get_swap_bio(GFP_NOIO, page, end_swap_bio_write);
337 if (bio == NULL) {
338 set_page_dirty(page);
339 unlock_page(page);
340 ret = -ENOMEM;
341 goto out;
342 }
343 } else {
344 bio = &sbio;
> 345 bio_get(&bio);
346
347 bio_init(&sbio, &sbvec, 1);
348 sbio.bi_bdev = sis->bdev;
349 sbio.bi_iter.bi_sector = swap_page_sector(page);
350 sbio.bi_end_io = end_swap_bio_write;
351 bio_add_page(&sbio, page, PAGE_SIZE, 0);
352 }
353
354 bio_set_op_attrs(bio, REQ_OP_WRITE, wbc_to_write_flags(wbc));
355 set_page_writeback(page);
356 unlock_page(page);
357 submit_bio(bio);
358 count_swpout_vm_event(page);
359 out:
360 return ret;
361 }
362
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/7] zram: set BDI_CAP_STABLE_WRITES once
2017-08-11 5:17 ` [PATCH v2 1/7] zram: set BDI_CAP_STABLE_WRITES once Minchan Kim
@ 2017-08-14 1:39 ` Sergey Senozhatsky
0 siblings, 0 replies; 12+ messages in thread
From: Sergey Senozhatsky @ 2017-08-14 1:39 UTC (permalink / raw)
To: Minchan Kim
Cc: Jens Axboe, Senozhatsky, jack, linux-nvdimm, Dave Chinner,
linux-kernel, Matthew Wilcox, Christoph Hellwig, linux-mm,
kernel-team, seungho1.park, Ilya Dryomov, karam . lee,
Andrew Morton
On (08/11/17 14:17), Minchan Kim wrote:
> [1] fixed weird thing(i.e., reset BDI_CAP_STABLE_WRITES flag
> unconditionally whenever revalidat_disk is called) so zram doesn't
> need to reset the flag any more whenever revalidating the bdev.
> Instead, set the flag just once when the zram device is created.
>
> It shouldn't change any behavior.
>
> [1] 19b7ccf8651d, block: get rid of blk_integrity_revalidate()
> Cc: Senozhatsky <sergey.senozhatsky@gmail.com>
> Cc: Ilya Dryomov <idryomov@gmail.com>
> Signed-off-by: Minchan Kim <minchan@kernel.org>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
-ss
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 5/7] mm:swap: use on-stack-bio for BDI_CAP_SYNCHRONOUS device
2017-08-12 8:46 ` kbuild test robot
@ 2017-08-14 8:41 ` Minchan Kim
0 siblings, 0 replies; 12+ messages in thread
From: Minchan Kim @ 2017-08-14 8:41 UTC (permalink / raw)
To: kbuild test robot
Cc: Jens Axboe, jack, linux-nvdimm, Dave Chinner, linux-kernel,
Matthew Wilcox, Christoph Hellwig, linux-mm, kernel-team,
kbuild-all, seungho1.park, Andrew Morton, karam . lee
On Sat, Aug 12, 2017 at 04:46:33PM +0800, kbuild test robot wrote:
> Hi Minchan,
>
> [auto build test ERROR on mmotm/master]
> [also build test ERROR on next-20170811]
> [cannot apply to linus/master v4.13-rc4]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Minchan-Kim/Replace-rw_page-with-on-stack-bio/20170812-152541
> base: git://git.cmpxchg.org/linux-mmotm.git master
> config: sparc64-allmodconfig (attached as .config)
> compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
> wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> make.cross ARCH=sparc64
>
> All errors (new ones prefixed by >>):
>
> mm/page_io.c: In function '__swap_writepage':
> >> mm/page_io.c:345:11: error: passing argument 1 of 'bio_get' from incompatible pointer type [-Werror=incompatible-pointer-types]
> bio_get(&bio);
> ^
> In file included from include/linux/writeback.h:205:0,
> from include/linux/memcontrol.h:31,
> from include/linux/swap.h:8,
> from mm/page_io.c:17:
> include/linux/bio.h:252:20: note: expected 'struct bio *' but argument is of type 'struct bio **'
> static inline void bio_get(struct bio *bio)
> ^~~~~~~
> cc1: some warnings being treated as errors
>
> vim +/bio_get +345 mm/page_io.c
>
> 275
> 276 int __swap_writepage(struct page *page, struct writeback_control *wbc)
> 277 {
> 278 int ret;
> 279 struct swap_info_struct *sis = page_swap_info(page);
> 280 struct bio *bio;
> 281 /* on-stack-bio */
> 282 struct bio sbio;
> 283 struct bio_vec sbvec;
> 284
> 285 VM_BUG_ON_PAGE(!PageSwapCache(page), page);
> 286 if (sis->flags & SWP_FILE) {
> 287 struct kiocb kiocb;
> 288 struct file *swap_file = sis->swap_file;
> 289 struct address_space *mapping = swap_file->f_mapping;
> 290 struct bio_vec bv = {
> 291 .bv_page = page,
> 292 .bv_len = PAGE_SIZE,
> 293 .bv_offset = 0
> 294 };
> 295 struct iov_iter from;
> 296
> 297 iov_iter_bvec(&from, ITER_BVEC | WRITE, &bv, 1, PAGE_SIZE);
> 298 init_sync_kiocb(&kiocb, swap_file);
> 299 kiocb.ki_pos = page_file_offset(page);
> 300
> 301 set_page_writeback(page);
> 302 unlock_page(page);
> 303 ret = mapping->a_ops->direct_IO(&kiocb, &from);
> 304 if (ret == PAGE_SIZE) {
> 305 count_vm_event(PSWPOUT);
> 306 ret = 0;
> 307 } else {
> 308 /*
> 309 * In the case of swap-over-nfs, this can be a
> 310 * temporary failure if the system has limited
> 311 * memory for allocating transmit buffers.
> 312 * Mark the page dirty and avoid
> 313 * rotate_reclaimable_page but rate-limit the
> 314 * messages but do not flag PageError like
> 315 * the normal direct-to-bio case as it could
> 316 * be temporary.
> 317 */
> 318 set_page_dirty(page);
> 319 ClearPageReclaim(page);
> 320 pr_err_ratelimited("Write error on dio swapfile (%llu)\n",
> 321 page_file_offset(page));
> 322 }
> 323 end_page_writeback(page);
> 324 return ret;
> 325 }
> 326
> 327 ret = bdev_write_page(sis->bdev, swap_page_sector(page), page, wbc);
> 328 if (!ret) {
> 329 count_swpout_vm_event(page);
> 330 return 0;
> 331 }
> 332
> 333 ret = 0;
> 334 if (!(sis->flags & SWP_SYNC_IO)) {
> 335
> 336 bio = get_swap_bio(GFP_NOIO, page, end_swap_bio_write);
> 337 if (bio == NULL) {
> 338 set_page_dirty(page);
> 339 unlock_page(page);
> 340 ret = -ENOMEM;
> 341 goto out;
> 342 }
> 343 } else {
> 344 bio = &sbio;
> > 345 bio_get(&bio);
Hi kbuild,
I will respin with fixing it.
Thanks for the catching up!
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2017-08-14 8:38 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-11 5:17 [PATCH v2 0/7] Replace rw_page with on-stack bio Minchan Kim
2017-08-11 5:17 ` [PATCH v2 1/7] zram: set BDI_CAP_STABLE_WRITES once Minchan Kim
2017-08-14 1:39 ` Sergey Senozhatsky
2017-08-11 5:17 ` [PATCH v2 2/7] bdi: introduce BDI_CAP_SYNCHRONOUS_IO Minchan Kim
2017-08-11 5:17 ` [PATCH v2 3/7] fs: use on-stack-bio if backing device has BDI_CAP_SYNCHRONOUS capability Minchan Kim
2017-08-11 5:17 ` [PATCH v2 4/7] mm:swap: remove end_swap_bio_write argument Minchan Kim
2017-08-11 5:17 ` [PATCH v2 5/7] mm:swap: use on-stack-bio for BDI_CAP_SYNCHRONOUS device Minchan Kim
2017-08-12 8:21 ` kbuild test robot
2017-08-12 8:46 ` kbuild test robot
2017-08-14 8:41 ` Minchan Kim
2017-08-11 5:17 ` [PATCH v2 6/7] zram: remove zram_rw_page Minchan Kim
2017-08-11 5:17 ` [PATCH v2 7/7] fs: remove rw_page Minchan Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).