From patchwork Tue Jan 30 01:36:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13536671 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 06D69C47DB3 for ; Tue, 30 Jan 2024 01:42:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C6DB86B00A4; Mon, 29 Jan 2024 20:42:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BF87A6B00AD; Mon, 29 Jan 2024 20:42:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A92A06B00AE; Mon, 29 Jan 2024 20:42:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 9740A6B00A4 for ; Mon, 29 Jan 2024 20:42:22 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 71589A0164 for ; Tue, 30 Jan 2024 01:42:22 +0000 (UTC) X-FDA: 81734277324.08.AABC95F Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) by imf19.hostedemail.com (Postfix) with ESMTP id B06661A0002 for ; Tue, 30 Jan 2024 01:42:20 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=cDIDHpW2; spf=pass (imf19.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.172 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706578940; 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:in-reply-to:references:references:dkim-signature; bh=3noBpEoNcYkgCi0cr1quPQy/gMKhnK1FE9Og99etBLE=; b=AZyeNh9HQ5HigUiyzla+t93KOQ0BSZgPKO3Vqj+TXvZ2yJtvmLgOafGYRBVxktfR59l4E4 WIijWq9qMedOEzCJn+gho/2ZoqtDFxekdRjAO+FluDWbMP5Zo7mfZTErfqa04Ch6V1o5fx zvaEPHdcXodQPJzVE9aJRGLx8bpWvQ0= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=cDIDHpW2; spf=pass (imf19.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.172 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706578940; a=rsa-sha256; cv=none; b=Aek780SOsiJQd0R7khiMxASda8GkuW7mbO4izG4uw26TAjJzabcjm0Du8aAo8LAbBd9ffH zqrZt7ubStc6MhGW/ryEkywue1HKrgKIW44onL5WTK5w95ANw0pzCm/8OLvO8wqGlwatRB MDxTIQVvedmStgPwn7+/D4Zv4hjOKtM= Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-783d4b3a00bso313573985a.3 for ; Mon, 29 Jan 2024 17:42:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1706578940; x=1707183740; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3noBpEoNcYkgCi0cr1quPQy/gMKhnK1FE9Og99etBLE=; b=cDIDHpW2ipSoxF1XUKo+YVyP+dpRI0YBd5rufDcu7IjIFWJP799voLn3Q1FJItXKk1 WGpPD5dsaqsK3VrFZJW9ftQaeNn1D2z/MWb4CE0yzJZypJdvzGG57p9Zic7NKK1FnkxD oHAJD1ERkTkNns3K63KWcUVIw33GVII9XUINQ3Xlg3gG7piJhG1cQEypmDb83rwp6ifI 2t+ug1REe1wXHOv+fyBRrYhpjH+H9hrkWLwH84sQ37wWbC10cJTyy5v24F4M+v00Rf8z 8+gCRHNcLnviAIljuHAYELAFmhKtHz1e6xWFlh0kozbrUVh+wTM3uPWBl6QhqSAbdmQ+ IHmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706578940; x=1707183740; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3noBpEoNcYkgCi0cr1quPQy/gMKhnK1FE9Og99etBLE=; b=dkMTKmd2PASJjWRjA15JfI2l63DDTYXWer7/dyoDsUfbHAw5mEnc1j98ep3CreJXY+ O8jFWZYyGvBqtDT0GYicUhVcm8JjPPW2IDRtPxTSYt7abJp8U8k+RWWXR7/akRfp8GdJ d7uax8wfbbvD9K3pqUGETLEvmNPAvBvm7yayTYhy7WE2DUDypDUdlyPy8aoyuSYbC2l8 2sqDLF7JakZ7cHxXttbAl4bNmwIcu0rk+kqem7EfZ+MVU526EHvyFuuoUxZIcsDsCyCB 6Ax2n5IyuuyDwt8sH/Ceb7S3HuTqH+W8ffJ1JYiDMeEssoKPtFpKCCgQTMNPInPslxa/ Gwbg== X-Gm-Message-State: AOJu0Yygt21I5AQpZg47WnOHarRWsCweNIv5NHiWvjpH1lqjpX4vO+eI 4AbMxhe/DkTuBAxaGfefpIXMbbyy7ZnzPea6kNR1kJUOBamVMtXbTiHxfzKpQfM= X-Google-Smtp-Source: AGHT+IFva24g3oCWu71j33LtFcxZP97ALn5FVyB0OWjRs+hYHzvHicsl+CzPH8nqY1WBmS0gQvju2A== X-Received: by 2002:a05:620a:28d4:b0:784:79a:ce59 with SMTP id l20-20020a05620a28d400b00784079ace59mr1212077qkp.26.1706578939943; Mon, 29 Jan 2024 17:42:19 -0800 (PST) Received: from localhost (2603-7000-0c01-2716-da5e-d3ff-fee7-26e7.res6.spectrum.com. [2603:7000:c01:2716:da5e:d3ff:fee7:26e7]) by smtp.gmail.com with ESMTPSA id d23-20020a05620a205700b00783f77b968fsm1879593qka.109.2024.01.29.17.42.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 17:42:19 -0800 (PST) From: Johannes Weiner To: Andrew Morton Cc: Nhat Pham , Yosry Ahmed , Chengming Zhou , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/20] mm: zswap: clean up zswap_entry_put() Date: Mon, 29 Jan 2024 20:36:41 -0500 Message-ID: <20240130014208.565554-6-hannes@cmpxchg.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130014208.565554-1-hannes@cmpxchg.org> References: <20240130014208.565554-1-hannes@cmpxchg.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: B06661A0002 X-Rspam-User: X-Stat-Signature: mf5ozg1w7bhm9cpz981ab73knrbchzqa X-Rspamd-Server: rspam01 X-HE-Tag: 1706578940-625475 X-HE-Meta: U2FsdGVkX19MgXKdVMydATdXF2/T8629BTKitXyi+me30rfkNOxTJqyi+5RszyTjXabZeEm7A5n6Rfeww6EtkQ2Dt1Q2zgvlQpnYTHcgwWlpbUt7S0/YSJXgR23Z9lA2tlqlbDj2E86IfpQVsGu6y69bVxSy5v+aZzSw7067iWvDxPfmiBAil5urc5J5dXekDXvEi13QBJLyNN/cTd7Q98N1N0RjTDeWTkybTx4CmhQGf3iMJ+U7HpZEaX7KxUA+c4xCqVDPaQc0FIAsGbhYipR66PSLVHza1kGBLNssYVZxgJcLK/Gtvuhb2tVBPO2DjMAY7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9lFB8W1mXG5aJUWaR2T73KXfln9tfJCK0qm0+nRBtB/qQNqessq+U/jpboyDo1ShgNT008cDXiuf+iB6CQSIjeLG+ghTr9jAs6ptid0dFOEGUE0= 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: Remove stale comment and unnecessary local variable. Signed-off-by: Johannes Weiner Reviewed-by: Chengming Zhou Acked-by: Yosry Ahmed Reviewed-by: Nhat Pham --- mm/zswap.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/mm/zswap.c b/mm/zswap.c index 0c6adaf2fdb6..7a7e8da2b4f8 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -546,15 +546,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); }