diff options
Diffstat (limited to 'mm')
| -rw-r--r-- | mm/migrate.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/mm/migrate.c b/mm/migrate.c index d6a2e89b086a..4f1d894835b5 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
| @@ -1867,16 +1867,24 @@ static unsigned int ratelimit_pages __read_mostly = 128 << (20 - PAGE_SHIFT); | |||
| 1867 | static bool numamigrate_update_ratelimit(pg_data_t *pgdat, | 1867 | static bool numamigrate_update_ratelimit(pg_data_t *pgdat, |
| 1868 | unsigned long nr_pages) | 1868 | unsigned long nr_pages) |
| 1869 | { | 1869 | { |
| 1870 | unsigned long next_window, interval; | ||
| 1871 | |||
| 1872 | next_window = READ_ONCE(pgdat->numabalancing_migrate_next_window); | ||
| 1873 | interval = msecs_to_jiffies(migrate_interval_millisecs); | ||
| 1874 | |||
| 1870 | /* | 1875 | /* |
| 1871 | * Rate-limit the amount of data that is being migrated to a node. | 1876 | * Rate-limit the amount of data that is being migrated to a node. |
| 1872 | * Optimal placement is no good if the memory bus is saturated and | 1877 | * Optimal placement is no good if the memory bus is saturated and |
| 1873 | * all the time is being spent migrating! | 1878 | * all the time is being spent migrating! |
| 1874 | */ | 1879 | */ |
| 1875 | if (time_after(jiffies, pgdat->numabalancing_migrate_next_window)) { | 1880 | if (time_after(jiffies, next_window) && |
| 1876 | spin_lock(&pgdat->numabalancing_migrate_lock); | 1881 | spin_trylock(&pgdat->numabalancing_migrate_lock)) { |
| 1877 | pgdat->numabalancing_migrate_nr_pages = 0; | 1882 | pgdat->numabalancing_migrate_nr_pages = 0; |
| 1878 | pgdat->numabalancing_migrate_next_window = jiffies + | 1883 | do { |
| 1879 | msecs_to_jiffies(migrate_interval_millisecs); | 1884 | next_window += interval; |
| 1885 | } while (unlikely(time_after(jiffies, next_window))); | ||
| 1886 | |||
| 1887 | WRITE_ONCE(pgdat->numabalancing_migrate_next_window, next_window); | ||
| 1880 | spin_unlock(&pgdat->numabalancing_migrate_lock); | 1888 | spin_unlock(&pgdat->numabalancing_migrate_lock); |
| 1881 | } | 1889 | } |
| 1882 | if (pgdat->numabalancing_migrate_nr_pages > ratelimit_pages) { | 1890 | if (pgdat->numabalancing_migrate_nr_pages > ratelimit_pages) { |
