From: Chengming Zhou <chengming.zhou@linux.dev>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: 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:44:13 +0800 [thread overview]
Message-ID: <a65ac3ad-9dfd-4da7-99e2-d23ab28b3729@linux.dev> (raw)
In-Reply-To: <20240228060113.GJ11972@google.com>
On 2024/2/28 14:01, Sergey Senozhatsky wrote:
> On (24/02/27 03:02), Chengming Zhou wrote:
>> static void __free_zspage(struct zs_pool *pool, struct size_class *class,
>> struct zspage *zspage)
>> {
>> @@ -834,13 +841,12 @@ static void __free_zspage(struct zs_pool *pool, struct size_class *class,
>> VM_BUG_ON_PAGE(!PageLocked(page), page);
>
> Who owns page lock here if free_zspage() doesn't trylock_zspage() no longer?
Right, it should be removed.
>
>> next = get_next_page(page);
>> reset_page(page);
>> - unlock_page(page);
>> dec_zone_page_state(page, NR_ZSPAGES);
>> put_page(page);
>> page = next;
>> } while (page != NULL);
>>
>> - cache_free_zspage(pool, zspage);
>> + call_rcu(&zspage->rcu_head, rcu_free_zspage);
>>
>> class_stat_dec(class, ZS_OBJS_ALLOCATED, class->objs_per_zspage);
>> atomic_long_sub(class->pages_per_zspage, &pool->pages_allocated);
>> @@ -852,16 +858,6 @@ static void free_zspage(struct zs_pool *pool, struct size_class *class,
>> VM_BUG_ON(get_zspage_inuse(zspage));
>> VM_BUG_ON(list_empty(&zspage->list));
>>
>> - /*
>> - * Since zs_free couldn't be sleepable, this function cannot call
>> - * lock_page. The page locks trylock_zspage got will be released
>> - * by __free_zspage.
>> - */
>> - if (!trylock_zspage(zspage)) {
>> - kick_deferred_free(pool);
>> - return;
>> - }
>> -
>> remove_zspage(class, zspage);
>> __free_zspage(pool, class, zspage);
>> }
next prev parent reply other threads:[~2024-02-28 6:44 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
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 [this message]
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=a65ac3ad-9dfd-4da7-99e2-d23ab28b3729@linux.dev \
--to=chengming.zhou@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=nphamcs@gmail.com \
--cc=senozhatsky@chromium.org \
--cc=yosryahmed@google.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