Re: File THP and HWPoison
From: Matthew Wilcox <willy@infradead.org>
Date: 2021-03-16 16:52:26
On Tue, Mar 16, 2021 at 09:36:49AM -0700, Andi Kleen wrote:
quoted
So we now map the PMD-sized page into userspace, even though it has a HWPoison in it.Yes that's bad. It might panic the system.quoted
I think there are two things that we should be doing: 1. Attempt to split THPs which are file-backed. That makes most of this problem disappear because there won't be THPs with HWPoison, mostly.That seems simple and sensible.quoted
2. When the THP fails to split, use a spare page flag to indicate that the THP contains a HWPoison bit in one of its subpages. There are a lot of PF_SECOND flags available for this purpose.Why should it fail? I thought splitting always succeeds.
If somebody has a temporary reference to it, splitting will fail. eg a process is currently doing a read() from it, so filemap_read() has a reference on the page. This is why THPs support a delayed split (currently used under memory pressure, but we could do something using that delayed list to schedule the page for splitting later if it has HWPoison).