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

From: Rik van Riel
Date: Mon Jun 04 2018 - 14:22:47 EST


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: signature.asc
Description: This is a digitally signed message part