From patchwork Mon Jul 8 03:05:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13726148 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 627A3C38150 for ; Mon, 8 Jul 2024 03:10:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CF3176B0083; Sun, 7 Jul 2024 23:10:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CA3106B0088; Sun, 7 Jul 2024 23:10:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B90C76B0089; Sun, 7 Jul 2024 23:10:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 9AF606B0083 for ; Sun, 7 Jul 2024 23:10:22 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id EB927C105E for ; Mon, 8 Jul 2024 03:10:21 +0000 (UTC) X-FDA: 82315107042.18.B16B0AB Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf01.hostedemail.com (Postfix) with ESMTP id 1A4B640002 for ; Mon, 8 Jul 2024 03:10:18 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720408205; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=VxwjxN2MqwqNpKuP3KbCgV3Gg/jPDkz6wUtpQZvChGc=; b=aSaMRMI/6wyZMZcjLDeeNYMp8QTBjgSw4QnALWFS9DR2vW0gtlg47reh41eePr2jXlJe1b ibk/q4KsMGKQpM892C+LEKKev46LBHvFABm9VFY50/BIUMTF144O63AKLNkf67XWY986Be VU6bl9v0s9qCAstZz43SFnNMHjcA2ak= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720408205; a=rsa-sha256; cv=none; b=zsGmT3osM3C+cOD/dkLIiaCCxILxJ6XIEgaYiEnSQBcFH7AlzE5yE55JxHjw6kZEH/R7Xb GkW7M+iOcSmBIMkXeftyUwDwLgLDbIQa/0Sv+RMTSqNIhmgIz8Zf0Vtuu5djiy9IWzPhwV BQgADBXu4/+hHkkDGQzWsFZ15Xw0dU0= Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WHTWz4ZyXzwWJg; Mon, 8 Jul 2024 11:05:35 +0800 (CST) Received: from kwepemd200019.china.huawei.com (unknown [7.221.188.193]) by mail.maildlp.com (Postfix) with ESMTPS id 47D81140F65; Mon, 8 Jul 2024 11:10:15 +0800 (CST) Received: from huawei.com (10.173.127.72) by kwepemd200019.china.huawei.com (7.221.188.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 8 Jul 2024 11:10:14 +0800 From: Miaohe Lin To: CC: , , , , , , Subject: [PATCH] mm/memory-failure: remove obsolete MF_MSG_DIFFERENT_COMPOUND Date: Mon, 8 Jul 2024 11:05:44 +0800 Message-ID: <20240708030544.196919-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-Originating-IP: [10.173.127.72] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemd200019.china.huawei.com (7.221.188.193) X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 1A4B640002 X-Stat-Signature: q3ehj7uihi1m6f77enm7bt146w8s46is X-Rspam-User: X-HE-Tag: 1720408218-803610 X-HE-Meta: U2FsdGVkX1+YX0Gc15zzqnmPmwjA1SXIAR0LjEk3xctBpxj+7WAtfj/yeISSUjKNGcW5Mlv+xddtie2Yj/zpdrDPbZuC/5iyJdOy0sFx3OJo6vpJU2bkcIB5FY1XWvO5TQZhsvRgz+gsrVkS8TM3xMZu8kXN/EfJ/5h/lEUjk5GCnwmMrYpfQsFk848pccEg5jjuRrqwbq9OVVoqNZ/38YwnFaBH3G3QxscYYl61ozGfuQzEXnrIXTEQarLRW2I9s8oYYJq0XeYIQiIdlqNYCG4K81mqKUSgU0BMpkDBPSHDVNfgx6nyH4c3BWmlldEzeiMzU2oY4rJVcvz0U/q/yOPB5nFFDVROnhWiWRDi//4YICEUnBiP2Ky/drmKPFcBx7jEjJUbT4gDSj8FwnA0FjVjWLrAZn2TzTFr0E/zhZypHmSW0FwR0U2UqCAqEKczvLJURLM9UiupDs7ue61JbV/FGBGJ6c22Ls2sshSUlC+AWs1Eijw/gOAns/8nMeOvBOAYvQnCZvMakBhDh0mjOqEgxN2nBngHro56cGQla7YjEjvsNTmmHFtV8jiHxDFI9IlE042PNMyy7kdcEKQRWhi8kO8kSAI6KfxQ3wIVzDwk6P3HAv48nbYIEmeOwKet4C5y+5ZrRRBQCFE0nCMuyhS1I8PjfRudQ5D0YO+2OYJMi5dANpA7W4O3tkWiGlvI6naMM0JPDal333dkuXUNrkVuKdlHvPqu17zPDe6Sv+q6m2q+5b+2GOHt+DfV5oQVnSBTIYcIYTCLTcPURFh2JOVjmu3IydYISe7VP7SVpT72Sxhywg3xFyVPA8dQ3ci157or1DQOKKFzQeL/7p7JJDQ986cA46/b8xTyygDuIcpLUQ6OYhko3z/d0Jiuo7sI4l+zXvUu48GhiUkumfpZK5JmhhPxon/oOQ2OItFv5tVpOCgftFyiTyNmML9N1GAysYTjW/i+CwNp61yS+k5 3vb02Og0 iX29jx6eTKq7E5/7+UhCTBtjIsh+mRKqODf9m5rTEstWjSNHlfxVrKN2ut/tUusYbL8rcDyLerrsWQXdZX4l76+LUZcKuX5w/wxOwsioKV6ladmnD1jIIku7iANxUlGthoJfI21Cm9AURo0q58UdWg0D+7mi8Tt7mI61XGrQiNq0Nze5txLBXg5Oovu+si0YPML1Cy5jIK9nk9PWTrNm8Jg0sKqRgjiK2+AWD25ObeF98eV6XuMDJb9ZnR1jHR2smAgf3a+/0Wgyfe6XjblFCfs+4fbRFmijUrZ27mEWXhCSInxPBk+6Y7jNk6A== 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: List-Subscribe: List-Unsubscribe: The page cannot become compound pages again just after folio is splited as extra refcnt is held. So MF_MSG_DIFFERENT_COMPOUND case is obsolete and could be removed to get rid of this false assumption and code burden. But add one WARN_ON() here to keep the scene clear. Signed-off-by: Miaohe Lin --- include/ras/ras_event.h | 1 - mm/memory-failure.c | 19 +++---------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h index 9bc707fe8819..e5f7ee0864e7 100644 --- a/include/ras/ras_event.h +++ b/include/ras/ras_event.h @@ -356,7 +356,6 @@ TRACE_EVENT(aer_event, #define MF_PAGE_TYPE \ EM ( MF_MSG_KERNEL, "reserved kernel page" ) \ EM ( MF_MSG_KERNEL_HIGH_ORDER, "high-order kernel page" ) \ - EM ( MF_MSG_DIFFERENT_COMPOUND, "different compound page after locking" ) \ EM ( MF_MSG_HUGE, "huge page" ) \ EM ( MF_MSG_FREE_HUGE, "free huge page" ) \ EM ( MF_MSG_GET_HWPOISON, "get hwpoison page" ) \ diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 16f8651436d5..581d3e5c9117 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -919,7 +919,6 @@ static const char *action_name[] = { static const char * const action_page_types[] = { [MF_MSG_KERNEL] = "reserved kernel page", [MF_MSG_KERNEL_HIGH_ORDER] = "high-order kernel page", - [MF_MSG_DIFFERENT_COMPOUND] = "different compound page after locking", [MF_MSG_HUGE] = "huge page", [MF_MSG_FREE_HUGE] = "free huge page", [MF_MSG_GET_HWPOISON] = "get hwpoison page", @@ -2349,22 +2348,10 @@ int memory_failure(unsigned long pfn, int flags) /* * We're only intended to deal with the non-Compound page here. - * However, the page could have changed compound pages due to - * race window. If this happens, we could try again to hopefully - * handle the page next round. + * The page cannot become compound pages again as folio has been + * splited and extra refcnt is held. */ - if (folio_test_large(folio)) { - if (retry) { - ClearPageHWPoison(p); - folio_unlock(folio); - folio_put(folio); - flags &= ~MF_COUNT_INCREASED; - retry = false; - goto try_again; - } - res = action_result(pfn, MF_MSG_DIFFERENT_COMPOUND, MF_IGNORED); - goto unlock_page; - } + WARN_ON(folio_test_large(folio)); /* * We use page flags to determine what action should be taken, but