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=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 DBCECC433DF for ; Fri, 16 Oct 2020 20:49:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 85A6321775 for ; Fri, 16 Oct 2020 20:49:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602881376; bh=I/vceL/RykSghUCo918blScGVH66jt66Anur9mTaggM=; h=Date:From:To:Subject:Reply-To:List-ID:From; b=fbBryGA5bPuxyXygnpkgWPrKrS9t7ps/J+11EzQZZaSvbO30kuX3VrPtNdKIj5zig LNvse8keJT3ty6kRVFOqUon7CTLaTNnIzt134f08lErTiJ0hKt5B6xgXxdh4T0PC1T YRJbyqnx3OzWxCr7zLJ/CTMgnob/lQv+qO/3NpXQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392397AbgJPUtg (ORCPT ); Fri, 16 Oct 2020 16:49:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:38616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391060AbgJPUtg (ORCPT ); Fri, 16 Oct 2020 16:49:36 -0400 Received: from localhost.localdomain (c-71-198-47-131.hsd1.ca.comcast.net [71.198.47.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DB635214DB; Fri, 16 Oct 2020 20:49:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602881373; bh=I/vceL/RykSghUCo918blScGVH66jt66Anur9mTaggM=; h=Date:From:To:Subject:From; b=x7//3a7JT+g2nMwaQZrM7V0mbmsNIxd6doPae/jfLM5hQKSzn5Y3kG2LJcU5NDw3y FrwbLnVO62AzexuGI6l/aV6Gdn5u4Dw4jG/KC3GKkj8ZNRQ1TlEt0yACXMNMbRxsmj 4wxXA21L6gVI6KzqW2f0agTfpqyZxv3dfTce+3aM= Date: Fri, 16 Oct 2020 13:49:31 -0700 From: akpm@linux-foundation.org To: aneesh.kumar@linux.ibm.com, aneesh.kumar@linux.vnet.ibm.com, aris@ruivo.org, cai@lca.pw, dave.hansen@intel.com, david@redhat.com, mhocko@kernel.org, mike.kravetz@oracle.com, mm-commits@vger.kernel.org, naoya.horiguchi@nec.com, osalvador@suse.com, osalvador@suse.de, tony.luck@intel.com, zeil@yandex-team.ru Subject: [merged] mmhwpoison-unify-thp-handling-for-hard-and-soft-offline.patch removed from -mm tree Message-ID: <20201016204931.jeG5ZneCz%akpm@linux-foundation.org> User-Agent: s-nail v14.8.16 Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The patch titled Subject: mm,hwpoison: unify THP handling for hard and soft offline has been removed from the -mm tree. Its filename was mmhwpoison-unify-thp-handling-for-hard-and-soft-offline.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ From: Oscar Salvador Subject: mm,hwpoison: unify THP handling for hard and soft offline Place the THP's page handling in a helper and use it from both hard and soft-offline machinery, so we get rid of some duplicated code. Link: https://lkml.kernel.org/r/20200922135650.1634-8-osalvador@suse.de Signed-off-by: Oscar Salvador Acked-by: Naoya Horiguchi Cc: "Aneesh Kumar K.V" Cc: Aneesh Kumar K.V Cc: Aristeu Rozanski Cc: Dave Hansen Cc: David Hildenbrand Cc: Dmitry Yakunin Cc: Michal Hocko Cc: Mike Kravetz Cc: Oscar Salvador Cc: Qian Cai Cc: Tony Luck Signed-off-by: Andrew Morton --- mm/memory-failure.c | 48 +++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 26 deletions(-) --- a/mm/memory-failure.c~mmhwpoison-unify-thp-handling-for-hard-and-soft-offline +++ a/mm/memory-failure.c @@ -1102,6 +1102,25 @@ static int identify_page_state(unsigned return page_action(ps, p, pfn); } +static int try_to_split_thp_page(struct page *page, const char *msg) +{ + lock_page(page); + if (!PageAnon(page) || unlikely(split_huge_page(page))) { + unsigned long pfn = page_to_pfn(page); + + unlock_page(page); + if (!PageAnon(page)) + pr_info("%s: %#lx: non anonymous thp\n", msg, pfn); + else + pr_info("%s: %#lx: thp split failed\n", msg, pfn); + put_page(page); + return -EBUSY; + } + unlock_page(page); + + return 0; +} + static int memory_failure_hugetlb(unsigned long pfn, int flags) { struct page *p = pfn_to_page(pfn); @@ -1324,21 +1343,8 @@ int memory_failure(unsigned long pfn, in } if (PageTransHuge(hpage)) { - lock_page(p); - if (!PageAnon(p) || unlikely(split_huge_page(p))) { - unlock_page(p); - if (!PageAnon(p)) - pr_err("Memory failure: %#lx: non anonymous thp\n", - pfn); - else - pr_err("Memory failure: %#lx: thp split failed\n", - pfn); - if (TestClearPageHWPoison(p)) - num_poisoned_pages_dec(); - put_page(p); + if (try_to_split_thp_page(p, "Memory Failure") < 0) return -EBUSY; - } - unlock_page(p); VM_BUG_ON_PAGE(!page_count(p), p); } @@ -1855,19 +1861,9 @@ static int soft_offline_in_use_page(stru int mt; struct page *hpage = compound_head(page); - if (!PageHuge(page) && PageTransHuge(hpage)) { - lock_page(page); - if (!PageAnon(page) || unlikely(split_huge_page(page))) { - unlock_page(page); - if (!PageAnon(page)) - pr_info("soft offline: %#lx: non anonymous thp\n", page_to_pfn(page)); - else - pr_info("soft offline: %#lx: thp split failed\n", page_to_pfn(page)); - put_page(page); + if (!PageHuge(page) && PageTransHuge(hpage)) + if (try_to_split_thp_page(page, "soft offline") < 0) return -EBUSY; - } - unlock_page(page); - } /* * Setting MIGRATE_ISOLATE here ensures that the page will be linked _ Patches currently in -mm which might be from osalvador@suse.de are