On Mon, Dec 18, 2023 at 12:15 AM Chengming Zhou <zhouchengming@xxxxxxxxxxxxx> wrote: > > On 2023/12/14 08:52, Yosry Ahmed wrote: > > On Tue, Dec 12, 2023 at 8:18 PM Chengming Zhou > > <zhouchengming@xxxxxxxxxxxxx> wrote: > >> > >> The zswap_load() and zswap_writeback_entry() have the same part that > >> decompress the data from zswap_entry to page, so refactor out the > >> common part as __zswap_load(entry, page). > >> > >> Signed-off-by: Chengming Zhou <zhouchengming@xxxxxxxxxxxxx> > >> Reviewed-by: Nhat Pham <nphamcs@xxxxxxxxx> > > > > On a second look, there a few nits here. > > > > First I think it makes more sense to move this refactoring ahead of > > reusing destmem. Right now, we add the destmem reuse to zswap_load() > > only, then we do the refactor and zswap_writeback_entry() gets it > > automatically, so there is a slight change coming to > > zswap_writeback_entry() hidden in the refactoring patch. > > > > Let's refactor out __zswap_load() first, then reuse destmem in it. > > I tried but found that putting the __zswap_load() first would introduce > another failure case in zswap_writeback_entry(), since the temporary > memory allocation may fail. > > So instead, I also move the dstmem reusing in zswap_writeback_entry() to > the dstmem reusing patch. Then this patch becomes having only refactoring. We could have still refactored __zswap_load() first by making it return an int initially when split, then void later. Anyway, it's not a big deal. The new series looks fine.