• Yosry Ahmed's avatar
    mm: zswap: support exclusive loads · b9c91c43
    Yosry Ahmed authored
    Commit 71024cb4 ("frontswap: remove frontswap_tmem_exclusive_gets")
    removed support for exclusive loads from frontswap as it was not used. 
    Bring back exclusive loads support to frontswap by adding an "exclusive"
    output parameter to frontswap_ops->load.
    
    On the zswap side, add a module parameter to enable/disable exclusive
    loads, and a config option to control the boot default value.  Refactor
    zswap entry invalidation in zswap_frontswap_invalidate_page() into
    zswap_invalidate_entry() to reuse it in zswap_frontswap_load() if
    exclusive loads are enabled.
    
    With exclusive loads, we avoid having two copies of the same page in
    memory (compressed & uncompressed) after faulting it in from zswap.  On
    the other hand, if the page is to be reclaimed again without being
    dirtied, it will be re-compressed.  Compression is not usually slow, and a
    page that was just faulted in is less likely to be reclaimed again soon.
    
    Link: https://lkml.kernel.org/r/20230607195143.1473802-1-yosryahmed@google.comSigned-off-by: default avatarYosry Ahmed <yosryahmed@google.com>
    Suggested-by: default avatarYu Zhao <yuzhao@google.com>
    Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
    Cc: Dan Streetman <ddstreet@ieee.org>
    Cc: Domenico Cerasuolo <cerasuolodomenico@gmail.com>
    Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Cc: Nhat Pham <nphamcs@gmail.com>
    Cc: Seth Jennings <sjenning@redhat.com>
    Cc: Vitaly Wool <vitaly.wool@konsulko.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    b9c91c43
frontswap.c 8.02 KB