From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from outbound.st.icloud.com (p-east2-cluster4-host7-snip4-5.eps.apple.com [57.103.78.236]) (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 B8482271450 for ; Mon, 9 Mar 2026 14:56:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=57.103.78.236 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773068206; cv=none; b=XIQjcIB4d08Wbd/8I7xzQ5ODCeckuH0IM2wotw1T2A4hKxGmVMCTaVkM5aEHNpiGx4KgwDBNBuoPxm9IMHlE58zA3OfCNtgQPWq+RBBJx+813yjezKC9CyB9/2elEppEKb7ULhzpVo6A+WBa4i/OOz2adDeKg9f07L0pYYGzIpI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773068206; c=relaxed/simple; bh=wheMdZ8CjBfKTCxydw6O4Y7KARIiBB+AfOm9D50uINU=; h=Message-ID:Date:MIME-Version:To:Cc:References:Subject:From: In-Reply-To:Content-Type; b=uHANfCWamAWOMJbqd1m/VTNWIeA4vthGGh/5EQNk8D1IzV6gbSMrNYA0tCy2E9mlSKUN9XrJ5JlsKgV9odD4sae7Qcm489xExI2uHjsML6Mq+6eLYDn1ra1LHYw7kkVfSPoCgOaEBxj0hopl7MpISbeLwgDEa8LfusuMcBfwTjk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=Ft8dy1hd; arc=none smtp.client-ip=57.103.78.236 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="Ft8dy1hd" Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-100-percent-10 (Postfix) with ESMTPS id A38161800CAA; Mon, 9 Mar 2026 14:56:40 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1773068204; x=1775660204; bh=GOhN+p1crgw6WeP0xjnqp4QlR5PHq6mVgxA3ESYwIB8=; h=Message-ID:Date:MIME-Version:To:Subject:From:Content-Type:x-icloud-hme; b=Ft8dy1hdtfRvLHidYhB5tx4+gShDxqSwbmtl0qJod+n0yanjsOLOaY6msHIpZCWOao7mxg9c5K5Hl7ctgugL9OAuRtf4o4bvTfgKUJZKQmRO2cjbn5JngsxRgxAbCx0KBlJWXysoz64eeGN//+RJqt2bxQEtHrKOKeVZIhPvimU3ElkCM5+vjj5hV9FeE+bOGrYTahN8bBnj/GNM0V5Zw/+9LDC3qDn+iThSswrMWu8bppoeRqJr10qnk9hNq0hWGNXYjKR7ZKt2Pv6ut21Cp6OCSWeNx1X6Ffm2Eom+0FdpEuFYNJybE1yadJZ0TBiEa3QacBmX0AiEVBTjWjwNHA== Received: from [192.168.255.10] (unknown [17.42.251.67]) by p00-icloudmta-asmtp-us-east-1a-100-percent-10 (Postfix) with ESMTPSA id 6965D1800CA5; Mon, 9 Mar 2026 14:56:31 +0000 (UTC) Message-ID: Date: Mon, 9 Mar 2026 22:56:27 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: usama.arif@linux.dev Cc: Liam.Howlett@oracle.com, akpm@linux-foundation.org, axelrasmussen@google.com, bruzzhang@tencent.com, david@kernel.org, devnull+zippermonkey.icloud.com@kernel.org, hannes@cmpxchg.org, kasong@tencent.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, ljs@kernel.org, mhocko@kernel.org, mhocko@suse.com, rppt@kernel.org, shakeel.butt@linux.dev, surenb@google.com, vbabka@kernel.org, weixugc@google.com, yuanchu@google.com, zhengqi.arch@bytedance.com References: <20260309122939.723610-1-usama.arif@linux.dev> Subject: Re: [PATCH 2/2] mm, vmscan: flush TLB for every 31 folios evictions From: Zhang Peng In-Reply-To: <20260309122939.723610-1-usama.arif@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDEzNSBTYWx0ZWRfXzuRowVDcjuUk qZl28NjDKWtfu/wsXd4Y3NunQUv5km2+TXqCtSG1okUiZy+HRqIvKuUtu16oGWq9C/4tbDFhh0B EcqZxJ78rkpcy0si0+NkCjxyh0M54JijjRTQ+joHgzp0NrA0lnH+3/w6SOW7Ju3rPJoxdHJVmoo RV8VQf1FbTfoxZXmI2I8gcam8ITRjDYs7Ge82Zx5N0I/6hLePodDK2KtF6HkNkQ752+aXGVao1t d/oGDJpRbpSvVgFp1Kom07cQvOnmMcpj8LMD3Xz0w8IcbM/45J4XQQ84qoR1C3kKJBcE9McbuyC +7vsPrM3k+5or4GfGNOydnyYJncLxAM4+eCq6YU+GfK0wGsy5pqPQ96KOMz6h0= X-Proofpoint-ORIG-GUID: 9JmmZQo1-hKuNE6_M7YufrYeXvfUBHUL X-Proofpoint-GUID: 9JmmZQo1-hKuNE6_M7YufrYeXvfUBHUL X-Authority-Info-Out: v=2.4 cv=Ya6wJgRf c=1 sm=1 tr=0 ts=69aedfaa cx=c_apl:c_pps:t_out a=YrL12D//S6tul8v/L+6tKg==:117 a=YrL12D//S6tul8v/L+6tKg==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=x7bEGLp0ZPQA:10 a=YE32fvk_ji8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Jl1KS0vY5v-l7LHE-VgA:9 a=QEXdDO2ut3YA:10 a=ZXulRonScM0A:10 a=zZCYzV9kfG8A:10 a=J82S1U87d15UFHHUFZS8:22 a=Q8qS2GGGQ3of7AWJm7aR:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_04,2026-03-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 adultscore=0 mlxlogscore=757 clxscore=1011 bulkscore=0 mlxscore=0 spamscore=0 phishscore=0 malwarescore=0 suspectscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2603090135 X-JNJ: AAAAAAABFL7hrkCZ1z6QL4ty2ViOtS+DQZzwrrd8cU10biBxS+s5aaLwlGZ7oDDfGRBcze4snwbnqTBM+Q+EefJTgFvz7GkwpDa2qOSHPM7wXH4bTbxS6AeI+WVidncimh9e/1KZwfn627mo0mrMHbsTFelha3cKJcYlVU1oKK5LcVpQ2Z3ldlHs5IE0b1DkVEgmhYMj86678S73/4TCfHZ1dDDb5L0X+9Wnggk8VkiV/kjejiqwmB/DPWpEKx+lBG0K4n/ZHsoT8CvjaQHmhVVJTfQ9JBdkP2YjuyrkFK3+0Elh8/MnvuzGmsfBAocObUntcRhntNJWoDu0APlabmyOcusDe65thsQiEJos/bqGqYsBOG6FXYlUDkhPf90lSm2iyHJ3+/s9DvdJJ4tQC726Eoe/ReDRwEEByy0yTtfVI2aXA8tDhZlpDDwz73rfuYoZJo5lX13iIeZ5CL+iWo11xPBOuPoLJkVkIR5wakwnEiRbTQC/zw3AjC2o+hIg84z6hyKOT5KXxq+SSDFDtXg3rfmNUYnJ1Zgq7lBUmhasjTryGT9MP9Gu65G4hO5hJ3vY80bvpuJZScapJI8EHbE9IjlT7r+pYAFdacIff9U0r05Fy2lik5FtFD8qtnVV+gsVfXKiJWIcz+SQIRa4GDLO6IZcOq67zgb++AdmqzE08lEg0tOZzkmeB/IfDW04MY9lVhRhXN7GmV507hiBckohR3QstnD057ovhtEkjFpWzdwiwaRGH1W+c9le/NohvejQbI424SyeDos2e4PDFez41RSBCS9v1MwpqacmNzpJVrZauZEu6yZczG3m+jW9/3jhUUGAd6OeiofksLpBaoRuwJOxtjWUXQ9E0Q4jN/o5xlssmagguWOniYIrWMfDNBhTRT4+Ldr29Ga0e0b7uwsLxiAFvpxtgzME Hi Usama, Thanks for the review! You are right that the comment is wrong, page_ref_freeze does not exist in pageout_batch(). I will fix the comment in v2. Regarding the data corruption concern: try_to_unmap_flush_dirty() is called before pageout_one(), so all stale writable TLB entries are invalidated before IO starts. Any writes through stale TLB entries during the unlocked window will have completed and landed in physical memory before the flush, and will be correctly captured by the subsequent IO. pageout_batch() relocks each folio and rechecks its state (writeback, lru, mapped, dma_pinned) before proceeding. If any of these conditions have changed during the unlocked window, the folio is not written out and is put back to the LRU list for a future reclaim attempt. So there should be no data corruption issue. I will also add folio_maybe_dma_pinned() check in v2 as suggested by Kairui Song.