Re: [PATCH 06/28] mm, swap: rearrange swap cluster definition and helpers

From: Barry Song
Date: Mon May 19 2025 - 02:26:26 EST


> From: Kairui Song <kasong@xxxxxxxxxxx>

> @@ -889,10 +849,8 @@ static unsigned long cluster_alloc_swap_entry(struct swap_info_struct *si, int o
> /* Serialize HDD SWAP allocation for each device. */
> spin_lock(&si->global_cluster_lock);
> offset = si->global_cluster->next[order];
> - if (offset == SWAP_ENTRY_INVALID)
> - goto new_cluster;

We are implicitly dropping this. Does it mean the current code is wrong?
Do we need some clarification about this?

>
> - ci = lock_cluster(si, offset);
> + ci = swap_lock_cluster(si, offset);
> /* Cluster could have been used by another order */
> if (cluster_is_usable(ci, order)) {
> if (cluster_is_empty(ci))

Thanks
Barry