diff mbox series

[v2] mm: memory-failure: remove unneeded page state check in shake_page()

Message ID 20230628014604.3432146-1-linmiaohe@huawei.com (mailing list archive)
State New
Headers show
Series [v2] mm: memory-failure: remove unneeded page state check in shake_page() | expand

Commit Message

Miaohe Lin June 28, 2023, 1:46 a.m. UTC
Remove unneeded PageLRU(p) and is_free_buddy_page(p) check as slab caches
are not shrunk now. This check can be added back when a lightweight range
based shrinker is available.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
v2:
  put TODO comment together with "if (PageSlab)" block per Naoya
  collect Acked-by tag per Naoya
---
 mm/memory-failure.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Comments

Miaohe Lin June 28, 2023, 1:51 a.m. UTC | #1
On 2023/6/28 9:46, Miaohe Lin wrote:
> Remove unneeded PageLRU(p) and is_free_buddy_page(p) check as slab caches
> are not shrunk now. This check can be added back when a lightweight range
> based shrinker is available.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Sorry for make noise. Acked-by tag is missing. Will re-post one.

> ---
> v2:
>   put TODO comment together with "if (PageSlab)" block per Naoya
>   collect Acked-by tag per Naoya
> ---
>  mm/memory-failure.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index 5b663eca1f29..66e7b3ceaf2d 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -372,17 +372,14 @@ void shake_page(struct page *p)
>  {
>  	if (PageHuge(p))
>  		return;
> -
> -	if (!PageSlab(p)) {
> -		lru_add_drain_all();
> -		if (PageLRU(p) || is_free_buddy_page(p))
> -			return;
> -	}
> -
>  	/*
>  	 * TODO: Could shrink slab caches here if a lightweight range-based
>  	 * shrinker will be available.
>  	 */
> +	if (PageSlab(p))
> +		return;
> +
> +	lru_add_drain_all();
>  }
>  EXPORT_SYMBOL_GPL(shake_page);
>  
>
diff mbox series

Patch

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 5b663eca1f29..66e7b3ceaf2d 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -372,17 +372,14 @@  void shake_page(struct page *p)
 {
 	if (PageHuge(p))
 		return;
-
-	if (!PageSlab(p)) {
-		lru_add_drain_all();
-		if (PageLRU(p) || is_free_buddy_page(p))
-			return;
-	}
-
 	/*
 	 * TODO: Could shrink slab caches here if a lightweight range-based
 	 * shrinker will be available.
 	 */
+	if (PageSlab(p))
+		return;
+
+	lru_add_drain_all();
 }
 EXPORT_SYMBOL_GPL(shake_page);