From: Zhongkun He <hezhongkun.hzk@bytedance.com>
To: akpm@linux-foundation.org, vitaly.wool@konsulko.com
Cc: hannes@cmpxchg.org, linmiaohe@huawei.com, linux-mm@kvack.org,
Zhongkun He <hezhongkun.hzk@bytedance.com>
Subject: [PATCH] mm/z3fold: fix the comment for __encode_handle()
Date: Mon, 19 Feb 2024 10:44:53 +0800 [thread overview]
Message-ID: <20240219024453.2240147-1-hezhongkun.hzk@bytedance.com> (raw)
The comment is confusing that Pool lock should be held as this
function accesses first_num above the __encode_handle() because
first_num is the element of z3fold_header which is protected
by z3fold_header->page_lock.
I found the same comment for encode_handle() in zbud.c by accident
,Pool lock should be held as this function accesses first|last_chunks,
which is the element of zbud_header and it does not have any lock,
so pool lock should be held.
Z3fold is based on zbud, maybe the comment come from zbud,
but it was wrong, so fix it.
Signed-off-by: Zhongkun He <hezhongkun.hzk@bytedance.com>
---
mm/z3fold.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/mm/z3fold.c b/mm/z3fold.c
index 58946cacbfbb..446cd11e2cad 100644
--- a/mm/z3fold.c
+++ b/mm/z3fold.c
@@ -364,8 +364,9 @@ static inline int __idx(struct z3fold_header *zhdr, enum buddy bud)
}
/*
- * Encodes the handle of a particular buddy within a z3fold page
- * Pool lock should be held as this function accesses first_num
+ * Encodes the handle of a particular buddy within a z3fold page.
+ * Zhdr->page_lock should be held as this function accesses first_num
+ * if bud != HEADLESS.
*/
static unsigned long __encode_handle(struct z3fold_header *zhdr,
struct z3fold_buddy_slots *slots,
--
2.25.1
reply other threads:[~2024-02-19 2:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240219024453.2240147-1-hezhongkun.hzk@bytedance.com \
--to=hezhongkun.hzk@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linmiaohe@huawei.com \
--cc=linux-mm@kvack.org \
--cc=vitaly.wool@konsulko.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