Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp384142rwe; Thu, 1 Sep 2022 00:42:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR64v/q1DvF6bUii161DuAk+t9t22DByxC77JXB0syQSMMhZ6m/w/oA1YWPBtQ00wxPPUxQ7 X-Received: by 2002:a63:784f:0:b0:42b:4c9d:79ee with SMTP id t76-20020a63784f000000b0042b4c9d79eemr24655948pgc.65.1662018168291; Thu, 01 Sep 2022 00:42:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662018168; cv=none; d=google.com; s=arc-20160816; b=Nw5cexHj4rVY6qKwEYwKJ1yz42bYymt7DNhGlOvOFV5//GYit1B0lEoJrdGl2SAk6L lCqIlc6hOwXZMu/5y0DLMn2MHHdpalab0yX3qo5UcdPsorn4g2nsAmjLgFywhsUep/Tx O+oc16IO2PwLhEr8BZE2eezfxt6ovarxkuZ+zxJulwz9sbDDb6T/UDqC9c7bxbl7g/lE vQJcfQbjCitP+zd2TuknWTwoPt4RG9YO6vu+d+CXCLx68iVn4r/+1JwOzegTXEl3wFoH meUg/Uh6ACvYltlJpYGoCkLCGrKdViLMyMgoaE5apjUe4Pn4HNhzI2tRob1HyOuaP3oQ hBHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=VnXkKsv8r0//o2eVo40V0R+GSje7S0ClHBi7KRq6Iyc=; b=T5Z1HtDlCCXFzuzE0l60SK+fmgJN0Wm+t74+8RYlF6VZPuXuQdjJEDHwiGovtRWsp9 n+aAmHBMbCxZXI4/KgUpHj6ltDPPkBGDEVY1+2C5t+Lsyu9iNimfjAgOveKhOsRITz8+ XwSIL40uDMsJG61ONjsARlnvD1dpHbI9r0Jp9QZISRK0+0c8JQHyuNc9oRD5c0mKBpln TvCZrQX3BaNr5n9jnHMqTy77Wikg4DdZeWMYncqrSXOWu+VB/J28B1ApHFxPzn4hScZ9 AScmL60BJQbhBO8HimCqsfYOo7gVGRjukp5AodgABl/EivkIUgaQmsfoO+a7ulO+WAOF T2Fw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z198-20020a6333cf000000b00420f9b67f13si8397282pgz.231.2022.09.01.00.42.31; Thu, 01 Sep 2022 00:42:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232629AbiIAGuj (ORCPT + 99 others); Thu, 1 Sep 2022 02:50:39 -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 X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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)