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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2764ECAAD2 for ; Thu, 1 Sep 2022 06:50:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233190AbiIAGum (ORCPT ); Thu, 1 Sep 2022 02:50:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232685AbiIAGug (ORCPT ); Thu, 1 Sep 2022 02:50:36 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 420869E6A5 for ; Wed, 31 Aug 2022 23:50:34 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E7E98D6E; Wed, 31 Aug 2022 23:50:39 -0700 (PDT) Received: from [10.162.43.7] (unknown [10.162.43.7]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C0B673F7B4; Wed, 31 Aug 2022 23:50:59 -0700 (PDT) Message-ID: Date: Thu, 1 Sep 2022 12:20:28 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v2] mm: memory-failure: kill __soft_offline_page() Content-Language: en-US To: 20220830071514.GA1106752@hori.linux.bs1.fc.nec.co.jp, Andrew Morton , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Kefeng Wang , Miaohe Lin , Naoya Horiguchi References: <20220830104654.28234-1-wangkefeng.wang@huawei.com> From: Anshuman Khandual In-Reply-To: <20220830104654.28234-1-wangkefeng.wang@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/30/22 16:16, Kefeng Wang wrote: > Squash the __soft_offline_page() into soft_offline_in_use_page() and kill > __soft_offline_page(). > > Signed-off-by: Kefeng Wang > Reviewed-by: Miaohe Lin > Acked-by: Naoya Horiguchi Reviewed-by: Anshuman Khandual > --- > v2: update hpage when try_to_split_thp_page() success > > mm/memory-failure.c | 25 ++++++++++--------------- > 1 file changed, 10 insertions(+), 15 deletions(-) > > diff --git a/mm/memory-failure.c b/mm/memory-failure.c > index b61f2de9f2a1..df54a6bc9bef 100644 > --- a/mm/memory-failure.c > +++ b/mm/memory-failure.c > @@ -2434,11 +2434,11 @@ static bool isolate_page(struct page *page, struct list_head *pagelist) > } > > /* > - * __soft_offline_page handles hugetlb-pages and non-hugetlb pages. > + * soft_offline_in_use_page handles hugetlb-pages and non-hugetlb pages. > * If the page is a non-dirty unmapped page-cache page, it simply invalidates. > * If the page is mapped, it migrates the contents over. > */ > -static int __soft_offline_page(struct page *page) > +static int soft_offline_in_use_page(struct page *page) > { > long ret = 0; > unsigned long pfn = page_to_pfn(page); > @@ -2451,6 +2451,14 @@ static int __soft_offline_page(struct page *page) > .gfp_mask = GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL, > }; > > + if (!huge && PageTransHuge(hpage)) { > + if (try_to_split_thp_page(page)) { > + pr_info("soft offline: %#lx: thp split failed\n", pfn); > + return -EBUSY; > + } > + hpage = page; > + } > + > lock_page(page); > if (!PageHuge(page)) > wait_on_page_writeback(page); > @@ -2500,19 +2508,6 @@ static int __soft_offline_page(struct page *page) > return ret; > } > > -static int soft_offline_in_use_page(struct page *page) > -{ > - struct page *hpage = compound_head(page); > - > - if (!PageHuge(page) && PageTransHuge(hpage)) > - if (try_to_split_thp_page(page) < 0) { > - pr_info("soft offline: %#lx: thp split failed\n", > - page_to_pfn(page)); > - return -EBUSY; > - } > - return __soft_offline_page(page); > -} > - > static void put_ref_page(struct page *page) > { > if (page)