[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF8kJuNUneUEUwQy9h+nVtQnivFdhQPWghsG62ia3rbMCz18XQ@mail.gmail.com>
Date: Tue, 28 May 2024 17:50:50 -0700
From: Chris Li <chrisl@...nel.org>
To: Kairui Song <ryncsn@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, Ryan Roberts <ryan.roberts@....com>,
"Huang, Ying" <ying.huang@...el.com>, linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Barry Song <baohua@...nel.org>
Subject: Re: [PATCH 1/2] mm: swap: swap cluster switch to double link list
On Tue, May 28, 2024 at 3:27 PM Chris Li <chriscli@...gle.com> wrote:
> > > @@ -670,7 +562,8 @@ static bool scan_swap_map_try_ssd_cluster(struct swap_info_struct *si,
> > > goto new_cluster;
> > > } else
> > > return false;
> > > - }
> > > + } else
> > > + ci = si->cluster_info + tmp;
> >
> > This "else ci = ..." seems wrong, tmp is not an array index, and not
> > needed either.
>
> Yes, there is a bug there, pointed out by OPPO as well. It should be
> ci = si->cluster_info + (tmp/ SWAPFILE_CLUSTER);
>
> "tmp" is needed because "tmp" or " cluster->next[order]" keep track of
> the current cluster allocation offset,
> in the per cpu cluster struct.
Hi Kairui,
Actually, you are right, the "ci" is not used here. That is why that
ci out of bound error does not trigger kernel OOPS.
We can delete that else line completely.
Chris
Powered by blists - more mailing lists