On Wed, May 13, 2020, 2:36 AM Qian Cai <cai@lca.pw> wrote:
Put zswap z3fold pages into the memory and then offline those memory would trigger an infinite loop here in

__offline_pages() --> do_migrate_range() because there is no error handling,

                        if (pfn) {
                                /*
                                 * TODO: fatal migration failures should bail
                                 * out
                                 */
                                do_migrate_range(pfn, end_pfn);

There, isolate_movable_page() will always return -EBUSY  because,

        if (!mapping->a_ops->isolate_page(page, mode))
                goto out_no_isolated;

i.e., z3fold_page_isolate() will always return false because,

zhdr->mapped_count == 2

So who mapped these pages? The whole zswap operation presumes that objects are mapped for a short while to run some I/O and so, most of the time zhdr->mapped_count would be 0.

Removing that check in ->isolate() is not a big deal, but ->migratepage() shall not allow actual migration anyway if there are mapped objects. 

~Vitaly