Re: [PATCH] mm, zswap: don't touch the XArray lock if there is no entry to free

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Oct 19, 2024 at 03:25:25AM +0800, Kairui Song wrote:
>  	if (xa_empty(tree))
>  		return;
>  
> -	entry = xa_erase(tree, offset);
> -	if (entry)
> +	rcu_read_lock();
> +	entry = xas_load(&xas);
> +	if (entry) {

You should call xas_reset() here.  And I'm not sure it's a great idea to
spin waiting for the xa lock while holding the RCU read lock?  Probably
not awful but I could easily be wrong.

> +		xas_lock(&xas);
> +		WARN_ON_ONCE(xas_reload(&xas) != entry);
> +		xas_store(&xas, NULL);
> +		xas_unlock(&xas);
>  		zswap_entry_free(entry);
> +	}
> +	rcu_read_unlock();
>  }
>  
>  int zswap_swapon(int type, unsigned long nr_pages)
> -- 
> 2.47.0
> 
> 




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux