From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) (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 6D648194AFB for ; Mon, 6 Jan 2025 06:40:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736145650; cv=none; b=uetsTus3LNO0gu5jXDAFnh3uFz32vS/0WPLD+xeXDD6CrM15DqfOK76bxx+ZJbG/6ynaWi/6W5c5L3lPq1A4BPlUXkrou8xhLSR6ThVUvImiQJeN40UvA1rEoOhU9xyDPfQ2g2arRR+V9lU9d/xC8uc192JIgb1Xh58KOEluFbA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736145650; c=relaxed/simple; bh=OetmvYSidOeEIpPhGkAd+YbBJii77E3RvpJK8SMdaqU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=l1yzxVZ/RLem8C+pYxr156asIsjxemnl+g8wZLusgNv5mdhkQiVu/PykPa/g438tYQMYBIVEvbpyJhS0jDeMNhzkRPvIDwbz0ntYlgLuzMGnOX4DmTPYRQwFOHOqRyJm3WJLrC7ZzMZP3k4UMgmi9RDmIzgl/1jApf1d7v1Uq4w= 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=SThCNQdB; arc=none smtp.client-ip=115.124.30.130 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="SThCNQdB" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1736145645; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=DFltLzutjLChajYcQ04RjwFDr7gm83e9w/SFboQ59lY=; b=SThCNQdBqhV/q6wo7BAaVq5jKRCGxLL3RnziBoVLKlzEy/qgtUBh/a3oPvGB4BKf1FR0IX3lj/Np7u6JOtPvrfhQnr4yrzWp3OLw9hlyiyi1k3u9Uh+xb+GeWhdApke+2ZrRQFpR+g/FnHDXlh+DmaOQJVTXRCiJHmjFlJ7OTiA= Received: from 30.74.144.118(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0WN01L1._1736145641 cluster:ay36) by smtp.aliyun-inc.com; Mon, 06 Jan 2025 14:40:42 +0800 Message-ID: Date: Mon, 6 Jan 2025 14:40:41 +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 1/3] mm: set folio swapbacked iff folios are dirty in try_to_unmap_one To: Barry Song <21cnbao@gmail.com>, akpm@linux-foundation.org, linux-mm@kvack.org Cc: linux-arm-kernel@lists.infradead.org, x86@kernel.org, linux-kernel@vger.kernel.org, ioworker0@gmail.com, david@redhat.com, ryan.roberts@arm.com, zhengtangquan@oppo.com, ying.huang@intel.com, kasong@tencent.com, chrisl@kernel.org, Barry Song References: <20250106031711.82855-1-21cnbao@gmail.com> <20250106031711.82855-2-21cnbao@gmail.com> From: Baolin Wang In-Reply-To: <20250106031711.82855-2-21cnbao@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2025/1/6 11:17, Barry Song wrote: > From: Barry Song > > The refcount may be temporarily or long-term increased, but this does > not change the fundamental nature of the folio already being lazy- > freed. Therefore, we only reset 'swapbacked' when we are certain the > folio is dirty and not droppable. > > Suggested-by: David Hildenbrand > Signed-off-by: Barry Song The changes look good to me. While we are at it, could you also change the __discard_anon_folio_pmd_locked() to follow the same strategy for lazy-freed PMD-sized folio?