[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z3uspuxyt46WhEUM@MiWiFi-R3L-srv>
Date: Mon, 6 Jan 2025 18:12:54 +0800
From: Baoquan He <bhe@...hat.com>
To: Kairui Song <kasong@...cent.com>
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
Chris Li <chrisl@...nel.org>, Barry Song <v-songbaohua@...o.com>,
Ryan Roberts <ryan.roberts@....com>,
Hugh Dickins <hughd@...gle.com>,
Yosry Ahmed <yosryahmed@...gle.com>,
"Huang, Ying" <ying.huang@...ux.alibaba.com>,
Nhat Pham <nphamcs@...il.com>, Johannes Weiner <hannes@...xchg.org>,
Kalesh Singh <kaleshsingh@...gle.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 09/13] mm, swap: reduce contention on device lock
On 12/31/24 at 01:46am, Kairui Song wrote:
......snip..
> +
> +/*
> + * Must be called after allocation, moves the cluster to full or frag list.
> + * Note: allocation doesn't acquire si lock, and may drop the ci lock for
> + * reclaim, so the cluster could be any where when called.
> + */
> +static void relocate_cluster(struct swap_info_struct *si,
> + struct swap_cluster_info *ci)
> +{
> + lockdep_assert_held(&ci->lock);
> +
> + /* Discard cluster must remain off-list or on discard list */
> + if (cluster_is_discard(ci))
> + return;
> +
> + if (!ci->count) {
> + free_cluster(si, ci);
relocate_cluster() is only called in alloc_swap_scan_cluster(), there
seems to be no chance to have 'ci->count == 0' case when allocating. Do
I miss anything here?
> + } else if (ci->count != SWAPFILE_CLUSTER) {
> + if (ci->flags != CLUSTER_FLAG_FRAG)
> + cluster_move(si, ci, &si->frag_clusters[ci->order],
> + CLUSTER_FLAG_FRAG);
> + } else {
> + if (ci->flags != CLUSTER_FLAG_FULL)
> + cluster_move(si, ci, &si->full_clusters,
> + CLUSTER_FLAG_FULL);
> + }
> +}
> +
> /*
> * The cluster corresponding to page_nr will be used. The cluster will not be
> * added to free cluster list and its usage counter will be increased by 1.
Powered by blists - more mailing lists