From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-118.freemail.mail.aliyun.com (out30-118.freemail.mail.aliyun.com [115.124.30.118]) (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 8EAED2749CB for ; Wed, 17 Dec 2025 03:11:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.118 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765941102; cv=none; b=ExMlKhysYdrVv0G9wIwDH+BGpYwsuaCK44FXCI+AQeqPs5rAQzJfLLRjAzXGEg0q0mc9GjzC0YOvMtxwM6/Fwu+A3T0PQosLGUZaFVn1SUcBL1ZUg7ScJ2ifJ4trxtZ+HncrRGP+AS8bXHFsRJ8ApaElf8tjIZG6AJ6AzAQQing= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765941102; c=relaxed/simple; bh=LOOiAVDVv8xgfQPQB7oohFk9eUqZipS5Ig+V7FQMOko=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=cDW36dNcU21FDgaOdNPVu3ynqj90lDx7rJ/gysF8dxtxKiA5RGv6Thu810Rgh2lWdEfbapHV3JZdq9CeCBn2byPa+lhCS0ABx6tHomdsuB5nUU1/bBffD4AGRicJ8jkht8UfOAafXdvYlxfkvTPQXIOXB+qfpBkU9q3rzFKg+Zs= 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=bq8OnJb6; arc=none smtp.client-ip=115.124.30.118 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="bq8OnJb6" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1765941098; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=Nu6UK8a/ziMCsyb+RknHP8PTrL524RR3T22QKWM72Zk=; b=bq8OnJb6gMzzFD5YRUJRXAcsHZh1ToGIBOpGYwqvYMcdbj0SXaV52cTbRg2BKVIz3AxlLajb/8/V7LVk2j20YMoI8aj1s3jzOEVX9h83/OSLx+ryoRBSpK6aJju8SUt+8nZigTfCcKFME8luT9ys01Gtb9TAdnYebtNgVBCMwtQ= Received: from 30.74.144.118(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0Wv1ZCXw_1765941096 cluster:ay36) by smtp.aliyun-inc.com; Wed, 17 Dec 2025 11:11:37 +0800 Message-ID: <8bfcae1c-74a0-43e8-807b-fff22a770241@linux.alibaba.com> Date: Wed, 17 Dec 2025 11:11:35 +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: Lorenzo Stoakes Cc: Barry Song <21cnbao@gmail.com>, 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> <9e038290-70ff-458d-b46d-bc512c3442be@linux.alibaba.com> From: Baolin Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2025/12/16 18:54, Lorenzo Stoakes wrote: > On Tue, Dec 16, 2025 at 02:22:11PM +0800, Baolin Wang wrote: >> >> >> 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. > > OK that makes me less concerned, but you do need to put some more justification > in the commit message. Sure. Will do.