From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8ACF7C4338F for ; Thu, 19 Aug 2021 04:32:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6E4A360698 for ; Thu, 19 Aug 2021 04:32:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229706AbhHSEda (ORCPT ); Thu, 19 Aug 2021 00:33:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229548AbhHSEda (ORCPT ); Thu, 19 Aug 2021 00:33:30 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AEDDC061764 for ; Wed, 18 Aug 2021 21:32:54 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id w5so9963094ejq.2 for ; Wed, 18 Aug 2021 21:32:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ubfeGC8hBPINfgsfaFwyzQgBXCaEyQzf4aYBEpJp0fQ=; b=NNJy5EjqV0GKZWIhLKsPiB6DiVCBQLgu7nz8x77PoU04kkF/SmVxJSREKDeIlcAqyL TxPJNLQsYJ9ZDfW2soWi4nkJrJV7Y7hWwzevQxXkthOqdwcDLLPwX9qNuzdN0hiYVNrR dJPdrw7RxyMBT4iblu03kcx2QwRdwXUqN27MuI81HyfPuDlo7wXGE1SK82vU97xRc5RZ RKcuG5XJ4vuddClsldU1kaiFcKWVe08YyWgzsumSIUuLZoALiUldE1YcfnJ1D9kdmide bK68IWWzcJHGYdGx4KpWPfOyzFjBReEHslTKfO4fUIfMsM6gOt9ylI6h7Oyqc80JTGut 1B5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ubfeGC8hBPINfgsfaFwyzQgBXCaEyQzf4aYBEpJp0fQ=; b=bCT9gvUeQRCeYF4auMXXuWKcaJEU7UKhUiUiebEXDY+PCZSy3rnI5zA+T5DLeuu1CT PRf+Rp4dnvD1SblJFElnxWYQiXiwYNOLo7ksiuR5C+8sDA/nmschQK32SpjG1KI9SDiE +YsWRPbnvxQWeemS0LLjSk4lysMqbq+/Vi5TDmTAmTgb8RaCx3RuDI/dTLpTlkSMyPrg mPS8BXKQde4N1cqqo93hHtN6QOCWmFkcIwFr6KgITG133QjDMzWX/dX6zYd0pkOjRVaw RVEJETHGQue15CH3Qg9PUU22VQshjtn0HM7ighFYYYB3Ex7JeaBxPxb5JDGwii17KSrR 807g== X-Gm-Message-State: AOAM530NckEqCRACjHaSPMubYbaWK7VA6/nRj2VwLfL9pxwb83HDrZkA fBmGOtNNJS39z+Vu9wY5bzx2gkvpmHVThmlkpxQ= X-Google-Smtp-Source: ABdhPJymj0dcg1F2fDDKY1nPj9Zmh8COCKlBzdv9aIe0cQAu25nNsfWAI7ne8MKbt4B4lLMgyZthya6Xf95Kw2h490I= X-Received: by 2002:a17:906:1f82:: with SMTP id t2mr13378982ejr.499.1629347572753; Wed, 18 Aug 2021 21:32:52 -0700 (PDT) MIME-Version: 1.0 References: <20210819001958.2365157-1-naoya.horiguchi@linux.dev> In-Reply-To: <20210819001958.2365157-1-naoya.horiguchi@linux.dev> From: Yang Shi Date: Wed, 18 Aug 2021 21:32:41 -0700 Message-ID: Subject: Re: [PATCH v2] mm/hwpoison: Retry with shake_page() for unhandlable pages To: Naoya Horiguchi Cc: Linux MM , Andrew Morton , Tony Luck , Oscar Salvador , Muchun Song , Mike Kravetz , Michal Hocko , David Hildenbrand , Naoya Horiguchi , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 18, 2021 at 5:20 PM Naoya Horiguchi wrote: > > From: Naoya Horiguchi > > HWPoisonHandlable() sometimes returns false for typical user pages > due to races with average memory events like transfers over LRU lists. > This causes failures in hwpoison handling. > > There's retry code for such a case but does not work because the retry > loop reaches the retry limit too quickly before the page settles down to > handlable state. Let get_any_page() call shake_page() to fix it. > > Fixes: 25182f05ffed ("mm,hwpoison: fix race with hugetlb page allocation") > Reported-by: Tony Luck > Signed-off-by: Naoya Horiguchi > Cc: stable@vger.kernel.org # 5.13 > --- > ChangeLog v2: > - get_any_page() return -EIO when retry limit reached (by Yang Shi) Thanks for taking this. The fix looks good to me. Reviewed-by: Yang Shi > --- > mm/memory-failure.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git v5.14-rc6/mm/memory-failure.c v5.14-rc6_patched/mm/memory-failure.c > index eefd823deb67..470400cc7513 100644 > --- v5.14-rc6/mm/memory-failure.c > +++ v5.14-rc6_patched/mm/memory-failure.c > @@ -1146,7 +1146,7 @@ static int __get_hwpoison_page(struct page *page) > * unexpected races caused by taking a page refcount. > */ > if (!HWPoisonHandlable(head)) > - return 0; > + return -EBUSY; > > if (PageTransHuge(head)) { > /* > @@ -1199,9 +1199,15 @@ static int get_any_page(struct page *p, unsigned long flags) > } > goto out; > } else if (ret == -EBUSY) { > - /* We raced with freeing huge page to buddy, retry. */ > - if (pass++ < 3) > + /* > + * We raced with (possibly temporary) unhandlable > + * page, retry. > + */ > + if (pass++ < 3) { > + shake_page(p, 1); > goto try_again; > + } > + ret = -EIO; > goto out; > } > } > -- > 2.25.1 > >