File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -1867,16 +1867,24 @@ static unsigned int ratelimit_pages __read_mostly = 128 << (20 - PAGE_SHIFT);
1867
1867
static bool numamigrate_update_ratelimit (pg_data_t * pgdat ,
1868
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
1876
* Rate-limit the amount of data that is being migrated to a node.
1872
1877
* Optimal placement is no good if the memory bus is saturated and
1873
1878
* all the time is being spent migrating!
1874
1879
*/
1875
- if (time_after (jiffies , pgdat -> numabalancing_migrate_next_window )) {
1876
- spin_lock (& pgdat -> numabalancing_migrate_lock );
1880
+ if (time_after (jiffies , next_window ) &&
1881
+ spin_trylock (& pgdat -> numabalancing_migrate_lock )) {
1877
1882
pgdat -> numabalancing_migrate_nr_pages = 0 ;
1878
- pgdat -> numabalancing_migrate_next_window = jiffies +
1879
- msecs_to_jiffies (migrate_interval_millisecs );
1883
+ do {
1884
+ next_window += interval ;
1885
+ } while (unlikely (time_after (jiffies , next_window )));
1886
+
1887
+ WRITE_ONCE (pgdat -> numabalancing_migrate_next_window , next_window );
1880
1888
spin_unlock (& pgdat -> numabalancing_migrate_lock );
1881
1889
}
1882
1890
if (pgdat -> numabalancing_migrate_nr_pages > ratelimit_pages ) {
You can’t perform that action at this time.
0 commit comments