linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Haifeng Xu <haifeng.xu@shopee.com>
To: rppt@kernel.org
Cc: mhocko@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Haifeng Xu <haifeng.xu@shopee.com>
Subject: [PATCH] mm/mm_init.c: add debug messsge for dma zone
Date: Wed,  7 Jun 2023 09:07:34 +0000	[thread overview]
Message-ID: <20230607090734.1259-1-haifeng.xu@shopee.com> (raw)

If freesize is less than dma_reserve, print warning message to report
this case.

Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
---
 mm/mm_init.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/mm/mm_init.c b/mm/mm_init.c
index 232efac9a929..9a9d6a52471c 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -1561,9 +1561,14 @@ static void __init free_area_init_core(struct pglist_data *pgdat)
 		}
 
 		/* Account for reserved pages */
-		if (j == 0 && freesize > dma_reserve) {
-			freesize -= dma_reserve;
-			pr_debug("  %s zone: %lu pages reserved\n", zone_names[0], dma_reserve);
+		if (j == 0) {
+			if (freesize >= dma_reserve) {
+				freesize -= dma_reserve;
+				pr_debug("  %s zone: %lu pages reserved\n",
+					 zone_names[0], dma_reserve);
+			} else
+				pr_warn("  %s zone: %lu reserved pages exceeds freesize %lu\n",
+					zone_names[0], dma_reserve, freesize);
 		}
 
 		if (!is_highmem_idx(j))
-- 
2.25.1



             reply	other threads:[~2023-06-07  9:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07  9:07 Haifeng Xu [this message]
2023-06-07 10:16 ` [PATCH] mm/mm_init.c: add debug messsge for dma zone Michal Hocko
2023-06-07 10:22   ` David Hildenbrand
2023-06-08  3:43     ` Haifeng Xu
2023-06-08  7:38     ` Haifeng Xu
2023-06-08  9:18       ` Michal Hocko
2023-06-08 10:13         ` Mike Rapoport
2023-06-08 10:51           ` Haifeng Xu

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=20230607090734.1259-1-haifeng.xu@shopee.com \
    --to=haifeng.xu@shopee.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.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).