From patchwork Mon Feb 19 02:44:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhongkun He X-Patchwork-Id: 13562138 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7761DC48BC4 for ; Mon, 19 Feb 2024 02:45:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0E4AE6B0082; Sun, 18 Feb 2024 21:45:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 095086B0085; Sun, 18 Feb 2024 21:45:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E9E246B0088; Sun, 18 Feb 2024 21:45:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id D559D6B0082 for ; Sun, 18 Feb 2024 21:45:06 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 9C9AD401F3 for ; Mon, 19 Feb 2024 02:45:06 +0000 (UTC) X-FDA: 81807011412.15.7BA1344 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by imf07.hostedemail.com (Postfix) with ESMTP id 11AE440007 for ; Mon, 19 Feb 2024 02:45:03 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Sk7IFe1M; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf07.hostedemail.com: domain of hezhongkun.hzk@bytedance.com designates 209.85.216.48 as permitted sender) smtp.mailfrom=hezhongkun.hzk@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708310704; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=B5FNIAJ63+vLZDKi4er54RzkgZzvtf5tz1m1yAjo2vw=; b=IwuDsiPjxjpgrwfc45e2viYFtMIAqxt+14riyApFn5iVaT75lZaI2f2+GSO96trVMpqN1t +2PoqT9ChiXjx58jXyGghq+894wpdoyg2rkkA/iG0adThmS6yzT63Tcj1dZ9Sy3GH66HUl Hy5mrzduyLQbc8/bO0074z/WvvIQHe0= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Sk7IFe1M; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf07.hostedemail.com: domain of hezhongkun.hzk@bytedance.com designates 209.85.216.48 as permitted sender) smtp.mailfrom=hezhongkun.hzk@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708310704; a=rsa-sha256; cv=none; b=4lLCrLLgK87LUDDC3Obdt5WPzdLKRQjDRsm0bdRBUZvU7pQnEicfaQk/0gcnWmL2uBkg3+ Y/FcLsbrJnp9//4dHVOzSBn3Ka9b9P/gCGdHQP6mNweStE6WwTj5mkFjr94hwB8h6hOs88 t303cVcmKam7JtOuHysPlQ9bsjY7Kro= Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-2999329dfe7so492297a91.0 for ; Sun, 18 Feb 2024 18:45:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1708310702; x=1708915502; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=B5FNIAJ63+vLZDKi4er54RzkgZzvtf5tz1m1yAjo2vw=; b=Sk7IFe1MsYL073SGpWV87ugcHlnrQyZ6MgTq54Q2hD/RU88/w8U5H6YA/u/+3YYaj3 wlaMLbjHqO/HAnu1VoVB270rDLdWwatoxn0LFn+4dH4taU/bICOo4B+pn3FpE/d1ijCI PHjpIc4ASmBjKtqHGgCVqsQ1Z7J+o2V2MNhnpYHwbVDHk+7FmGxzlQd+D4VvBrX8v9kd 48iot3Gr0CVNpPBDb3Q3tvkmwtjvfeSy7aUZ6L5QAmujTA4lugIXQzRSlnSfq8yoX286 y9+HhqWq6L1/4SYV5WY3MFT05w2rfbm94QLtfQ11dBCvc9UVgkFjao7qMUuMFJX+0sBA SgDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708310702; x=1708915502; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=B5FNIAJ63+vLZDKi4er54RzkgZzvtf5tz1m1yAjo2vw=; b=XnRhuf9WoeDOWfeaFWXhIIm+RAwfgOT4nWS6SBoEn8NrcGreQ9qojS5ktiACFaZl2Y MNYMNaIT2Lm1H4eEmrjU4K70u7JHu6hUlQcYf9Q7Dk0oMi0b+OHPV+ktZuetE79lPeKk rjPb9cqNbzKyFbNb/HUgBtr0EzpsoSSljLPzrvBk3bEHQGBnohp4H+nf6swTWh96jMhp CfvxJqWDNg51Vm+vPsfI11AS5QwULRfzMdBd6xuJTz+Xi1E5EH5d24h+VRM97GIzDOJk U+ifgWBe8EmR87SCMyfzOU3kb1rVWUWQ4ukii8yM2817SPI7kVLvzd/X58wNButL2cRh EM+A== X-Forwarded-Encrypted: i=1; AJvYcCVo3GsR/iQi7vD8dLYBefPY5xaO+1yrVFdjJaAF2eOSjI7YyME1bjz0KiurSCEVGEeJ1O0tuZHkmFgBs0vOkDjL5wI= X-Gm-Message-State: AOJu0YwwpL0qeOq+q3I8+SAR9n/24B0j0n1iNmKCJEn6z5r9Sn87D9+F UfXYVLkSs6Q9ZcgmfPfKL1awizH2K7SxTCVPAg1FJu3ItyigrD/v7LoSqvI1NcE= X-Google-Smtp-Source: AGHT+IHhffi5/d5nusOUdJfM2CHZqf9heQpHy2HuJNlQ6AIipT59MZXUdI3ZBQGJNnsyL/WeJ3mGrg== X-Received: by 2002:a17:90a:d157:b0:299:64d8:10ef with SMTP id t23-20020a17090ad15700b0029964d810efmr2749582pjw.10.1708310702667; Sun, 18 Feb 2024 18:45:02 -0800 (PST) Received: from Tower.bytedance.net ([203.208.167.154]) by smtp.gmail.com with ESMTPSA id sb5-20020a17090b50c500b0029724370ea9sm3952032pjb.47.2024.02.18.18.44.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 18:45:02 -0800 (PST) From: Zhongkun He To: akpm@linux-foundation.org, vitaly.wool@konsulko.com Cc: hannes@cmpxchg.org, linmiaohe@huawei.com, linux-mm@kvack.org, Zhongkun He Subject: [PATCH] mm/z3fold: fix the comment for __encode_handle() Date: Mon, 19 Feb 2024 10:44:53 +0800 Message-Id: <20240219024453.2240147-1-hezhongkun.hzk@bytedance.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 11AE440007 X-Stat-Signature: 3u6pse758cn9rathchoxp9feh3bqqwkw X-Rspam-User: X-HE-Tag: 1708310703-145996 X-HE-Meta: U2FsdGVkX18pJOedUsiXs+H+Tn+Aww1Sb6PBF2DZXmcDiGxYdPf9lewhJYMKsPL8P6TZBNAtx4MzxVrmYJZdwi8OrKfKVPB6vrQiJI2NkJgZsD05qfN5nj4+T7CxYbk61P5CRTbsW33tlkOr/cffTZ/YziiJhN3gTnsOFt3vrUojl91kAUj8WV81qriu5OJ8knCxxCGgx4NtTfw+L7dNGkdG79YEwaNRvPvpdAd40r+3valYyVsd1Yt9wCxMgRNoosfZ1e/eBHAQWPu4aqanKrcPVUj3oavuqJM00y1Qgq1tAEUnOY0wfd3PiSyKiqURrG3iA6FOj2WRWzjz/m4Zzz5Uab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NNE2deFA/ggtfydXfPokXNcGASIQoezNAWr+Qq4E1Vr13j4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 --- 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,