Skip to contentSkip to conversation

mm/memory-failure.c: replace with page_shift() in add_to_kill()

PATCH In review Yunfeng Ye 2 participants 3 messages Nov 5, 2019

Subsystems (2)
lore
Share & tools
lore

Yunfeng Ye

author
#0 lore raw

PATCH v2 1/1 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.

---
v1 -> v2:
- add Reviewed-by and Acked-by

 mm/memory-failure.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memory-failure.c +1 -1
index 3151c87dff73..e48c50cac889 100644
@@ -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
Signature · 1 line
2.7.4
#1 lore raw
Quoted 11 lines · Yunfeng Ye

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.

---
v1 -> v2:
- add Reviewed-by and Acked-by

Note for the future: No need to resend if there were no code/documentation changes. Andrew will apply the tags when picking up the patch.

Quoted 18 lines
  mm/memory-failure.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
mm/memory-failure.c +1 -1
index 3151c87dff73..e48c50cac889 100644
@@ -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
Signature · 3 lines
Thanks,

David / dhildenb
author
#2 lore raw
Quoted 6 lines · David Hildenbrand
Quoted 5 lines · Yunfeng Ye

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.

Quoted 9 lines
Quoted 6 lines

---
v1 -> v2:
  - add Reviewed-by and Acked-by

Note for the future: No need to resend if there were no code/documentation changes. Andrew will apply the tags when picking up the patch.

ok, thanks.

Quoted 20 lines
Quoted 18 lines

  mm/memory-failure.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
mm/memory-failure.c +0 -0
index 3151c87dff73..e48c50cac889 100644
@@ -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