lkml.org 
[lkml]   [2024]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [RFC PATCH 8/9] mm: zswap: do not check the global limit for zero-filled pages
    From
    On 2024/3/26 07:50, Yosry Ahmed wrote:
    > When storing zero-filled pages, there is no point of checking the global
    > zswap limit. These pages do not consume any memory that contributes
    > toward the limit. Move the limit checking after zero-filled pages are
    > handled.
    >
    > This avoids having zero-filled pages skip zswap and go to disk swap if
    > the limit is hit. It also avoids queueing the shrink worker, which may
    > end up being unnecessary if the zswap usage goes down on its own before
    > another store is attempted.
    >
    > Ignoring the memcg limits as well for zero-filled pages is more
    > controversial. Those limits are more a matter of per-workload policy.
    > Some workloads disable zswap completely by setting memory.zswap.max = 0,
    > and those workloads could start observing some zswap activity even after
    > disabling zswap. Although harmless, this could cause confusion to
    > userspace. Remain conservative and keep respecting those limits.
    >
    > Signed-off-by: Yosry Ahmed <yosryahmed@google.com>

    Yeah, it looks reasonable to keep the memcg limits check.

    Reviewed-by: Chengming Zhou <chengming.zhou@linux.dev>

    Thanks.

    > ---
    > mm/zswap.c | 6 +++---
    > 1 file changed, 3 insertions(+), 3 deletions(-)
    >
    > diff --git a/mm/zswap.c b/mm/zswap.c
    > index efc323bab2f22..9357328d940af 100644
    > --- a/mm/zswap.c
    > +++ b/mm/zswap.c
    > @@ -1460,9 +1460,6 @@ bool zswap_store(struct folio *folio)
    > mem_cgroup_put(memcg);
    > }
    >
    > - if (!zswap_check_limit())
    > - goto reject;
    > -
    > if (zswap_is_folio_zero_filled(folio)) {
    > if (zswap_store_zero_filled(tree, offset, objcg))
    > goto reject;
    > @@ -1472,6 +1469,9 @@ bool zswap_store(struct folio *folio)
    > if (!zswap_non_zero_filled_pages_enabled)
    > goto reject;
    >
    > + if (!zswap_check_limit())
    > + goto reject;
    > +
    > entry = zswap_entry_cache_alloc(GFP_KERNEL, folio_nid(folio));
    > if (!entry) {
    > zswap_reject_kmemcache_fail++;

    \
     
     \ /
      Last update: 2024-05-27 16:13    [W:5.406 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site