2019-11-05 08:26:12

by Yunfeng Ye

[permalink] [raw]
Subject: [PATCH] mm/memory-failure.c: replace with page_shift() in add_to_kill()

The function page_shift() is supported after the commit 94ad9338109f
("mm: introduce page_shift()").

So replace with page_shift() in add_to_kill() for readability.

Signed-off-by: Yunfeng Ye <[email protected]>
---
mm/memory-failure.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 3151c87dff73..e48c50cac889 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -326,7 +326,7 @@ static void add_to_kill(struct task_struct *tsk, struct page *p,
if (is_zone_device_page(p))
tk->size_shift = dev_pagemap_mapping_shift(p, vma);
else
- tk->size_shift = compound_order(compound_head(p)) + PAGE_SHIFT;
+ tk->size_shift = page_shift(compound_head(p));

/*
* Send SIGKILL if "tk->addr == -EFAULT". Also, as
--
2.7.4


2019-11-05 08:59:18

by David Hildenbrand

[permalink] [raw]
Subject: Re: [PATCH] mm/memory-failure.c: replace with page_shift() in add_to_kill()

On 05.11.19 09:21, Yunfeng Ye wrote:
> The function page_shift() is supported after the commit 94ad9338109f
> ("mm: introduce page_shift()").
>
> So replace with page_shift() in add_to_kill() for readability.
>
> Signed-off-by: Yunfeng Ye <[email protected]>
> ---
> mm/memory-failure.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index 3151c87dff73..e48c50cac889 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -326,7 +326,7 @@ static void add_to_kill(struct task_struct *tsk, struct page *p,
> if (is_zone_device_page(p))
> tk->size_shift = dev_pagemap_mapping_shift(p, vma);
> else
> - tk->size_shift = compound_order(compound_head(p)) + PAGE_SHIFT;
> + tk->size_shift = page_shift(compound_head(p));
>
> /*
> * Send SIGKILL if "tk->addr == -EFAULT". Also, as
>

Reviewed-by: David Hildenbrand <[email protected]>

--

Thanks,

David / dhildenb

2019-11-05 09:13:37

by Naoya Horiguchi

[permalink] [raw]
Subject: Re: [PATCH] mm/memory-failure.c: replace with page_shift() in add_to_kill()

On Tue, Nov 05, 2019 at 04:21:44PM +0800, Yunfeng Ye wrote:
> The function page_shift() is supported after the commit 94ad9338109f
> ("mm: introduce page_shift()").
>
> So replace with page_shift() in add_to_kill() for readability.
>
> Signed-off-by: Yunfeng Ye <[email protected]>

Acked-by: Naoya Horiguchi <[email protected]>