linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	Michal Hocko <mhocko@kernel.org>,
	"xishi.qiuxishi@alibaba-inc.com" <xishi.qiuxishi@alibaba-inc.com>,
	"zy.zhengyi@alibaba-inc.com" <zy.zhengyi@alibaba-inc.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 2/2] mm: soft-offline: close the race against page allocation
Date: Tue, 17 Jul 2018 00:27:31 +0000	[thread overview]
Message-ID: <20180717002731.GA11433@hori1.linux.bs1.fc.nec.co.jp> (raw)
In-Reply-To: <20180713134002.a365049a79d41be3c28916cc@linux-foundation.org>

On Fri, Jul 13, 2018 at 01:40:02PM -0700, Andrew Morton wrote:
> On Fri, 13 Jul 2018 12:26:06 +0900 Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> wrote:
> 
> > A process can be killed with SIGBUS(BUS_MCEERR_AR) when it tries to
> > allocate a page that was just freed on the way of soft-offline.
> > This is undesirable because soft-offline (which is about corrected error)
> > is less aggressive than hard-offline (which is about uncorrected error),
> > and we can make soft-offline fail and keep using the page for good reason
> > like "system is busy."
> > 
> > Two main changes of this patch are:
> > 
> > - setting migrate type of the target page to MIGRATE_ISOLATE. As done
> >   in free_unref_page_commit(), this makes kernel bypass pcplist when
> >   freeing the page. So we can assume that the page is in freelist just
> >   after put_page() returns,
> > 
> > - setting PG_hwpoison on free page under zone->lock which protects
> >   freelists, so this allows us to avoid setting PG_hwpoison on a page
> >   that is decided to be allocated soon.
> > 
> >
> > ...
> >
> > +
> > +#ifdef CONFIG_MEMORY_FAILURE
> > +/*
> > + * Set PG_hwpoison flag if a given page is confirmed to be a free page
> > + * within zone lock, which prevents the race against page allocation.
> > + */
> 
> I think this is clearer?
> 
> --- a/mm/page_alloc.c~mm-soft-offline-close-the-race-against-page-allocation-fix
> +++ a/mm/page_alloc.c
> @@ -8039,8 +8039,9 @@ bool is_free_buddy_page(struct page *pag
>  
>  #ifdef CONFIG_MEMORY_FAILURE
>  /*
> - * Set PG_hwpoison flag if a given page is confirmed to be a free page
> - * within zone lock, which prevents the race against page allocation.
> + * Set PG_hwpoison flag if a given page is confirmed to be a free page.  This
> + * test is performed under the zone lock to prevent a race against page
> + * allocation.

Yes, I like it.

Thanks,
Naoya Horiguchi

      reply	other threads:[~2018-07-17  0:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-13  3:26 [PATCH v1 0/2] mm: soft-offline: fix " Naoya Horiguchi
2018-07-13  3:26 ` [PATCH v1 1/2] mm: fix race on soft-offlining free huge pages Naoya Horiguchi
2018-07-13  5:23   ` 回复:[PATCH " 裘稀石(稀石)
2018-07-13  5:28     ` 裘稀石(稀石)
2018-07-13 20:35   ` [PATCH " Andrew Morton
2018-07-17  0:25     ` Naoya Horiguchi
2018-07-13  3:26 ` [PATCH v1 2/2] mm: soft-offline: close the race against page allocation Naoya Horiguchi
2018-07-13 20:40   ` Andrew Morton
2018-07-17  0:27     ` Naoya Horiguchi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180717002731.GA11433@hori1.linux.bs1.fc.nec.co.jp \
    --to=n-horiguchi@ah.jp.nec.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=xishi.qiuxishi@alibaba-inc.com \
    --cc=zy.zhengyi@alibaba-inc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox