From: Peng Zhang <zhangpeng.00@bytedance.com>
To: rppt@kernel.org, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Peng Zhang <zhangpeng.00@bytedance.com>
Subject: [PATCH v2 1/2] memblock: Make a boundary tighter in memblock_add_range().
Date: Sun, 29 Jan 2023 17:00:33 +0800 [thread overview]
Message-ID: <20230129090034.12310-2-zhangpeng.00@bytedance.com> (raw)
In-Reply-To: <20230129090034.12310-1-zhangpeng.00@bytedance.com>
When type->cnt * 2 + 1 is less than or equal to type->max, there is
enough empty regions to insert.
Signed-off-by: Peng Zhang <zhangpeng.00@bytedance.com>
---
mm/memblock.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/memblock.c b/mm/memblock.c
index 685e30e6d27c..836eb71ea3ea 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -601,11 +601,11 @@ static int __init_memblock memblock_add_range(struct memblock_type *type,
/*
* The worst case is when new range overlaps all existing regions,
* then we'll need type->cnt + 1 empty regions in @type. So if
- * type->cnt * 2 + 1 is less than type->max, we know
+ * type->cnt * 2 + 1 is less than or equal to type->max, we know
* that there is enough empty regions in @type, and we can insert
* regions directly.
*/
- if (type->cnt * 2 + 1 < type->max)
+ if (type->cnt * 2 + 1 <= type->max)
insert = true;
repeat:
--
2.20.1
next prev parent reply other threads:[~2023-01-29 9:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-29 9:00 [PATCH v2 0/2] Some small improvements for memblock Peng Zhang
2023-01-29 9:00 ` Peng Zhang [this message]
2023-01-29 9:00 ` [PATCH v2 2/2] memblock: Avoid useless checks in memblock_merge_regions() Peng Zhang
2023-01-29 9:14 ` Peng Zhang
2023-01-31 14:12 ` [PATCH v2 0/2] Some small improvements for memblock Mike Rapoport
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=20230129090034.12310-2-zhangpeng.00@bytedance.com \
--to=zhangpeng.00@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rppt@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;
as well as URLs for NNTP newsgroup(s).