Re: [RFC PATCH v2 11/16] mm,hwpoison: Rework soft offline for in-use pages
From: Michal Hocko
Date: Tue Oct 22 2019 - 04:30:13 EST
On Tue 22-10-19 09:56:27, Oscar Salvador wrote:
> On Mon, Oct 21, 2019 at 04:06:19PM +0200, Michal Hocko wrote:
> > On Mon 21-10-19 15:48:48, Oscar Salvador wrote:
> > > We can only perform actions on LRU/Movable pages or hugetlb pages.
> >
> > What would prevent other pages mapped via page tables to be handled as
> > well?
>
> What kind of pages?
Any pages mapped to the userspace. E.g. driver memory which is not on
LRU.
> I mean, I guess it could be done, it was just not implemented, and I
> did not want to add more "features" as my main goal was to re-work
> the interface to be more deterministic.
Fair enough. One step at the time sounds definitely good
> > > 1) we would need to hook in enqueue_hugetlb_page so the page is not enqueued
> > > into hugetlb freelists
> > > 2) when trying to free a hugetlb page, we would need to do as we do for gigantic
> > > pages now, and that is breaking down the pages into order-0 pages and release
> > > them to the buddy (so the check in free_papges_prepare would skip the
> > > hwpoison page).
> > > Trying to handle a higher-order hwpoison page in free_pages_prepare is
> > > a bit complicated.
> >
> > I am not sure I see the problem. If you dissolve the hugetlb page then
> > there is no hugetlb page anymore and so you make it a regular high-order
> > page.
>
> Yes, but the problem comes when trying to work with a hwpoison high-order page
> in free_pages_prepare, it gets more complicated, and when I weigthed
> code vs benefits, I was not really sure to go down that road.
>
> If we get a hwpoison high-order page in free_pages_prepare, we need to
> break it down to smaller pages, so we can skip the "bad" to not be sent
> into buddy allocator.
But we have destructors for compound pages. Can we do the heavy lifting
there?
> > If the page is free then it shouldn't pin the memcg or any other state.
>
> Well, it is not really free, as it is not usable, is it?
Sorry I meant to say the page is free from the memcg POV - aka no task
from the memcg is holding a reference to it. The page is not usable for
anybody, that is true but no particular memcg should pay a price for
that. This would mean that random memcgs would end up pinned for ever
without a good reason.
--
Michal Hocko
SUSE Labs