Linux-mm Archive on
 help / color / Atom feed
Subject: [patch 139/158] autonuma: fix watermark checking in migrate_balanced_pgdat()
Date: Sat, 30 Nov 2019 17:57:28 -0800
Message-ID: <> (raw)

From: Huang Ying <>
Subject: autonuma: fix watermark checking in migrate_balanced_pgdat()

When zone_watermark_ok() is called in migrate_balanced_pgdat() to check
migration target node, the parameter classzone_idx (for requested zone) is
specified as 0 (ZONE_DMA).  But when allocating memory for autonuma in
alloc_misplaced_dst_page(), the requested zone from GFP flags is
ZONE_MOVABLE.  That is, the requested zone is different.  The size of
lowmem_reserve for the different requested zone is different.  And this
may cause some issues.

For example, in the zoneinfo of a test machine as below,

Node 0, zone    DMA32
  pages free     61592
        min      29
        low      454
        high     879
        spanned  1044480
        present  442306
        managed  425921
        protection: (0, 0, 62457, 62457, 62457)

The free page number of ZONE_DMA32 is greater than "high watermark +
lowmem_reserve[ZONE_DMA]", but less than "high watermark +
lowmem_reserve[ZONE_MOVABLE]".  And because __alloc_pages_node() in
alloc_misplaced_dst_page() requests ZONE_MOVABLE, the zone_watermark_ok()
on ZONE_DMA32 in migrate_balanced_pgdat() may always return true.  So,
autonuma may not stop even when memory pressure in node 0 is heavy.

To fix the issue, ZONE_MOVABLE is used as parameter to call
zone_watermark_ok() in migrate_balanced_pgdat().  This makes it same as
requested zone in alloc_misplaced_dst_page().  So that
migrate_balanced_pgdat() returns false when memory pressure is heavy.

Signed-off-by: "Huang, Ying" <>
Acked-by: Mel Gorman <>
Cc: Michal Hocko <>
Cc: Rik van Riel <>
Cc: Peter Zijlstra <>
Cc: Ingo Molnar <>
Cc: Dave Hansen <>
Cc: Dan Williams <>
Cc: Fengguang Wu <>
Signed-off-by: Andrew Morton <>

 mm/migrate.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/migrate.c~autonuma-fix-watermark-checking-in-migrate_balanced_pgdat
+++ a/mm/migrate.c
@@ -1859,7 +1859,7 @@ static bool migrate_balanced_pgdat(struc
 		if (!zone_watermark_ok(zone, 0,
 				       high_wmark_pages(zone) +
-				       0, 0))
+				       ZONE_MOVABLE, 0))
 		return true;

                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publically 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:

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

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-mm Archive on

Archives are clonable:
	git clone --mirror linux-mm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mm linux-mm/ \
	public-inbox-index linux-mm

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone