Re: [PATCH 2/6] mm/migrate: Use trylock while resetting rate limit
From: Peter Zijlstra
Date: Thu Sep 06 2018 - 07:48:27 EST
On Fri, Aug 03, 2018 at 11:43:57AM +0530, Srikar Dronamraju wrote:
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 8c0af0f..dbc2cb7 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1868,16 +1868,24 @@ static struct page *alloc_misplaced_dst_page(struct page *page,
> static bool numamigrate_update_ratelimit(pg_data_t *pgdat,
> unsigned long nr_pages)
> {
> + unsigned long next_window, interval;
> +
> + next_window = READ_ONCE(pgdat->numabalancing_migrate_next_window);
> + interval = msecs_to_jiffies(migrate_interval_millisecs);
> +
> /*
> * Rate-limit the amount of data that is being migrated to a node.
> * Optimal placement is no good if the memory bus is saturated and
> * all the time is being spent migrating!
> */
> - if (time_after(jiffies, next_window)) {
> - spin_lock(&pgdat->numabalancing_migrate_lock);
> + if (time_after(jiffies, next_window) &&
> + spin_trylock(&pgdat->numabalancing_migrate_lock)) {
This patch doesn't apply cleanly; also you introduce @next_window with
this patch, so how can it remove a user of it.
I fixed this up, still weird.