[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wiBrY+O-4=2mrbVyxR+hOqfdJ=Do6xoucfJ9_5az01L4Q@mail.gmail.com>
Date: Mon, 13 Feb 2023 14:19:19 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mm@...ck.org, mm-commits@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [GIT PULL] hotfixes for 6.2
On Mon, Feb 13, 2023 at 2:08 PM Andrew Morton <akpm@...ux-foundation.org> wrote:
>
> Kuan-Ying Lee (1):
> mm/gup: add folio to list when folio_isolate_lru() succeed
Ugh. I really hate fixes like this.
The problem came from mis-understanding the return value of
folio_isolate_lru(), and thinking that it was a boolean
success/failure thing.
It wasn't, it was an integer "success/errno" thing, and the sense of
the test was wrong. So the patch is
- if (!folio_isolate_lru(folio))
+ if (folio_isolate_lru(folio))
continue;
but at no point was the code *clarified*.
Wouldn't it have been much better to write the new code to be
if (folio_isolate_lru(folio) < 0)
continue;
to actually make it clear that this is a "negative error return check".
I've pulled this, but I really think that when somebody notices that
we had a silly bug because of a misunderstanding like this, it's not
just that the bug should be fixed, the code should also be *clarified*
at the same time.
Linus
Powered by blists - more mailing lists