diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index e53a6403d428..f39da19f0f3f 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -1752,27 +1751,6 @@ static void zram_slot_free_notify(struct block_device *bdev, zram_slot_unlock(zram, index); } -/* Moto lulei1: check sync_io state on swap entry, - * return 0 on wb page, else return 1. - */ -#ifdef CONFIG_ZRAM_WRITEBACK -static int zram_ioctl(struct block_device *bdev, fmode_t mode, - unsigned int cmd, unsigned long index) -{ - struct zram *zram; - int has_sync_io = 1; - - if (cmd != SWP_SYNCHRONOUS_IO) return -EINVAL; - - zram = bdev->bd_disk->private_data; - zram_slot_lock(zram, index); - has_sync_io = zram_test_flag(zram, index, ZRAM_WB) ? 0 : 1; - zram_slot_unlock(zram, index); - - return has_sync_io; -} -#endif - static int zram_rw_page(struct block_device *bdev, sector_t sector, struct page *page, unsigned int op) { @@ -1965,9 +1943,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, -#ifdef CONFIG_ZRAM_WRITEBACK - .ioctl = zram_ioctl, -#endif .rw_page = zram_rw_page, .owner = THIS_MODULE }; diff --git a/include/linux/swap.h b/include/linux/swap.h index 982fbe9208d9..398d669b7657 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -407,7 +407,6 @@ 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_set_page_dirty(struct page *page); -extern bool swap_slot_has_sync_io(swp_entry_t entry); int add_swap_extent(struct swap_info_struct *sis, unsigned long start_page, unsigned long nr_pages, sector_t start_block); int generic_swapfile_activate(struct swap_info_struct *, struct file *, diff --git a/mm/memory.c b/mm/memory.c index f0f025de0a48..71b83094acd5 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3298,14 +3298,8 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) * and can then take the readahead path instead of SWP_SYNCHRONOUS_IO. */ si = swp_swap_info(entry); - /* Moto lulei1: check sync_io on each page if we enabled Zram wb. - * Zram writeback will remove SWP_SYNCHRONOUS_IO flag as it has disk - * IO operation on writeback page during swap in. - */ if (si->flags & SWP_SYNCHRONOUS_IO && __swap_count(si, entry) == 1) skip_swapcache = true; - else if (__swap_count(si, entry) == 1 && swap_slot_has_sync_io(entry)) - skip_swapcache = true; page = lookup_swap_cache(entry, vma, vmf->address); swapcache = page; @@ -3334,7 +3328,7 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) ret = VM_FAULT_RETRY; goto out; } else { - page = swapin_readahead(entry, GFP_HIGHUSER_MOVABLE | __GFP_CMA, + page = swapin_readahead(entry, GFP_HIGHUSER_MOVABLE, vmf); swapcache = page; } diff --git a/mm/page_io.c b/mm/page_io.c index b5910b62446c..855e7ea3615a 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -74,23 +74,6 @@ void end_swap_bio_write(struct bio *bio) bio_put(bio); } -/* Moto lulei1: check sync_io state on swap entry */ -bool swap_slot_has_sync_io(swp_entry_t entry) -{ - struct swap_info_struct *sis; - struct gendisk *disk; - - sis = swp_swap_info(entry); - disk = sis->bdev->bd_disk; - if (disk->fops->ioctl) { - return disk->fops->ioctl(sis->bdev, 0, - SWP_SYNCHRONOUS_IO, swp_offset(entry)) == 1; - } - - return (sis->flags & SWP_SYNCHRONOUS_IO) == SWP_SYNCHRONOUS_IO; -} - - static void end_swap_bio_read(struct bio *bio) { struct page *page = bio_first_page_all(bio); @@ -326,7 +309,6 @@ int swap_readpage(struct page *page, bool synchronous) blk_qc_t qc; struct gendisk *disk; unsigned long pflags; - swp_entry_t entry; VM_BUG_ON_PAGE(!PageSwapCache(page) && !synchronous, page); VM_BUG_ON_PAGE(!PageLocked(page), page); @@ -355,22 +337,6 @@ int swap_readpage(struct page *page, bool synchronous) goto out; } - /* Moto lulei1: Use rw_page for zram page but submit_bio for zram wb page. - * Since reading zram wb page is an async operation, we can not immediately - * free the slot here. So we need to read the page via submit_bio and free - * the slot in end_swap_bio_read. (bio chain will be used to handle bio here - * and bio in zram driver for wb page). - */ - entry.val = page_private(page); - if (swap_slot_has_sync_io(entry)) { - ret = bdev_read_page(sis->bdev, swap_page_sector(page), page); - if (!ret) { - - count_vm_event(PSWPIN); - goto out; - } - } - ret = 0; bio = get_swap_bio(GFP_KERNEL, page, end_swap_bio_read); if (bio == NULL) { diff --git a/mm/swap_state.c b/mm/swap_state.c index 07c16bf79ec6..23d83578b136 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -654,9 +654,6 @@ struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, struct vm_area_struct *vma = vmf->vma; unsigned long addr = vmf->address; - /* Moto lulei1: don't readahead sync io pages */ - if (swap_slot_has_sync_io(entry)) - goto skip; mask = swapin_nr_pages(offset) - 1; if (!mask) @@ -673,9 +670,6 @@ struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, blk_start_plug(&plug); for (offset = start_offset; offset <= end_offset ; offset++) { - /* Moto lulei1: don't readahead sync io pages */ - if (swap_slot_has_sync_io(swp_entry(swp_type(entry), offset))) - continue; /* Ok, do the async read-ahead now */ page = __read_swap_cache_async( swp_entry(swp_type(entry), offset), @@ -824,11 +818,6 @@ static struct page *swap_vma_readahead(swp_entry_t fentry, gfp_t gfp_mask, unsigned int i; bool page_allocated; struct vma_swap_readahead ra_info = {0,}; - /* Moto lulei1: don't readahead sync io pages */ - if (swap_slot_has_sync_io(fentry)) { - ra_info.win = 1; - goto skip; - } swap_ra_info(vmf, &ra_info); if (ra_info.win == 1) @@ -845,9 +834,6 @@ static struct page *swap_vma_readahead(swp_entry_t fentry, gfp_t gfp_mask, entry = pte_to_swp_entry(pentry); if (unlikely(non_swap_entry(entry))) continue; - /* Moto lulei1: don't readahead sync io pages */ - if (swap_slot_has_sync_io(entry)) - continue; page = __read_swap_cache_async(entry, gfp_mask, vma, vmf->address, &page_allocated); if (!page)