[PATCH -next v3 0/5] Delay the initializaton of zswap

Liu Shixin posted 5 patches 3 years, 7 months ago
There is a newer version of this series
include/linux/swapfile.h |  2 ++
mm/frontswap.c           | 50 +++++++++++++++++++++++++-
mm/swapfile.c            |  4 +--
mm/zswap.c               | 77 ++++++++++++++++++++++++++++++----------
4 files changed, 111 insertions(+), 22 deletions(-)
[PATCH -next v3 0/5] Delay the initializaton of zswap
Posted by Liu Shixin 3 years, 7 months ago
In the initialization of zswap, about 18MB memory will be allocated for       
zswap_pool. Since not all users use zswap, the memory may be wasted. Save  
the memory for these users by delaying the initialization of zswap to         
first enablement.                                                             
                                                                              
v2->v3: Fix frontswap_ops NULL reported by Nathan and add init for online
swap device in backend register.
v1->v2: Change init_zswap to zswap_init suggested by Andrew.

Liu Shixin (5):
  frontswap: skip frontswap_ops init if zswap init failed.
  frontswap: invoke ops->init for online swap device in
    frontswap_register_ops
  mm/zswap: replace zswap_init_{started/failed} with zswap_init_state
  mm/zswap: delay the initializaton of zswap until the first enablement
  mm/zswap: skip confusing print info

 include/linux/swapfile.h |  2 ++
 mm/frontswap.c           | 50 +++++++++++++++++++++++++-
 mm/swapfile.c            |  4 +--
 mm/zswap.c               | 77 ++++++++++++++++++++++++++++++----------
 4 files changed, 111 insertions(+), 22 deletions(-)

-- 
2.25.1
Re: [PATCH -next v3 0/5] Delay the initializaton of zswap
Posted by Andrew Morton 3 years, 7 months ago
On Sat, 27 Aug 2022 18:45:55 +0800 Liu Shixin <liushixin2@huawei.com> wrote:

> In the initialization of zswap, about 18MB memory will be allocated for       
> zswap_pool. Since not all users use zswap, the memory may be wasted. Save  
> the memory for these users by delaying the initialization of zswap to         
> first enablement.                                                             
>                                                                               
> v2->v3: Fix frontswap_ops NULL reported by Nathan and add init for online
> swap device in backend register.
> v1->v2: Change init_zswap to zswap_init suggested by Andrew.

Thanks.  Konrad, could you please take a look for the frontswap
changes?