Simplify the code by using flush_dcache_folio().
Signed-off-by: Muchun Song <[email protected]>
---
mm/migrate.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/mm/migrate.c b/mm/migrate.c
index c418e8d92b9c..daf2b3508670 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -933,12 +933,8 @@ static int move_to_new_page(struct page *newpage, struct page *page,
if (!PageMappingFlags(page))
page->mapping = NULL;
- if (likely(!is_zone_device_page(newpage))) {
- int i, nr = compound_nr(newpage);
-
- for (i = 0; i < nr; i++)
- flush_dcache_page(newpage + i);
- }
+ if (likely(!is_zone_device_page(newpage)))
+ flush_dcache_folio(page_folio(newpage));
}
out:
return rc;
--
2.11.0
On 2/7/22 23:36, Muchun Song wrote:
> Simplify the code by using flush_dcache_folio().
>
> Signed-off-by: Muchun Song <[email protected]>
> ---
> mm/migrate.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
Thanks,
Reviewed-by: Mike Kravetz <[email protected]>
--
Mike Kravetz
>
> diff --git a/mm/migrate.c b/mm/migrate.c
> index c418e8d92b9c..daf2b3508670 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -933,12 +933,8 @@ static int move_to_new_page(struct page *newpage, struct page *page,
> if (!PageMappingFlags(page))
> page->mapping = NULL;
>
> - if (likely(!is_zone_device_page(newpage))) {
> - int i, nr = compound_nr(newpage);
> -
> - for (i = 0; i < nr; i++)
> - flush_dcache_page(newpage + i);
> - }
> + if (likely(!is_zone_device_page(newpage)))
> + flush_dcache_folio(page_folio(newpage));
> }
> out:
> return rc;