Replace rw_page with on-stack bio
Subsystems (10)
Minchan Kim
maintainerv2 cover Replace rw_page with on-stack bio
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/<[email protected]>
* 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(-)
Signature · 6 lines
2.7.4 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Minchan Kim
maintainerPATCH v2 1/7 zram: set BDI_CAP_STABLE_WRITES once
[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()
--- drivers/block/zram/zram_drv.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/block/zram/zram_drv.c +6 -10
@@ -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,
Signature · 6 lines
2.7.4 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH v2 1/7] zram: set BDI_CAP_STABLE_WRITES once
Quoted 11 lines · Minchan Kim
[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 ofblk_integrity_revalidate()Cc Senozhatsky <[email protected]>Cc Ilya Dryomov <[email protected]>Signed-off-by Minchan Kim <[email protected]>
-ss
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Minchan Kim
maintainerPATCH v2 2/7 bdi: introduce BDI_CAP_SYNCHRONOUS_IO
In reply to Minchan KimBy 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/<[email protected]>
--- 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(-)
drivers/block/brd.c +2 -0
@@ -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);
drivers/block/zram/zram_drv.c +1 -1
@@ -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,
drivers/nvdimm/btt.c +3 -0
@@ -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);
drivers/nvdimm/pmem.c +2 -0
@@ -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 );
include/linux/backing-dev.h +8 -0
@@ -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 ;
Signature · 6 lines
2.7.4 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Minchan Kim
maintainerPATCH v2 3/7 fs: use on-stack-bio if backing device has BDI_CAP_SYNCHRONOUS capability
In reply to Minchan KimThere 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.
---
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/<[email protected]>
fs/mpage.c | 47 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 7 deletions(-)
fs/mpage.c +40 -7
@@ -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; }
Signature · 6 lines
2.7.4 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Minchan Kim
maintainerPATCH v2 4/7 mm:swap: remove end_swap_bio_write argument
In reply to Minchan KimEvery caller of __swap_writepage uses end_swap_bio_write as end_write_func argument so the argument is pointless. Remove it.
--- include/linux/swap.h | 3 +-- mm/page_io.c | 7 +++---- mm/zswap.c | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-)
include/linux/swap.h +1 -2
@@ -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,
mm/page_io.c +3 -4
@@ -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);
mm/zswap.c +1 -1
@@ -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++;
Signature · 6 lines
2.7.4 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Minchan Kim
maintainerPATCH v2 5/7 mm:swap: use on-stack-bio for BDI_CAP_SYNCHRONOUS device
In reply to Minchan KimThere 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.
--- include/linux/swap.h | 3 ++- mm/page_io.c | 70 +++++++++++++++++++++++++++++++++++++--------------- mm/swapfile.c | 3 +++ 3 files changed, 55 insertions(+), 21 deletions(-)
include/linux/swap.h +2 -1
@@ -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
mm/page_io.c +50 -20
124 lines not on this page · raw message
mm/swapfile.c +3 -0
@@ -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;
Signature · 6 lines
2.7.4 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
kbuild test robot
build botRe: [PATCH v2 5/7] mm:swap: use on-stack-bio for BDI_CAP_SYNCHRONOUS device
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…
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
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
kbuild test robot
build botRe: [PATCH v2 5/7] mm:swap: use on-stack-bio for BDI_CAP_SYNCHRONOUS device
In reply to Minchan Kimreproduce: 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…
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
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Minchan Kim
maintainerRe: [PATCH v2 5/7] mm:swap: use on-stack-bio for BDI_CAP_SYNCHRONOUS device
Quoted 96 lines · kbuild test robot
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 20160705reproduce:
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=sparc64All errors (new ones prefixed by >>):
mm/page_io.c: In function '__swap_writepage':Quoted 1 line
Quoted 1 line
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 voidbio_get(struct bio *bio)
^~~~~~~
cc1: some warnings being treated as errorsvim +/bio_get +345
mm/page_io.c275 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);
Quoted 9 lines
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;Quoted 1 line
345
bio_get(&bio);
Hi kbuild,
I will respin with fixing it.
Thanks for the catching up!
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Minchan Kim
maintainerPATCH v2 6/7 zram: remove zram_rw_page
In reply to Minchan KimWith 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.
--- drivers/block/zram/zram_drv.c | 52 ------------------------------------------- 1 file changed, 52 deletions(-)
drivers/block/zram/zram_drv.c +0 -52
@@ -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 };
Signature · 6 lines
2.7.4 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Minchan Kim
maintainerPATCH v2 7/7 fs: remove rw_page
In reply to Minchan KimCurrently, there is no user of rw_page so remove it.
--- fs/block_dev.c | 76 -------------------------------------------------- fs/mpage.c | 15 ---------- include/linux/blkdev.h | 4 --- mm/page_io.c | 17 ----------- 4 files changed, 112 deletions(-)
fs/block_dev.c +0 -76
@@ -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 */
fs/mpage.c +0 -15
@@ -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; }
include/linux/blkdev.h +0 -4
@@ -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 ;
mm/page_io.c +0 -17
@@ -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 )) {
Signature · 6 lines
2.7.4 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm