mm: zswap: clean up zswap_entry_put()

Remove stale comment and unnecessary local variable.

Link: https://lkml.kernel.org/r/20240130014208.565554-6-hannes@cmpxchg.org
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Yosry Ahmed <yosryahmed@google.com>
Reviewed-by: Nhat Pham <nphamcs@gmail.com>
Reviewed-by: Chengming Zhou <zhouchengming@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
Johannes Weiner 2024-01-29 20:36:41 -05:00 committed by Andrew Morton
parent e477559ca6
commit dab7711fac
1 changed files with 3 additions and 7 deletions

View File

@ -545,15 +545,11 @@ static void zswap_entry_get(struct zswap_entry *entry)
entry->refcount++;
}
/* caller must hold the tree lock
* remove from the tree and free it, if nobody reference the entry
*/
/* caller must hold the tree lock */
static void zswap_entry_put(struct zswap_entry *entry)
{
int refcount = --entry->refcount;
WARN_ON_ONCE(refcount < 0);
if (refcount == 0) {
WARN_ON_ONCE(!entry->refcount);
if (--entry->refcount == 0) {
WARN_ON_ONCE(!RB_EMPTY_NODE(&entry->rbnode));
zswap_entry_free(entry);
}