[Cluster-devel] [PATCH 2/2] gfs2: Fix lru_count going negative

Bob Peterson rpeterso at redhat.com
Thu Jan 31 15:04:18 UTC 2019


----- Original Message -----
> > +
> > +	if (!test_bit(GLF_LRU, &gl->gl_flags)) {
> > +		set_bit(GLF_LRU, &gl->gl_flags);
> >  		atomic_inc(&lru_count);
> > +	}
> 
> The above may be simplified to something like:
> +	if (!test_and_set_bit(GLF_LRU, &gl->gl_flags))
>  		atomic_inc(&lru_count);

Scratch that. Andreas says test_and_set_bit() and similar are much more
expensive cpu-wise, and we're already protected from races by the
lru_lock, so I guess the original is better after all.

Bob Peterson




More information about the Cluster-devel mailing list