From: Zhongkun He <hezhongkun.hzk@bytedance.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org
Subject: Re: [External] Re: [PATCH] mm/z3fold:remove unneeded spinlock in z3fold_alloc
Date: Fri, 9 Feb 2024 01:29:29 +0800 [thread overview]
Message-ID: <CACSyD1MZ+=TnLFPEJ-owNFyhC4Tcf2_Sc=p4Lni9v6EGgm_39w@mail.gmail.com> (raw)
In-Reply-To: <20240208033401.GC185687@cmpxchg.org>
On Thu, Feb 8, 2024 at 11:34 AM Johannes Weiner <hannes@cmpxchg.org> wrote:
>
> On Sun, Feb 04, 2024 at 09:15:43PM +0800, Zhongkun He wrote:
> > The spinklock in z3fold_alloc() is used to protect page->lru,
> > but now it was removed in commit 'e774a7bc7f0ad', so remove
> > the spinlock too.
>
> The pool->lock clearly protects things other than page->lru.
Yes, it protects pool unbuddied lists now.
I mean the following page-lru is removed in z3fold_alloc:
headless:
spin_lock(&pool->lock);
- /* Add/move z3fold page to beginning of LRU */
- if (!list_empty(&page->lru))
- list_del(&page->lru);
-
- list_add(&page->lru, &pool->lru);
-
*handle = encode_handle(zhdr, bud);
spin_unlock(&pool->lock);
if (bud != HEADLESS)
z3fold_page_unlock(zhdr);
For more detail please see the commit 'e774a7bc7f0ad'.
>
> I'm not saying that you're wrong, but your changelog doesn't make a
> strong case that you're right, either ;)
>
Hi Johannes, I am confused by the annotation :
The __encode_handle() annotation show:
* Pool lock should be held as this function accesses first_num.
but I did not find any use cases where first_num was protected by pool lock.
Furthermore, encode_handle() is protected by z3fold_page_lock() as I can
see.
> Please CC Vitaly (scripts/get_maintainer.pl) on these patches.
Got it, thanks.
next prev parent reply other threads:[~2024-02-08 17:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-04 13:15 Zhongkun He
2024-02-08 3:34 ` Johannes Weiner
2024-02-08 17:29 ` Zhongkun He [this message]
2024-02-21 22:23 ` Andrew Morton
2024-02-22 2:40 ` [External] " Zhongkun He
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='CACSyD1MZ+=TnLFPEJ-owNFyhC4Tcf2_Sc=p4Lni9v6EGgm_39w@mail.gmail.com' \
--to=hezhongkun.hzk@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
/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