From patchwork Tue Feb 6 19:13:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nhat Pham X-Patchwork-Id: 13547753 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 B808BC4828D for ; Tue, 6 Feb 2024 19:13:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 24EC46B007D; Tue, 6 Feb 2024 14:13:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1FEDE6B0080; Tue, 6 Feb 2024 14:13:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D1BB6B007D; Tue, 6 Feb 2024 14:13:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id EDF8B6B007D for ; Tue, 6 Feb 2024 14:13:58 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id C032DA09D6 for ; Tue, 6 Feb 2024 19:13:58 +0000 (UTC) X-FDA: 81762328956.30.BEC75E7 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) by imf18.hostedemail.com (Postfix) with ESMTP id F31341C001A for ; Tue, 6 Feb 2024 19:13:56 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ffpz8yos; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of nphamcs@gmail.com designates 209.85.222.174 as permitted sender) smtp.mailfrom=nphamcs@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707246837; 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=fZojKhB9fYKfMspFBwwk8hmljyIuozOLErYmthRAITg=; b=3g17TzKKlMfu2uU+19oTnHy/nebeqLlqpL607Bm7lpwd4B15MZUvspqV33wIdt26xdwwck oaq0o3zNaGGNY6l7FW3/oLQTVXOIyASjcbpQs+RnckBWq9iskwyiYx86e1P9T3bG2Wc40r 5bn0RkR92nDBBAA9A7j2jVt5FkqUKuo= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=ffpz8yos; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of nphamcs@gmail.com designates 209.85.222.174 as permitted sender) smtp.mailfrom=nphamcs@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707246837; a=rsa-sha256; cv=none; b=L50LgPbPvASL9wNCD84tAxQrBZrXty5w2NOeIFBn9tMa9JkI1URFEi0y9fEOAtVDIzEZjG oJ7SmxMCDoYaw7v8xohq1I6u8FQmqkR8TfhbgtjgioVdtK+otCKOC8fLSh90G6lejY+5Mi oWjzlaGm3HthU17rK+CUP+/h5RMudac= Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-783045e88a6so399451185a.0 for ; Tue, 06 Feb 2024 11:13:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707246836; x=1707851636; 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=fZojKhB9fYKfMspFBwwk8hmljyIuozOLErYmthRAITg=; b=ffpz8yosXv951pCbmvvOXVg7uoo/KHK0MKNBCgZ9EpgnBo5wytNyw95nE/Refg03fi udQV6oZx9O2My6wZyQ0eMiuwA9lxE2m23mW/OmUd3bYvUfw7quwVrjaBTvFv8pTpFyfs +6hP/NbNbpDk1DaFtE28E5QO/JI2ZaqDYbeOCuYIJ5+9B3B+Ou9tVWLzdD2Z/1DlYWid KtEINfsovs2fpj4tJ8uplOGu3W5YebIP7k++e43xbhssuPjVoPtLMLDG58o3K6ojGwvY C2+jGQQBLA/zZDkrc0aBB/GQtcGG0I3eVk8ObP+qyaeKsHNdzewFzk+lxq9J9zXLNNbr JO3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707246836; x=1707851636; 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=fZojKhB9fYKfMspFBwwk8hmljyIuozOLErYmthRAITg=; b=jQpSEdnWJmZAsYJ58ZiSnGOFLL81Ab5KDPoU0C2z4T8xkDiwrFSekbZzJ9Zfr9mMdn l26Je0YWGo5FXNYUnbpYB4nAIcUBoFLL76LoAriNkT50VKXul1x4Tl2ZFbYImgVkctxy 0P+yLHam23S+CkX8D8DhoTllgtCuNfRj55sMhwbgfmVPPfjUmwdIwXQGxQRoH+6pZMZg VdtzDYQuKio4qwiPUHKYjl4GpSm5X9iSKi49nAHF3tgFcSqK81ilZmUF20MPeIoKNlMq u5ZUZLvk6AR3YIZhcLEtTYAziO/ysYBHaWS/PishHA621xtJvQmGj1aYzIjkcYM7KDrs Phyg== X-Gm-Message-State: AOJu0Ywzu+N56QJU8oblD/CBi8BPiHOJWFMIhRIwg+nYjQHC6r7xK1c+ +JQsHq56A4MACm17efaLzzpWhrbMmvvZrDSs3n9kG8Vg6ZzZvQDJ X-Google-Smtp-Source: AGHT+IE5/J7s4JCxpAmfcSJcYhOoCD+F7wm5PS5M5Xcb6nmWdF5ypcGcNLvSVEVlv2D0PgXg2+7u8Q== X-Received: by 2002:a05:620a:491a:b0:783:936d:7397 with SMTP id vy26-20020a05620a491a00b00783936d7397mr3268772qkn.23.1707246836079; Tue, 06 Feb 2024 11:13:56 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCX2is+O3QYnrbaupcv+qA7hli8+D1smBDDvmy7FORbMFw3J/rZzVVpXeeAUEzczKZUWAJfUBZotG6RfGMg1SrkCNEFeS0PHTZZiJPFhGKNjlrbuNTLbT8L7uHjOb2dPVlyoLQ7KyJBge4beGGxe+JrnhiQ6P0bOh1OcyysD4pPHUTWW7YL973GsWG3XIbexpLNRh2HcO2URxLvCZnxVBv47UiLql0+KPQ== Received: from localhost (fwdproxy-nao-007.fbsv.net. [2a03:2880:23ff:7::face:b00c]) by smtp.gmail.com with ESMTPSA id p23-20020a05620a22f700b007858f8eafdfsm784314qki.55.2024.02.06.11.13.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 11:13:55 -0800 (PST) From: Nhat Pham To: akpm@linux-foundation.org Cc: hannes@cmpxchg.org, chengming.zhou@linux.dev, yosryahmed@google.com, linux-mm@kvack.org, kernel-team@meta.com, linux-kernel@vger.kernel.org Subject: [PATCH v2] mm/swap_state: update zswap LRU's protection range with the folio locked (fix) Date: Tue, 6 Feb 2024 11:13:55 -0800 Message-Id: <20240206191355.83755-1-nphamcs@gmail.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240206180855.3987204-1-nphamcs@gmail.com> References: <20240206180855.3987204-1-nphamcs@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: F31341C001A X-Stat-Signature: 8s67qkphopmwaso8g541bpf5zi5szcti X-Rspam-User: X-HE-Tag: 1707246836-955224 X-HE-Meta: U2FsdGVkX18IeP9xlTP2Bin5Xjkcwe+VS63f0p3Vn3b0yDfmrxE5XSS30mzg9N5TCc7en+3O6VSYHmyapzl8LT6uCV23ErrGHHlxpx6mvvyOIvpKnlUkWiRhTzDjEpziC39uUEqgNS8Mgyo1v0+BfUF9Rbi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yLKssfM7LMAexJTilZnSBZMXgtvWusMI4n26qOzqffjt1C7E1fWDhmSozx4RJ04nVemlF5oz8c0u1f4LjQAtbg3ZxNkokWsTFHskiQxz5VtVkExW+1A/MvQiUSgpiwbLkW26jUzz8ppLiZOZ+xOvFwoMm6ihxMbHPG2rKK8wW3lxjCYH9zpuGY6AfaIGLfyYMQpGH6nJYHQmo2m0e66/NmKDtH/ARRTQ/N/YMP8hVNtNi4pq2sYKG3r8Wp1KTzEDmX1/g51wTNm/sufTINZ8iMzmxTike4t7gt1NpYfi6Q70A== X-Bogosity: Ham, tests=bogofilter, spamicity=0.076167, 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 if (folio) checks inside zswap_folio_swapin() is no longer needed. Suggested-by: Johannes Weiner Signed-off-by: Nhat Pham Acked-by: Johannes Weiner --- mm/zswap.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mm/zswap.c b/mm/zswap.c index 8c548f73d52e..e91e3f10a5c8 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -826,11 +826,9 @@ void zswap_folio_swapin(struct folio *folio) { struct lruvec *lruvec; - if (folio) { - VM_WARN_ON_ONCE(!folio_test_locked(folio)); - lruvec = folio_lruvec(folio); - atomic_long_inc(&lruvec->zswap_lruvec_state.nr_zswap_protected); - } + VM_WARN_ON_ONCE(!folio_test_locked(folio)); + lruvec = folio_lruvec(folio); + atomic_long_inc(&lruvec->zswap_lruvec_state.nr_zswap_protected); } void zswap_memcg_offline_cleanup(struct mem_cgroup *memcg)