[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191021125842.GA11330@linux>
Date: Mon, 21 Oct 2019 14:58:49 +0200
From: Oscar Salvador <osalvador@...e.de>
To: Michal Hocko <mhocko@...nel.org>
Cc: n-horiguchi@...jp.nec.com, mike.kravetz@...cle.com,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v2 10/16] mm,hwpoison: Rework soft offline for free
pages
On Fri, Oct 18, 2019 at 02:06:15PM +0200, Michal Hocko wrote:
> On Thu 17-10-19 16:21:17, Oscar Salvador wrote:
> [...]
> > +bool take_page_off_buddy(struct page *page)
> > + {
> > + struct zone *zone = page_zone(page);
> > + unsigned long pfn = page_to_pfn(page);
> > + unsigned long flags;
> > + unsigned int order;
> > + bool ret = false;
> > +
> > + spin_lock_irqsave(&zone->lock, flags);
>
> What prevents the page to be allocated in the meantime? Also what about
> free pages on the pcp lists? Also the page could be gone by the time you
> have reached here.
Nothing prevents the page to be allocated in the meantime.
We would just bail out and return -EBUSY to userspace.
Since we do not do __anything__ to the page until we are sure we took it off,
and it is completely isolated from the memory, there is no danger.
Since soft-offline is kinda "best effort" mode, it is something like:
"Sorry, could not poison the page, try again".
Now, thinking about this a bit more, I guess we could be more clever here
and call the routine that handles in-use pages if we see that the page
was allocated by the time we reach take_page_off_buddy.
About pcp pages, you are right.
I thought that we were already handling that case, and we do, but looking closer the
call to shake_page() (that among other things spills pcppages into buddy)
is performed at a later stage.
I think we need to adjust __get_any_page to recognize pcp pages as well.
I will do some work here.
Thanks for comments.
--
Oscar Salvador
SUSE L3
Powered by blists - more mailing lists