All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: mm-commits@vger.kernel.org, zhouchengming@bytedance.com,
	yosryahmed@google.com, v-songbaohua@oppo.com,
	vitaly.wool@konsulko.com, sjenning@redhat.com,
	senozhatsky@chromium.org, nphamcs@gmail.com, minchan@kernel.org,
	hannes@cmpxchg.org, ddstreet@ieee.org, chrisl@kernel.org,
	21cnbao@gmail.com
Subject: Re: + mm-zsmalloc-return-enospc-rather-than-einval-in-zs_malloc-while-size-is-too-large.patch added to mm-unstable branch
Date: Tue, 2 Jan 2024 10:21:46 +0900	[thread overview]
Message-ID: <20240102012146.GC21409@google.com> (raw)
In-Reply-To: <20231228191226.51357C433C8@smtp.kernel.org>

On (23/12/28 11:12), Andrew Morton wrote:
> This is the case the "compressed" data is larger than the original data,
> it is better to return -ENOSPC which can help zswap record a poor compr
> rather than an invalid request.  Then we get more friendly counting for
> reject_compress_poor in debugfs.
> 
>  bool zswap_store(struct folio *folio)
>  {
>  	...
>  	ret = zpool_malloc(zpool, dlen, gfp, &handle);
>  	if (ret == -ENOSPC) {
>  		zswap_reject_compress_poor++;
>  		goto put_dstmem;
>  	}
>  	if (ret) {
>  		zswap_reject_alloc_fail++;
>  		goto put_dstmem;
>  	}
>  	...
>  }
> 
> Also, zbud_alloc() and z3fold_alloc() are returning ENOSPC in the same
> case, eg
> 
>  static int z3fold_alloc(struct z3fold_pool *pool, size_t size, gfp_t gfp,
>  			unsigned long *handle)
>  {
>  	...
>  	if (!size || (gfp & __GFP_HIGHMEM))
>  		return -EINVAL;
> 
>  	if (size > PAGE_SIZE)
>  		return -ENOSPC;
>  	...
>  }
> 
> Link: https://lkml.kernel.org/r/20231228061802.25280-1-v-songbaohua@oppo.com
> Signed-off-by: Barry Song <v-songbaohua@oppo.com>
> Reviewed-by: Chengming Zhou <zhouchengming@bytedance.com>
> Cc: Chris Li <chrisl@kernel.org>
> Cc: Dan Streetman <ddstreet@ieee.org>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Minchan Kim <minchan@kernel.org>
> Cc: Nhat Pham <nphamcs@gmail.com>
> Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
> Cc: Seth Jennings <sjenning@redhat.com>
> Cc: Vitaly Wool <vitaly.wool@konsulko.com>
> Cc: Yosry Ahmed <yosryahmed@google.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Acked-by: Sergey Senozhatsky <senozhatsky@chromium.org>

      reply	other threads:[~2024-01-02  1:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-28 19:12 + mm-zsmalloc-return-enospc-rather-than-einval-in-zs_malloc-while-size-is-too-large.patch added to mm-unstable branch Andrew Morton
2024-01-02  1:21 ` Sergey Senozhatsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240102012146.GC21409@google.com \
    --to=senozhatsky@chromium.org \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chrisl@kernel.org \
    --cc=ddstreet@ieee.org \
    --cc=hannes@cmpxchg.org \
    --cc=minchan@kernel.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=nphamcs@gmail.com \
    --cc=sjenning@redhat.com \
    --cc=v-songbaohua@oppo.com \
    --cc=vitaly.wool@konsulko.com \
    --cc=yosryahmed@google.com \
    --cc=zhouchengming@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.