lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 17 Nov 2022 14:25:52 -0800
From:   Minchan Kim <minchan@...nel.org>
To:     Nhat Pham <nphamcs@...il.com>
Cc:     akpm@...ux-foundation.org, hannes@...xchg.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, ngupta@...are.org,
        senozhatsky@...omium.org, sjenning@...hat.com, ddstreet@...e.org,
        vitaly.wool@...sulko.com
Subject: Re: [PATCH v4 4/5] zsmalloc: Add ops fields to zs_pool to store
 evict handlers

On Thu, Nov 17, 2022 at 08:38:38AM -0800, Nhat Pham wrote:
> This adds fields to zs_pool to store evict handlers for writeback,
> analogous to the zbud allocator.
> 
> Signed-off-by: Nhat Pham <nphamcs@...il.com>
> ---
>  mm/zsmalloc.c | 35 ++++++++++++++++++++++++++++++++++-
>  1 file changed, 34 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> index 2557b55ec767..776d0e15a401 100644
> --- a/mm/zsmalloc.c
> +++ b/mm/zsmalloc.c
> @@ -225,6 +225,12 @@ struct link_free {
>  	};
>  };
> 
> +struct zs_pool;
> +
> +struct zs_ops {
> +	int (*evict)(struct zs_pool *pool, unsigned long handle);
> +};
> +
>  struct zs_pool {
>  	const char *name;
> 
> @@ -242,6 +248,9 @@ struct zs_pool {
>  #ifdef CONFIG_ZPOOL
>  	/* List tracking the zspages in LRU order by most recently added object */
>  	struct list_head lru;
> +	const struct zs_ops *ops;
> +	struct zpool *zpool;
> +	const struct zpool_ops *zpool_ops;
>  #endif
> 
>  #ifdef CONFIG_ZSMALLOC_STAT
> @@ -385,6 +394,18 @@ static void record_obj(unsigned long handle, unsigned long obj)
> 
>  #ifdef CONFIG_ZPOOL
> 
> +static int zs_zpool_evict(struct zs_pool *pool, unsigned long handle)
> +{
> +	if (pool->zpool && pool->zpool_ops && pool->zpool_ops->evict)
> +		return pool->zpool_ops->evict(pool->zpool, handle);
> +	else
> +		return -ENOENT;
> +}
> +
> +static const struct zs_ops zs_zpool_ops = {
> +	.evict =	zs_zpool_evict
> +};
> +
>  static void *zs_zpool_create(const char *name, gfp_t gfp,
>  			     const struct zpool_ops *zpool_ops,
>  			     struct zpool *zpool)
> @@ -394,7 +415,19 @@ static void *zs_zpool_create(const char *name, gfp_t gfp,
>  	 * different contexts and its caller must provide a valid
>  	 * gfp mask.
>  	 */
> -	return zs_create_pool(name);
> +	struct zs_pool *pool = zs_create_pool(name);
> +
> +	if (pool) {
> +		pool->zpool = zpool;
> +		pool->zpool_ops = zpool_ops;
> +
> +		if (zpool_ops)

I lost. When do we have zpool_ops as NULL?

Powered by blists - more mailing lists