linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, mm-commits@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [GIT PULL] hotfixes for 6.2
Date: Mon, 13 Feb 2023 14:19:19 -0800	[thread overview]
Message-ID: <CAHk-=wiBrY+O-4=2mrbVyxR+hOqfdJ=Do6xoucfJ9_5az01L4Q@mail.gmail.com> (raw)
In-Reply-To: <20230213140812.db63c7146ebc396691594b73@linux-foundation.org>

On Mon, Feb 13, 2023 at 2:08 PM Andrew Morton <akpm@linux-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


  reply	other threads:[~2023-02-13 22:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13 22:08 Andrew Morton
2023-02-13 22:19 ` Linus Torvalds [this message]
2023-02-14  1:26   ` Baolin Wang
2023-02-13 22:20 ` pr-tracker-bot
2023-02-17 23:18 Andrew Morton
2023-02-18  3:04 ` pr-tracker-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHk-=wiBrY+O-4=2mrbVyxR+hOqfdJ=Do6xoucfJ9_5az01L4Q@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mm-commits@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox