Re: [PATCH 1/6] swap: Add comments to lock_cluster_or_swap_info()
From: Dave Hansen
Date: Fri Jul 13 2018 - 06:48:32 EST
> +/*
> + * At most times, fine grained cluster lock is sufficient to protect
Can we call out those times, please?
> + * the operations on sis->swap_map.
Please be careful with the naming. You can call it 'si' because that's
what the function argument is named. Or, swap_info_struct because
that's the struct name. Calling it 'sis' is a bit sloppy, no?
> No need to acquire gross grained
"coarse" is a conventional antonym for "fine".
> + * sis->lock. But cluster and cluster lock isn't available for HDD,
> + * so sis->lock will be instead for them.
> + */
> static inline struct swap_cluster_info *lock_cluster_or_swap_info(
> struct swap_info_struct *si,
> unsigned long offset)
What I already knew was: there are two locks. We use one sometimes and
the other at other times.
What I don't know is why there are two locks, and the heuristics why we
choose between them. This comment doesn't help explain the things I
don't know.