Re: [PATCH 13/19] mm/migrate: Use xchg instead of spinlock

Rik van Riel
2018-06-04T18:22:42Z

[-- Attachment #1: Type: text/plain, Size: 872 bytes --]

On Mon, 2018-06-04 at 15:30 +0530, Srikar Dronamraju wrote:
>
> +++ b/mm/migrate.c
> @@ -1874,11 +1874,9 @@ static bool
> numamigrate_update_ratelimit(pg_data_t *pgdat,
> * all the time is being spent migrating!
> */
> if (time_after(jiffies, pgdat-
> >numabalancing_migrate_next_window)) {
> - spin_lock(&pgdat->numabalancing_migrate_lock);
> - pgdat->numabalancing_migrate_nr_pages = 0;
> - pgdat->numabalancing_migrate_next_window = jiffies +
> - msecs_to_jiffies(migrate_interval_millisecs)
> ;
> - spin_unlock(&pgdat->numabalancing_migrate_lock);
> + if (xchg(&pgdat->numabalancing_migrate_nr_pages, 0))
> + pgdat->numabalancing_migrate_next_window =
> jiffies +
> + msecs_to_jiffies(migrate_interval_mi
> llisecs);
> }

I am not convinced this is simpler, but no real
objection either way :)

--
All Rights Reversed.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]