linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	Chengming Zhou <zhouchengming@bytedance.com>,
	yosryahmed@google.com, hannes@cmpxchg.org, nphamcs@gmail.com,
	Andrew Morton <akpm@linux-foundation.org>,
	Minchan Kim <minchan@kernel.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 1/2] mm/zsmalloc: don't hold locks of all pages when free_zspage()
Date: Wed, 28 Feb 2024 14:29:06 +0900	[thread overview]
Message-ID: <20240228052906.GI11972@google.com> (raw)
In-Reply-To: <5a556476-05b2-483e-8875-eeb3e2a51151@linux.dev>

On (24/02/28 13:14), Chengming Zhou wrote:
> On 2024/2/28 12:33, Sergey Senozhatsky wrote:
> > On (24/02/27 03:02), Chengming Zhou wrote:
> > [..]
> >> @@ -978,10 +974,11 @@ static struct zspage *alloc_zspage(struct zs_pool *pool,
> >>  		pages[i] = page;
> >>  	}
> >>  
> >> -	create_page_chain(class, zspage, pages);
> >>  	init_zspage(class, zspage);
> >>  	zspage->pool = pool;
> >>  	zspage->class = class->index;
> >> +	/* RCU set_zspage() after zspage initialized. */
> >> +	create_page_chain(class, zspage, pages);
> > 
> > So this hasn't been tested, has it?
> I have tested it in my test vm, but it hasn't KASAN enabled. I tested the
> kernel build in tmpfs with zswap enabled using zsmalloc pool, not sure
> why the kernel didn't crash then...

I hit the problem on non-kasan-enabled kernel.  KASAN was enabled
later on.

[..]

> > So when init_zspage() calls get_first_page() it gets NULL zspage->first_page
> > which we then use in is_first_page(first_page)->PagePrivate(page). As far as
> > I can tell.
>
> Thanks! I will fix it and test throughly before send an update.

I'm curious if we want to add RCU to the picture, given that zsmalloc
is quite often run under memory pressure.


  reply	other threads:[~2024-02-28  5:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27  3:02 [PATCH 0/2] mm/zsmalloc: simplify synchronization between zs_page_migrate() and free_zspage() Chengming Zhou
2024-02-27  3:02 ` [PATCH 1/2] mm/zsmalloc: don't hold locks of all pages when free_zspage() Chengming Zhou
2024-02-28  4:33   ` Sergey Senozhatsky
2024-02-28  5:14     ` Chengming Zhou
2024-02-28  5:29       ` Sergey Senozhatsky [this message]
2024-02-28  5:42         ` Chengming Zhou
2024-02-28  6:07           ` Sergey Senozhatsky
2024-02-28  6:01   ` Sergey Senozhatsky
2024-02-28  6:44     ` Chengming Zhou
2024-02-28  6:14   ` Sergey Senozhatsky
2024-02-28  6:49     ` Chengming Zhou
2024-02-27  3:02 ` [PATCH 2/2] mm/zsmalloc: remove the deferred free mechanism Chengming Zhou
2024-02-28  1:57 ` [PATCH 0/2] mm/zsmalloc: simplify synchronization between zs_page_migrate() and free_zspage() Sergey Senozhatsky
2024-02-28  2:22   ` [External] " Chengming Zhou
2024-02-28  3:54 ` 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=20240228052906.GI11972@google.com \
    --to=senozhatsky@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=chengming.zhou@linux.dev \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=nphamcs@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).