• Dan Magenheimer's avatar
    frontswap: support exclusive gets if tmem backend is capable · e3483a5f
    Dan Magenheimer authored
    Tmem, as originally specified, assumes that "get" operations
    performed on persistent pools never flush the page of data out
    of tmem on a successful get, waiting instead for a flush
    operation.  This is intended to mimic the model of a swap
    disk, where a disk read is non-destructive.  Unlike a
    disk, however, freeing up the RAM can be valuable.  Over
    the years that frontswap was in the review process, several
    reviewers (and notably Hugh Dickins in 2010) pointed out that
    this would result, at least temporarily, in two copies of the
    data in RAM: one (compressed for zcache) copy in tmem,
    and one copy in the swap cache.  We wondered if this could
    be done differently, at least optionally.
    
    This patch allows tmem backends to instruct the frontswap
    code that this backend performs exclusive gets.  Zcache2
    already contains hooks to support this feature.  Other
    backends are completely unaffected unless/until they are
    updated to support this feature.
    
    While it is not clear that exclusive gets are a performance
    win on all workloads at all times, this small patch allows for
    experimentation by backends.
    
    P.S. Let's not quibble about the naming of "get" vs "read" vs
    "load" etc.  The naming is currently horribly inconsistent between
    cleancache and frontswap and existing tmem backends, so will need
    to be straightened out as a separate patch.  "Get" is used
    by the tmem architecture spec, existing backends, and
    all documentation and presentation material so I am
    using it in this patch.
    Signed-off-by: default avatarDan Magenheimer <dan.magenheimer@oracle.com>
    Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    e3483a5f
frontswap.c 10.3 KB