From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83F3B36E46B for ; Tue, 3 Feb 2026 06:51:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770101512; cv=none; b=TE7ZGziqk6h+DfDakSoAEstSsrM8waUpmjTKT/uI918HU3tS0KjbhthPjUyTnNiyc8tuhJT+TmHjXcyiwmLGv+COMzRqTpuJtrjW/od+ETI/caXTfMQ8DLKFvq/4JrWWD/knqcCaycuofPsN3DGOdQM4EBey3aUd9vBfAguLjmU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770101512; c=relaxed/simple; bh=xBoBl6csdob9fImId14jjUzzgtNJUOIlayUQNZQEXjU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=GOgCQY7//9gzyN9IpR2ZJ6f04Fj36zhAy6Dpp18UCLad++7cCVwx5YXHp0KB+xu7mfdt4hJEfhHGT77PBiFQ0a48nJdMeqTJb/cBgC/f5K1MnYZRp/q/ETZv/BLCkm6hWSdcRrMfkNikativR19CxxqYZkLysa/u7rWuxTuH5kA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=t6JR1DzZ; arc=none smtp.client-ip=91.218.175.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="t6JR1DzZ" Message-ID: <22dc3595-5bd6-452c-9560-9b7a5b8b71d2@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1770101506; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T+9hMjNVUP4EwH48yxFOv4vGjAKG4v04AOdez7l8Ufw=; b=t6JR1DzZxQCFOtl4IvMZlf0xEoyNZkUVmKQvIVbApqzLNOx+sfoKjTwtOdQZmuNUa12/Nr NICLYM6EVvYBlL8pAC1BeOevInLH/Mu8KpqnEK0uHRxtoVQNOqBBiA0/J/7XzCFAVZAXpb qXGtaKKtDsay61mpykU+JoLQ87y2L+k= Date: Tue, 3 Feb 2026 14:51:36 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH] mm/zswap: remove SWP_SYNCHRONOUS_IO swapcache bypass workaround To: Kairui Song , linux-mm@kvack.org Cc: Johannes Weiner , Yosry Ahmed , Nhat Pham , Andrew Morton , Baoquan He , Barry Song , Chris Li , linux-kernel@vger.kernel.org, Kairui Song References: <20260202-zswap-syncio-cleanup-v1-1-86bb24a64521@tencent.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou In-Reply-To: <20260202-zswap-syncio-cleanup-v1-1-86bb24a64521@tencent.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2026/2/2 01:47, Kairui Song wrote: > From: Kairui Song > > Since commit f1879e8a0c60 ("mm, swap: never bypass the swap cache even > for SWP_SYNCHRONOUS_IO"), all swap-in operations go through the swap > cache, including those from SWP_SYNCHRONOUS_IO devices like > zram. Which means the workaround for swap cache bypassing > introduced by commit 25cd241408a2 ("mm: zswap: fix data loss on > SWP_SYNCHRONOUS_IO devices") is no longer needed. Remove it, but > keep the comments that are still helpful. > > Suggested-by: Yosry Ahmed > Signed-off-by: Kairui Song Reviewed-by: Chengming Zhou Thanks! > --- > mm/zswap.c | 19 ++++++------------- > 1 file changed, 6 insertions(+), 13 deletions(-) > > diff --git a/mm/zswap.c b/mm/zswap.c > index 3d2d59ac3f9c..8cd61603ff79 100644 > --- a/mm/zswap.c > +++ b/mm/zswap.c > @@ -1589,11 +1589,11 @@ int zswap_load(struct folio *folio) > { > swp_entry_t swp = folio->swap; > pgoff_t offset = swp_offset(swp); > - bool swapcache = folio_test_swapcache(folio); > struct xarray *tree = swap_zswap_tree(swp); > struct zswap_entry *entry; > > VM_WARN_ON_ONCE(!folio_test_locked(folio)); > + VM_WARN_ON_ONCE(!folio_test_swapcache(folio)); > > if (zswap_never_enabled()) > return -ENOENT; > @@ -1624,22 +1624,15 @@ int zswap_load(struct folio *folio) > count_objcg_events(entry->objcg, ZSWPIN, 1); > > /* > - * When reading into the swapcache, invalidate our entry. The > - * swapcache can be the authoritative owner of the page and > + * We are reading into the swapcache, invalidate zswap entry. > + * The swapcache is the authoritative owner of the page and > * its mappings, and the pressure that results from having two > * in-memory copies outweighs any benefits of caching the > * compression work. > - * > - * (Most swapins go through the swapcache. The notable > - * exception is the singleton fault on SWP_SYNCHRONOUS_IO > - * files, which reads into a private page and may free it if > - * the fault fails. We remain the primary owner of the entry.) > */ > - if (swapcache) { > - folio_mark_dirty(folio); > - xa_erase(tree, offset); > - zswap_entry_free(entry); > - } > + folio_mark_dirty(folio); > + xa_erase(tree, offset); > + zswap_entry_free(entry); > > folio_unlock(folio); > return 0; > > --- > base-commit: 2c263046cbe6d9d5fce3dfeba063f199f7e6298f > change-id: 20251226-zswap-syncio-cleanup-a05b7fc6180f > > Best regards,