From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) (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 6BBC41DC985 for ; Fri, 19 Dec 2025 01:42:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.113 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766108547; cv=none; b=dQfFJdJulPKkNl8JVMrXw4RLEUGvDjxWNKhPsAFfeyXUZ6WJlL7kzNvxRHYAO5YyRAZBC0t5qrYt+JaBGcukzQAxk0hZmSOm5RZNExDgFUIHnl9+ftA1s161uf2DQMrHKxe414onzYX1IIAHiHkT1hjvDhOspOqlDhMZ7xwkn0M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766108547; c=relaxed/simple; bh=F6HK6/tgcBDCgmE6YLDaykaoHv848MEx7sXavJLZpjk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TqGyU5B3EIyonZ90inQGEI1Hr9BGpfbOYGLEHONEbyrtgdyZqANFgU1uM6qdKyJ5JgAClu8ge4l/zb8ruG6Xu8D9x39KqVyOTgejF3UkzdAShjZ7X0cLlkNU4F2KE12uZqqVqkGk2trwuQoIxzd1gF21lQ3VfLtsd8y1EoRIAZM= 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=TVwXy+6C; arc=none smtp.client-ip=115.124.30.113 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="TVwXy+6C" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1766108542; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=ErxvyipvL98VqcIt+BEu7/k5SVUdoeQoBQCwgW4JgEA=; b=TVwXy+6C92zjCK1DHhzXNOgPRW/PWgjPnMEBgzCPqjbLql1mocfHozzfWiiR+IqCkwQfGDtrLs0qj3NY4fFdhNaMMnC4Aq6eHzsVstZ/agG6zQz0DysmjA9dF8FxpvtnPj8k2wywDTG0xtnRN+AuyxyoH5DNxI36vSHLo1aQZGU= Received: from 30.74.144.116(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0WvAfIbP_1766108540 cluster:ay36) by smtp.aliyun-inc.com; Fri, 19 Dec 2025 09:42:21 +0800 Message-ID: Date: Fri, 19 Dec 2025 09:42:20 +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] mm: Consider non-anon swap cache folios in folio_expected_ref_count() To: Wei Yang , "David Hildenbrand (Red Hat)" Cc: Zi Yan , Bijan Tabatabai , linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.com, mhocko@suse.com, shivankg@amd.com, Hugh Dickins , Chris Li , Kairui Song References: <20251216200727.2360228-1-bijan311@gmail.com> <6b4cadb2-6246-48cc-9c76-64ba0a23198b@kernel.org> <0C218C18-916B-4BB0-8B37-AC82503E4AD9@nvidia.com> <20251219002134.uqgtnr43zz7vvvtd@master> From: Baolin Wang In-Reply-To: <20251219002134.uqgtnr43zz7vvvtd@master> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2025/12/19 08:21, Wei Yang wrote: > On Wed, Dec 17, 2025 at 02:04:16AM +0100, David Hildenbrand (Red Hat) wrote: >>>>> >>>>> I am not very familiar with the memory hot-(un)plug or swapping code, so >>>>> I am not 100% certain if this patch actually solves the root of the >>>>> problem. I believe the issue is from shmem folios, in which case I believe >>>>> this patch is correct. However, I couldn't think of an easy way to confirm >>>>> that the affected folios were from shmem. I guess it could be possible that >>>>> the root cause could be from some bug where some anonymous pages do not >>>>> return true to folio_test_anon(). I don't think that's the case, but >>>>> figured the MM maintainers would have a better idea of what's going on. >>> >>> I am not sure about if shmem in swapcache causes the issue, since >>> the above setup does not involve shmem. +Baolin and Hugh for some insight. >> >> We might just push out another unrelated shmem page to swap as we create >> memory pressure in the system I think. >> > > One trivial question: currently we only put anon/shmem folio in swapcache, > right? AFAICT, Yes (note a special case for anonymous folios: lazyfree anonymous folios will be directly freed instead of being swapped out).