lkml.org 
[lkml]   [2020]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC][PATCH 4/9] mm/migrate: make migrate_pages() return nr_succeeded
Date
Dave Hansen <dave.hansen@linux.intel.com> writes:

> diff -puN mm/migrate.c~migrate_pages-add-success-return mm/migrate.c
> --- a/mm/migrate.c~migrate_pages-add-success-return 2020-08-18 11:36:51.284583183 -0700
> +++ b/mm/migrate.c 2020-08-18 11:36:51.295583183 -0700
> @@ -1432,6 +1432,7 @@ out:
> * @mode: The migration mode that specifies the constraints for
> * page migration, if any.
> * @reason: The reason for page migration.
> + * @nr_succeeded: The number of pages migrated successfully.
> *
> * The function returns after 10 attempts or if no pages are movable any more
> * because the list has become empty or no retryable pages exist any more.
> @@ -1442,11 +1443,10 @@ out:
> */
> int migrate_pages(struct list_head *from, new_page_t get_new_page,
> free_page_t put_new_page, unsigned long private,
> - enum migrate_mode mode, int reason)
> + enum migrate_mode mode, int reason, unsigned int *nr_succeeded)
> {
> int retry = 1;
> int nr_failed = 0;
> - int nr_succeeded = 0;
> int pass = 0;
> struct page *page;
> struct page *page2;
> @@ -1500,7 +1500,7 @@ retry:
> retry++;
> break;
> case MIGRATEPAGE_SUCCESS:
> - nr_succeeded++;
> + (*nr_succeeded)++;

I think now we should consider THP in counting now. Because later
nr_succeeded will be used to counting the number of reclaimed pages,
and THP is respected for that.

Best Regards,
Huang, Ying

> break;
> default:
> /*
> @@ -1517,11 +1517,11 @@ retry:
> nr_failed += retry;
> rc = nr_failed;
> out:
> - if (nr_succeeded)
> - count_vm_events(PGMIGRATE_SUCCESS, nr_succeeded);
> + if (*nr_succeeded)
> + count_vm_events(PGMIGRATE_SUCCESS, *nr_succeeded);
> if (nr_failed)
> count_vm_events(PGMIGRATE_FAIL, nr_failed);
> - trace_mm_migrate_pages(nr_succeeded, nr_failed, mode, reason);
> + trace_mm_migrate_pages(*nr_succeeded, nr_failed, mode, reason);
>
> if (!swapwrite)
> current->flags &= ~PF_SWAPWRITE;

\
 
 \ /
  Last update: 2020-09-17 03:33    [W:0.134 / U:39.964 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site