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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C192CC433F5 for ; Wed, 27 Apr 2022 21:14:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 530726B0071; Wed, 27 Apr 2022 17:14:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B8376B0073; Wed, 27 Apr 2022 17:14:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 333476B0074; Wed, 27 Apr 2022 17:14:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 21CAE6B0071 for ; Wed, 27 Apr 2022 17:14:12 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 2E46B25EED for ; Wed, 27 Apr 2022 21:14:09 +0000 (UTC) X-FDA: 79403911818.26.2D94435 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by imf23.hostedemail.com (Postfix) with ESMTP id A447B14005E for ; Wed, 27 Apr 2022 21:14:02 +0000 (UTC) Received: by mail-pf1-f170.google.com with SMTP id j17so2585511pfi.9 for ; Wed, 27 Apr 2022 14:14:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=79YGdXkixsQqygnw5hv0xTUbw4wEdIFjaT7mabiBHCY=; b=PdlvZReieGBwj5djjksA823uWF/Ll4czpjr20QYFBv4r5SQiYsc4lVV7YwJ01aWVZG C30UsPB+OCUAQT1+d9MDTcMsb+Xl2ei9CBtuu4kBtvj04MIagZWgN8j55L2YqLzvINTz QaDtx8c0qocWAwMBuCv/xDnyAbIuVWnjraYOk0RQ9oShc1VQdwIrfF5TZ3G/JG6enXhK fFBr1JjffQNrYakMsmzHQnLY/RDELZn9AXX/SRslJDAyGyzprpSE3b8KcWJV7QI7xqP8 ZY8dVYTGx+C0w5l3eRDjIN/VUyawUrsqxY3aGNlMldj96d7SLxcBpESlnDuIQPjqkZ1T /8RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=79YGdXkixsQqygnw5hv0xTUbw4wEdIFjaT7mabiBHCY=; b=2mmUylbOowZO98DQ4WXrmGwF+sHIXOu7EQfO9/uLineuARzmphQRJ3ZqGE9mJVQiUn +Gio7Y4N1qnmCo/l2CyWiVtx4mvxJiSJaKU3kc7QGw0yTRhY0n3QFW6+CAAj5sBCpxdb gYXTb3Vdt6JOP4GbRP4ifwM0LOufZZLi6UN5OEXc7QrIqEASLZYuzj3WtQc4Ym/VsKNi jc8NyylxaK6d1sGBC271FVQB4RV2441ycKNAtaKTNMBlTD1hlcOPcPn3f643a8qpy0up 8SLCe6wJcskgFMpR20xmI8iRSoyvG/MFwILwNcPNNRn2pHsLsLa5FhQTGtlgj4Yj5ph9 drNA== X-Gm-Message-State: AOAM533F0OBGK1yz6UasGaujoPujtZ2Wf+FXBSt2XgQvRs9zdBCCIfF7 p1pN3hici+2pqinSPUtQ/QISE07PtFSrHKaQ9K0= X-Google-Smtp-Source: ABdhPJy+xUB0ugGx/XRHgsFDUrTAtPneSzFpusY0hitwYROQGgrjBld4ai3JCzrn/VkTaOyAb2yLH59zjRJqFx1395A= X-Received: by 2002:a65:6951:0:b0:381:f10:ccaa with SMTP id w17-20020a656951000000b003810f10ccaamr24986216pgq.587.1651094047550; Wed, 27 Apr 2022 14:14:07 -0700 (PDT) MIME-Version: 1.0 References: <872cefb182ba1dd686b0e7db1e6b2ebe5a4fff87.1651039624.git.xuyu@linux.alibaba.com> In-Reply-To: <872cefb182ba1dd686b0e7db1e6b2ebe5a4fff87.1651039624.git.xuyu@linux.alibaba.com> From: Yang Shi Date: Wed, 27 Apr 2022 14:13:55 -0700 Message-ID: Subject: Re: [PATCH 1/2] Revert "mm/memory-failure.c: skip huge_zero_page in memory_failure()" To: Xu Yu Cc: Linux MM , Andrew Morton , =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: A447B14005E X-Stat-Signature: y1wdfh38tnaxr9iwm7qiirfjq3bz16x6 X-Rspam-User: Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=PdlvZRei; spf=pass (imf23.hostedemail.com: domain of shy828301@gmail.com designates 209.85.210.170 as permitted sender) smtp.mailfrom=shy828301@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1651094042-817367 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Apr 26, 2022 at 11:10 PM Xu Yu wrote: > > This reverts commit d173d5417fb67411e623d394aab986d847e47dad. > > The commit d173d5417fb6 ("mm/memory-failure.c: skip huge_zero_page in > memory_failure()") explicitly skips huge_zero_page in memory_failure(), > in order to avoid triggering VM_BUG_ON_PAGE on huge_zero_page in > split_huge_page_to_list(). > > This works, but Yang Shi thinks that, > > Raising BUG is overkilling for splitting huge_zero_page. The > huge_zero_page can't be met from normal paths other than memory > failure, but memory failure is a valid caller. So I tend to replace > the BUG to WARN + returning -EBUSY. If we don't care about the > reason code in memory failure, we don't have to touch memory > failure. > > And for the issue that huge_zero_page will be set PG_has_hwpoisoned, > Yang Shi comments that, > > The anonymous page fault doesn't check if the page is poisoned or > not since it typically gets a fresh allocated page and assumes the > poisoned page (isolated successfully) can't be reallocated again. > But huge zero page and base zero page are reused every time. So no > matter what fix we pick, the issue is always there. > > Finally, Yang, David, Anshuman and Naoya all agree to fix the bug, i.e., > to split huge_zero_page, in split_huge_page_to_list(). > > This reverts the commit d173d5417fb6 ("mm/memory-failure.c: skip > huge_zero_page in memory_failure()"), and the original bug will be fixed > by the next patch. Reviewed-by: Yang Shi > > Suggested-by: Yang Shi > Cc: Naoya Horiguchi > Signed-off-by: Xu Yu > --- > mm/memory-failure.c | 13 ------------- > 1 file changed, 13 deletions(-) > > diff --git a/mm/memory-failure.c b/mm/memory-failure.c > index 27760c19bad7..2020944398c9 100644 > --- a/mm/memory-failure.c > +++ b/mm/memory-failure.c > @@ -1860,19 +1860,6 @@ int memory_failure(unsigned long pfn, int flags) > } > > if (PageTransHuge(hpage)) { > - /* > - * Bail out before SetPageHasHWPoisoned() if hpage is > - * huge_zero_page, although PG_has_hwpoisoned is not > - * checked in set_huge_zero_page(). > - * > - * TODO: Handle memory failure of huge_zero_page thoroughly. > - */ > - if (is_huge_zero_page(hpage)) { > - action_result(pfn, MF_MSG_UNSPLIT_THP, MF_IGNORED); > - res = -EBUSY; > - goto unlock_mutex; > - } > - > /* > * The flag must be set after the refcount is bumped > * otherwise it may race with THP split. > -- > 2.20.1.2432.ga663e714 >