From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) (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 354F873463 for ; Sat, 11 Jul 2026 00:25:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783729550; cv=none; b=YVMLtdKWjplTq5eF/Zl89THBIFV00N5ZM0g1eZLyTgV2jD2ZBeC2Kg2mytuAWpY1EcyxXuZQ86xUtcHXupY4IVkzH4YgTqMWhSC52l7R7kmx0l8DvneGDccR9bKkU2lGLfoy5GaLeGiTpDvcX0UkhOi26SiDEMF4z7VjbzpJWbQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783729550; c=relaxed/simple; bh=h2mdNMCBO+CanE2h6kFjkpyW0KgisFrCfaG6zyBOT64=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=XGVA2BH6FMyIikG+B5g8itqwXQMIspcwnDaF2ZmiGWgXdo5EvQhvz/qKqUPtwBEWVODX+yvIJW9UcV2nEkZU60QkhUBoNxW9RgLjbiyHyy09JMsgEuqHzkSP2mXmXg5jI1rndaUTYxuQNmduSW35xQ3H0FJymBp4b8GlNGvicz8= 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=LJ59kQOf; arc=none smtp.client-ip=95.215.58.186 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="LJ59kQOf" Message-ID: <133c3c19-22ae-4de5-98e0-6970b707bf37@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1783729546; 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=ozuHQhVAjCW4JCxIsyp8AZOTcw8eEPsbEwyEh/H07xc=; b=LJ59kQOflH4Xwi55pz3SR4YZ+SZR4DgfALUVoXqN08vKRlsEwz2raNVipgNS9depuera86 58A2/XqIqEGURFDg0itA/yBn4xNw8b/j6f4yCsOwD2cxdZFpKNR+uqvznbvoqrIgZewPTK LY00VDlf7sl1JHOE+tUToHYnrxcTUGg= Date: Sat, 11 Jul 2026 08:25:31 +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: flush dcache in the compressed decompression path To: Yosry Ahmed Cc: Joshua Hahn , Song Hu , linux-mm@kvack.org, hannes@cmpxchg.org, nphamcs@gmail.com, chengming.zhou@linux.dev, ljs@kernel.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, herbert@gondor.apana.org.au References: <20260710184052.3614560-1-joshua.hahnjy@gmail.com> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Zenghui Yu In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT [+Cc Herbert, in case you missed that] On 7/11/26 2:43 AM, Yosry Ahmed wrote: > On Fri, Jul 10, 2026 at 11:40 AM Joshua Hahn wrote: > > > > On Fri, 10 Jul 2026 11:22:43 -0700 Yosry Ahmed wrote: > > > > > On Fri, Jul 10, 2026 at 1:28 AM Song Hu wrote: > > > > > > > > Both branches of zswap_decompress() write the destination folio through a > > > > kernel mapping: the incompressible branch via kmap_local_folio() and the > > > > compressed branch via the crypto scatterwalk. Yet only the incompressible > > > > branch calls flush_dcache_folio(); the compressed branch was missed. On > > > > aliasing D-cache architectures this can leave stale cache lines visible to > > > > userland after a zswap load. > > > > > > Adding Herbert here. > > > > > > Doesn't the Crypto API take care of this for the decompression path? > > > Maybe in scomp_acomp_comp_decomp()? > > > > This is what I think too. Actually if you use something like > > zstd_decompress() as well, it ends up calling: > > acomp_walk_done_dst() --> scatterwalk_done_dst() > > --> __scatterwalk_flush_dcache_pages() > > --> flush_dcache_page() > > over all the pages in the loop. > > > > Maybe I'm missing a path here that would require us to manually flush > > from zswap? But even still, I think that should be handled by the > > path that is repsonsible for doing the actual decompression, not > > zswap. > > > > What do you think? > > Yeah I am hoping Herbert will help us out here. >