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]
Message-ID: <20230720074726.GF955071@google.com>
Date:   Thu, 20 Jul 2023 16:47:26 +0900
From:   Sergey Senozhatsky <senozhatsky@...omium.org>
To:     Hyeonggon Yoo <42.hyeyoo@...il.com>
Cc:     Minchan Kim <minchan@...nel.org>,
        Sergey Senozhatsky <senozhatsky@...omium.org>,
        Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, Matthew Wilcox <willy@...radead.org>,
        Mike Rapoport <rppt@...nel.org>
Subject: Re: [RFC PATCH v2 01/21] mm/zsmalloc: create new struct zsdesc

On (23/07/13 13:20), Hyeonggon Yoo wrote:
>  /*
> @@ -264,6 +247,52 @@ struct mapping_area {
>  	enum zs_mapmode vm_mm; /* mapping mode */
>  };
>  

struct zspage already has a zsdesc member at this point, so I'd prefer
to move struct zsdesc definition before struct zspage.

> +/*
> + * struct zsdesc - memory descriptor for zsmalloc memory
> + *
> + * This struct overlays struct page for now. Do not modify without a
> + * good understanding of the issues.
> + *
> + * Usage of struct page flags on zsdesc:
> + *	PG_private: identifies the first component zsdesc
> + */
> +struct zsdesc {
> +	unsigned long flags;
> +
> +	/*
> +	 * Although not used by zsmalloc, this field is used by non-LRU page migration
> +	 * code. Leave it unused.
> +	 */
> +	struct list_head lru;
> +
> +	/* Always points to zsmalloc_mops with PAGE_MAPPING_MOVABLE set */
> +	struct movable_operations *mops;
> +
> +	union {
> +		/* linked list of all zsdescs in a zspage */
> +		struct zsdesc *next;
> +		/* for huge zspages */
> +		unsigned long handle;
> +	};
> +	struct zspage *zspage;
> +	unsigned int first_obj_offset;
> +	unsigned int _refcount;
> +};
> +
> +#define ZSDESC_MATCH(pg, zs) \
> +	static_assert(offsetof(struct page, pg) == offsetof(struct zsdesc, zs))
> +
> +ZSDESC_MATCH(flags, flags);
> +ZSDESC_MATCH(lru, lru);
> +ZSDESC_MATCH(mapping, mops);
> +ZSDESC_MATCH(index, next);
> +ZSDESC_MATCH(index, handle);
> +ZSDESC_MATCH(private, zspage);
> +ZSDESC_MATCH(page_type, first_obj_offset);
> +ZSDESC_MATCH(_refcount, _refcount);
> +#undef ZSDESC_MATCH
> +static_assert(sizeof(struct zsdesc) <= sizeof(struct page));
> +
>  /* huge object: pages_per_zspage == 1 && maxobj_per_zspage == 1 */
>  static void SetZsHugePage(struct zspage *zspage)
>  {
> -- 
> 2.41.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ