From: Andrew Morton <akpm@linux-foundation.org>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Matthew Wilcox <willy@infradead.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/5] mm: compaction: Remove redundant VM_BUG_ON() in compact_zone()
Date: Wed, 11 Jan 2023 13:51:44 -0800 [thread overview]
Message-ID: <20230111135144.5be220426ef4c0cae0a3429d@linux-foundation.org> (raw)
In-Reply-To: <3c7c722d-e8d0-f52b-e0ea-7994bd6b55bb@linux.alibaba.com>
On Wed, 11 Jan 2023 14:40:20 +0800 Baolin Wang <baolin.wang@linux.alibaba.com> wrote:
>
>
> On 1/11/2023 7:37 AM, Matthew Wilcox wrote:
> > On Tue, Jan 10, 2023 at 03:25:32PM -0800, Andrew Morton wrote:
> >> On Tue, 10 Jan 2023 13:37:57 +0000 Matthew Wilcox <willy@infradead.org> wrote:
> >>
> >>> On Tue, Jan 10, 2023 at 09:36:18PM +0800, Baolin Wang wrote:
> >>>> The compaction_suitable() will never return values other than COMPACT_SUCCESS,
> >>>> COMPACT_SKIPPED and COMPACT_CONTINUE, so after validation of COMPACT_SUCCESS
> >>>> and COMPACT_SKIPPED, we will never hit other unexpected case. Thus remove
> >>>> the redundant VM_BUG_ON() validation for the return values of compaction_suitable().
> >>>
> >>> I don't understand why we'd remove this check.
> >>
> >> Well, just from code inspection it serves no purpose.
> >>
> >> Such an assertion might be useful during early code development, but I
> >> think we can consider compaction_suitable() to adequately debugged by
> >> now?
> >
> > What if compaction_suitable() is modified to return another value?
>
> Then this will be an expected value which should be handled by caller,
> and IMO we can not make such assumption for future to keep this
> unhelpful check.
One way of looking at this: if the assertion wasn't there and someone
sent a patch which added it, would we merge the patch?
"[patch] add check for compaction_suitable() return value"
"why"
"it might be wrong"
"it isn't"
"but we might make it wrong later"
"the same can be said of every function in the kernel"
And if we wouldn't merge a hypothetical patch which adds some code, we
shouldn't retain that code, no?
next prev parent reply other threads:[~2023-01-11 21:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-10 13:36 [PATCH 0/5] Some small improvements for compaction Baolin Wang
2023-01-10 13:36 ` [PATCH 1/5] mm: compaction: Remove redundant VM_BUG_ON() in compact_zone() Baolin Wang
2023-01-10 13:37 ` Matthew Wilcox
2023-01-10 23:25 ` Andrew Morton
2023-01-10 23:37 ` Matthew Wilcox
2023-01-11 6:40 ` Baolin Wang
2023-01-11 21:51 ` Andrew Morton [this message]
2023-01-10 13:36 ` [PATCH 2/5] mm: compaction: Move list validation into compact_zone() Baolin Wang
2023-01-10 13:36 ` [PATCH 3/5] mm: compaction: Count the migration scanned pages events for proactive compaction Baolin Wang
2023-01-10 13:36 ` [PATCH 4/5] mm: compaction: Add missing kcompactd wakeup trace event Baolin Wang
2023-01-10 13:36 ` [PATCH 5/5] mm: compaction: Avoid fragmentation score calculation for empty zones Baolin Wang
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=20230111135144.5be220426ef4c0cae0a3429d@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.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