From: Matthew Wilcox <willy@infradead.org>
To: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Cc: Minchan Kim <minchan@kernel.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, Vishal Moola <vishal.moola@gmail.com>,
Alex Shi <seakeel@gmail.com>, Alex Shi <alexs@kernel.org>
Subject: Re: [PATCH v9 mm-unstable 11/18] mm/zsmalloc: convert reset_page to reset_zpdesc
Date: Fri, 10 Jan 2025 04:43:16 +0000 [thread overview]
Message-ID: <Z4ClZM1ebPDKrdZQ@casper.infradead.org> (raw)
In-Reply-To: <20241216150450.1228021-12-42.hyeyoo@gmail.com>
On Tue, Dec 17, 2024 at 12:04:42AM +0900, Hyeonggon Yoo wrote:
> From: Alex Shi <alexs@kernel.org>
>
> zpdesc.zspage matches with page.private, zpdesc.next matches with
> page.index. They will be reset in reset_page() which is called prior to
> free base pages of a zspage.
>
> Since the fields that need to be initialized are independent of the
> order in struct zpdesc, Keep it to use struct page to ensure robustness
> against potential rearrangements of struct zpdesc fields in the future.
>
> [42.hyeyoo: keep reset_zpdesc() to use struct page fields]
Ummm ... why did you make this change? Now page->index still has a user
in zsmalloc ;-(
> Signed-off-by: Alex Shi <alexs@kernel.org>
> Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
> ---
> mm/zsmalloc.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> index 432e78e61d2e..dded6d1f3b7a 100644
> --- a/mm/zsmalloc.c
> +++ b/mm/zsmalloc.c
> @@ -843,8 +843,10 @@ static inline bool obj_allocated(struct zpdesc *zpdesc, void *obj,
> return true;
> }
>
> -static void reset_page(struct page *page)
> +static void reset_zpdesc(struct zpdesc *zpdesc)
> {
> + struct page *page = zpdesc_page(zpdesc);
> +
> __ClearPageMovable(page);
> ClearPagePrivate(page);
> set_page_private(page, 0);
> @@ -887,7 +889,7 @@ static void __free_zspage(struct zs_pool *pool, struct size_class *class,
> do {
> VM_BUG_ON_PAGE(!PageLocked(page), page);
> next = get_next_page(page);
> - reset_page(page);
> + reset_zpdesc(page_zpdesc(page));
> unlock_page(page);
> dec_zone_page_state(page, NR_ZSPAGES);
> put_page(page);
> @@ -1865,7 +1867,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page,
> zpdesc_inc_zone_page_state(newzpdesc);
> }
>
> - reset_page(page);
> + reset_zpdesc(zpdesc);
> zpdesc_put(zpdesc);
>
> return MIGRATEPAGE_SUCCESS;
> --
> 2.43.5
>
next prev parent reply other threads:[~2025-01-10 4:43 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-16 15:04 [PATCH v9 mm-unstable 00/18] Add zpdesc memory descriptor for zswap.zpool Hyeonggon Yoo
2024-12-16 15:04 ` [PATCH v9 mm-unstable 01/18] mm/zsmalloc: add " Hyeonggon Yoo
2024-12-16 15:04 ` [PATCH v9 mm-unstable 02/18] mm/zsmalloc: use zpdesc in trylock_zspage()/lock_zspage() Hyeonggon Yoo
2024-12-16 15:04 ` [PATCH v9 mm-unstable 03/18] mm/zsmalloc: convert __zs_map_object/__zs_unmap_object to use zpdesc Hyeonggon Yoo
2024-12-16 15:04 ` [PATCH v9 mm-unstable 04/18] mm/zsmalloc: add and use pfn/zpdesc seeking funcs Hyeonggon Yoo
2024-12-16 15:04 ` [PATCH v9 mm-unstable 05/18] mm/zsmalloc: convert obj_malloc() to use zpdesc Hyeonggon Yoo
2024-12-16 15:04 ` [PATCH v9 mm-unstable 06/18] mm/zsmalloc: convert create_page_chain() and its users " Hyeonggon Yoo
2024-12-16 15:04 ` [PATCH v9 mm-unstable 07/18] mm/zsmalloc: convert obj_allocated() and related helpers " Hyeonggon Yoo
2024-12-16 15:04 ` [PATCH v9 mm-unstable 08/18] mm/zsmalloc: convert init_zspage() " Hyeonggon Yoo
2024-12-16 15:04 ` [PATCH v9 mm-unstable 09/18] mm/zsmalloc: convert obj_to_page() and zs_free() " Hyeonggon Yoo
2024-12-16 15:04 ` [PATCH v9 mm-unstable 10/18] mm/zsmalloc: add two helpers for zs_page_migrate() and make it " Hyeonggon Yoo
2024-12-16 15:04 ` [PATCH v9 mm-unstable 11/18] mm/zsmalloc: convert reset_page to reset_zpdesc Hyeonggon Yoo
2025-01-10 4:43 ` Matthew Wilcox [this message]
2025-01-10 6:08 ` Hyeonggon Yoo
2025-01-11 1:32 ` Andrew Morton
2025-01-13 15:29 ` [PATCH v9 mm-unstable 19/19] mm/zsmalloc: reset zpdesc fields in reset_zpdesc() Hyeonggon Yoo
2024-12-16 15:04 ` [PATCH v9 mm-unstable 12/18] mm/zsmalloc: convert __free_zspage() to use zpdesc Hyeonggon Yoo
2024-12-16 15:04 ` [PATCH v9 mm-unstable 13/18] mm/zsmalloc: convert location_to_obj() to take zpdesc Hyeonggon Yoo
2024-12-16 15:04 ` [PATCH v9 mm-unstable 14/18] mm/zsmalloc: convert migrate_zspage() to use zpdesc Hyeonggon Yoo
2024-12-16 15:04 ` [PATCH v9 mm-unstable 15/18] mm/zsmalloc: convert get_zspage() to take zpdesc Hyeonggon Yoo
2024-12-16 15:04 ` [PATCH v9 mm-unstable 16/18] mm/zsmalloc: convert SetZsPageMovable and remove unused funcs Hyeonggon Yoo
2024-12-16 15:04 ` [PATCH v9 mm-unstable 17/18] mm/zsmalloc: convert get/set_first_obj_offset() to take zpdesc Hyeonggon Yoo
2024-12-16 15:04 ` [PATCH v9 mm-unstable 18/18] mm/zsmalloc: introduce __zpdesc_clear/set_zsmalloc() Hyeonggon Yoo
2024-12-26 1:54 ` [PATCH v9 mm-unstable 00/18] Add zpdesc memory descriptor for zswap.zpool Sergey Senozhatsky
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=Z4ClZM1ebPDKrdZQ@casper.infradead.org \
--to=willy@infradead.org \
--cc=42.hyeyoo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alexs@kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=seakeel@gmail.com \
--cc=senozhatsky@chromium.org \
--cc=vishal.moola@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox