From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) (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 BC3AC21773F for ; Tue, 16 Dec 2025 06:22:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765866148; cv=none; b=W9MLMQ+XVFft+ptbjfWG2oRDg8dUS1r4jhtq/rPgwDRFgvbE28MePZZZ55rKT/TnEj6yKSn8CshJu04+YDNkR7aPsrc1LA+vK+iTWv/Hmx4ItimMTLlnfi9pDQfyoo6RtNuIOqMwZciRbJOWYGuldWa4GIQUzpog3sqC/1o449w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765866148; c=relaxed/simple; bh=pSJVo06mkCZSZ3ixGA6qgoSjwzB14uhFSc0y4xPYTJw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=OIVqejiEZGoV55tYnxLNsGD6hmV8XRFVeAHcio8a3/pZnCvke6O/5OJeTysqOqc8E6K1TEMsz4zZp7lx3VlYDa0sUbZBrPyN99TyYB10N4ldXF0B1a0NgQjy8kli+UcykhDum82TQILc04Hneqoq3Gx/QS1qoH9DIafMKFfMdJI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=detDNI5L; arc=none smtp.client-ip=115.124.30.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="detDNI5L" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1765866133; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=UDB4pFFOjEqefI5bQmHueWu/FzeTwPye7J8dm3yHS5M=; b=detDNI5LmlcWHMNgKnzoxCjD7vdWlvEuo9F87H+bTMV4IXIwptHvTrCa2E97ztjNMGEvts9CF196o3j94jfsJ86mA0NjsIgYh5W/bfhKCGGx6kZeOZbX/gdC3UB/3XFaSKMfq8oqV5bAlHCBfGPwIQC3FR4FguoqaSjxiJ2QOaU= Received: from 30.74.144.116(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0WuxwDsf_1765866131 cluster:ay36) by smtp.aliyun-inc.com; Tue, 16 Dec 2025 14:22:11 +0800 Message-ID: <9e038290-70ff-458d-b46d-bc512c3442be@linux.alibaba.com> Date: Tue, 16 Dec 2025 14:22:11 +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 Subject: Re: [PATCH v2 3/3] mm: rmap: support batched unmapping for file large folios To: Barry Song <21cnbao@gmail.com> Cc: Lorenzo Stoakes , akpm@linux-foundation.org, david@kernel.org, catalin.marinas@arm.com, will@kernel.org, ryan.roberts@arm.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.com, mhocko@suse.com, riel@surriel.com, harry.yoo@oracle.com, jannh@google.com, willy@infradead.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <70d1dedc-b4fc-4eb6-baf6-9e54b6a62249@lucifer.local> From: Baolin Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2025/12/16 14:13, Barry Song wrote: >>>> >>>> diff --git a/mm/rmap.c b/mm/rmap.c >>>> index ec232165c47d..4c9d5777c8da 100644 >>>> --- a/mm/rmap.c >>>> +++ b/mm/rmap.c >>>> @@ -1855,9 +1855,10 @@ static inline unsigned int folio_unmap_pte_batch(struct folio *folio, >>>> end_addr = pmd_addr_end(addr, vma->vm_end); >>>> max_nr = (end_addr - addr) >> PAGE_SHIFT; >>>> >>>> - /* We only support lazyfree batching for now ... */ >>>> - if (!folio_test_anon(folio) || folio_test_swapbacked(folio)) >>>> + /* We only support lazyfree or file folios batching for now ... */ >>>> + if (folio_test_anon(folio) && folio_test_swapbacked(folio)) >>> >>> Why is it now ok to support file-backed batched unmapping when it wasn't in >>> Barry's series (see [0])? You don't seem to be justifying this? >> >> Barry's series[0] is merely aimed at optimizing lazyfree anonymous large >> folios and does not continue to optimize anonymous large folios or >> file-backed large folios at that point. > > Yep. At that time, I didn’t have an Android machine with a filesystem > that supported large folios, so I focused on lazyfree. But I > agree that lazyfree anon folios and file folios are quite > similar. > >> >> Subsequently, Barry sent out a new patch (see [1]) to optimize anonymous >> large folios. As for file-backed large folios, the batched unmapping >> support is relatively simple, since we only need to clear the PTE >> entries for file-backed large folios. > > Yep. It is actually quite straightforward to go from lazyfree > anon folios to file folios. Swap-backed anon folios are much > more tricky, though. Agree. Thanks Barry for reviewing and confirming.