linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mm: memory-failure: kill __soft_offline_page()
@ 2022-08-30 10:46 Kefeng Wang
  2022-08-30 13:31 ` David Hildenbrand
  2022-09-01  6:50 ` Anshuman Khandual
  0 siblings, 2 replies; 3+ messages in thread
From: Kefeng Wang @ 2022-08-30 10:46 UTC (permalink / raw)
  To: Andrew Morton, linux-mm
  Cc: linux-kernel, Kefeng Wang, Miaohe Lin, Naoya Horiguchi

Squash the __soft_offline_page() into soft_offline_in_use_page() and kill
__soft_offline_page().

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
---
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)
-- 
2.35.3



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mm: memory-failure: kill __soft_offline_page()
  2022-08-30 10:46 [PATCH v2] mm: memory-failure: kill __soft_offline_page() Kefeng Wang
@ 2022-08-30 13:31 ` David Hildenbrand
  2022-09-01  6:50 ` Anshuman Khandual
  1 sibling, 0 replies; 3+ messages in thread
From: David Hildenbrand @ 2022-08-30 13:31 UTC (permalink / raw)
  To: 20220830071514.GA1106752, Andrew Morton, linux-mm
  Cc: linux-kernel, Kefeng Wang, Miaohe Lin, Naoya Horiguchi

On 30.08.22 12:46, Kefeng Wang wrote:
> Squash the __soft_offline_page() into soft_offline_in_use_page() and kill
> __soft_offline_page().
> 
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
> Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
> ---
> v2: update hpage when try_to_split_thp_page() success
> 

Reviewed-by: David Hildenbrand <david@redhat.com>


-- 
Thanks,

David / dhildenb



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mm: memory-failure: kill __soft_offline_page()
  2022-08-30 10:46 [PATCH v2] mm: memory-failure: kill __soft_offline_page() Kefeng Wang
  2022-08-30 13:31 ` David Hildenbrand
@ 2022-09-01  6:50 ` Anshuman Khandual
  1 sibling, 0 replies; 3+ messages in thread
From: Anshuman Khandual @ 2022-09-01  6:50 UTC (permalink / raw)
  To: 20220830071514.GA1106752, Andrew Morton, linux-mm
  Cc: linux-kernel, Kefeng Wang, Miaohe Lin, Naoya Horiguchi

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 <wangkefeng.wang@huawei.com>
> Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
> Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>

> ---
> 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)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-01  6:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-30 10:46 [PATCH v2] mm: memory-failure: kill __soft_offline_page() Kefeng Wang
2022-08-30 13:31 ` David Hildenbrand
2022-09-01  6:50 ` Anshuman Khandual

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox