Re: + mm-zsmalloc-return-enospc-rather-than-einval-in-zs_malloc-while-size-is-too-large.patch added to mm-unstable branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx
> Signed-off-by: Barry Song <v-songbaohua@xxxxxxxx>
> Reviewed-by: Chengming Zhou <zhouchengming@xxxxxxxxxxxxx>
> Cc: Chris Li <chrisl@xxxxxxxxxx>
> Cc: Dan Streetman <ddstreet@xxxxxxxx>
> Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
> Cc: Minchan Kim <minchan@xxxxxxxxxx>
> Cc: Nhat Pham <nphamcs@xxxxxxxxx>
> Cc: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
> Cc: Seth Jennings <sjenning@xxxxxxxxxx>
> Cc: Vitaly Wool <vitaly.wool@xxxxxxxxxxxx>
> Cc: Yosry Ahmed <yosryahmed@xxxxxxxxxx>
> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>

Acked-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux