All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: <akpm@linux-foundation.org>, <minchan@kernel.org>, <ngupta@vflare.org>
Cc: <senozhatsky@chromium.org>, <linux-kernel@vger.kernel.org>,
	<linux-mm@kvack.org>, <linmiaohe@huawei.com>
Subject: [PATCH 3/3] mm/zsmalloc.c: improve readability for async_free_zspage()
Date: Thu, 24 Jun 2021 20:39:30 +0800	[thread overview]
Message-ID: <20210624123930.1769093-4-linmiaohe@huawei.com> (raw)
In-Reply-To: <20210624123930.1769093-1-linmiaohe@huawei.com>

The class is extracted from pool->size_class[class_idx] again before
calling __free_zspage(). It looks like class will change after we fetch
the class lock. But this is misleading as class will stay unchanged.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/zsmalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 0b4b23740d78..8598ee07284b 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -2161,7 +2161,7 @@ static void async_free_zspage(struct work_struct *work)
 		VM_BUG_ON(fullness != ZS_EMPTY);
 		class = pool->size_class[class_idx];
 		spin_lock(&class->lock);
-		__free_zspage(pool, pool->size_class[class_idx], zspage);
+		__free_zspage(pool, class, zspage);
 		spin_unlock(&class->lock);
 	}
 };
-- 
2.23.0


      parent reply	other threads:[~2021-06-24 12:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-24 12:39 [PATCH 0/3] Cleanup for zsmalloc Miaohe Lin
2021-06-24 12:39 ` [PATCH 1/3] mm/zsmalloc.c: remove confusing code in obj_free() Miaohe Lin
2021-06-24 12:39 ` [PATCH 2/3] mm/zsmalloc.c: combine two atomic ops in zs_pool_dec_isolated() Miaohe Lin
2021-06-25  5:01   ` [Phishing Risk] [External] " Muchun Song
2021-06-25  5:01     ` Muchun Song
2021-06-25  6:32     ` Miaohe Lin
2021-06-25  7:29       ` Muchun Song
2021-06-25  7:29         ` Muchun Song
2021-06-25  8:46         ` Miaohe Lin
2021-06-25  9:32           ` Miaohe Lin
2021-06-25 10:40             ` Muchun Song
2021-06-25 10:40               ` Muchun Song
2021-07-01  2:43               ` Miaohe Lin
2021-06-24 12:39 ` Miaohe Lin [this message]

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=20210624123930.1769093-4-linmiaohe@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=senozhatsky@chromium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.