diff mbox series

[04/13] mm/memory-failure: save a page_folio() call

Message ID 20240524091310.1430048-5-linmiaohe@huawei.com (mailing list archive)
State New
Headers show
Series Some cleanups for memory-failure | expand

Commit Message

Miaohe Lin May 24, 2024, 9:13 a.m. UTC
Use local variable folio directly to save a page_folio() call.
No functional change intended.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/memory-failure.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Hildenbrand May 24, 2024, 3:06 p.m. UTC | #1
On 24.05.24 11:13, Miaohe Lin wrote:
> Use local variable folio directly to save a page_folio() call.
> No functional change intended.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>   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 b571aaf987a2..73878ecdec22 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -1658,7 +1658,7 @@ static bool hwpoison_user_mappings(struct folio *folio, struct page *p,
>   	unmap_success = !page_mapped(p);

We should be using folio_mapped() here.

>   	if (!unmap_success)
>   		pr_err("%#lx: failed to unmap page (folio mapcount=%d)\n",
> -		       pfn, folio_mapcount(page_folio(p)));
> +		       pfn, folio_mapcount(folio));

Reviewed-by: David Hildenbrand <david@redhat.com>
Miaohe Lin May 25, 2024, 1:34 a.m. UTC | #2
On 2024/5/24 23:06, David Hildenbrand wrote:
> On 24.05.24 11:13, Miaohe Lin wrote:
>> Use local variable folio directly to save a page_folio() call.
>> No functional change intended.
>>
>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
>> ---
>>   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 b571aaf987a2..73878ecdec22 100644
>> --- a/mm/memory-failure.c
>> +++ b/mm/memory-failure.c
>> @@ -1658,7 +1658,7 @@ static bool hwpoison_user_mappings(struct folio *folio, struct page *p,
>>       unmap_success = !page_mapped(p);
> 
> We should be using folio_mapped() here.

Will fix this.

> 
>>       if (!unmap_success)
>>           pr_err("%#lx: failed to unmap page (folio mapcount=%d)\n",
>> -               pfn, folio_mapcount(page_folio(p)));
>> +               pfn, folio_mapcount(folio));
> 
> Reviewed-by: David Hildenbrand <david@redhat.com>

Thanks for your comment.
.
diff mbox series

Patch

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index b571aaf987a2..73878ecdec22 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1658,7 +1658,7 @@  static bool hwpoison_user_mappings(struct folio *folio, struct page *p,
 	unmap_success = !page_mapped(p);
 	if (!unmap_success)
 		pr_err("%#lx: failed to unmap page (folio mapcount=%d)\n",
-		       pfn, folio_mapcount(page_folio(p)));
+		       pfn, folio_mapcount(folio));
 
 	/*
 	 * try_to_unmap() might put mlocked page in lru cache, so call