[PATCH v3 hmm 06/12] mm/hmm: Hold on to the mmget for the lifetime of the range

Christoph Hellwig hch at infradead.org
Sat Jun 15 14:14:35 UTC 2019


>  	mutex_lock(&hmm->lock);
> -	list_for_each_entry(range, &hmm->ranges, list)
> -		range->valid = false;
> -	wake_up_all(&hmm->wq);
> +	/*
> +	 * Since hmm_range_register() holds the mmget() lock hmm_release() is
> +	 * prevented as long as a range exists.
> +	 */
> +	WARN_ON(!list_empty(&hmm->ranges));
>  	mutex_unlock(&hmm->lock);

This can just use list_empty_careful and avoid the lock entirely.

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch at lst.de>


More information about the amd-gfx mailing list