mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chen Wandun <chenwandun@huawei.com>
To: <akpm@linux-foundation.org>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>, <ying.huang@intel.com>
Cc: <chenwandun@huawei.com>
Subject: [PATCH] mm/migrate: Continue to migrate for small pages
Date: Sun, 29 Jan 2023 10:54:04 +0800	[thread overview]
Message-ID: <20230129025404.1262745-1-chenwandun@huawei.com> (raw)

migrate_hugetlbs returns -ENOMEM when no enough huge page,
however maybe there are still free small pages, so continue
to migrate for small pages.

Signed-off-by: Chen Wandun <chenwandun@huawei.com>
---
 mm/migrate.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index b971edbf32fc..c9d0d2058036 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1939,7 +1939,12 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
 
 	rc_gather = migrate_hugetlbs(from, get_new_page, put_new_page, private,
 				     mode, reason, &stats, &ret_folios);
-	if (rc_gather < 0)
+	/* Maybe there are free small pages, continue to migrate.
+	 * Nowdays the only negtive return value of migrate_hugetlbs
+	 * is -ENOMEM, keep compatible for coming negtive return
+	 * value instead of ignore return value.
+	 */
+	if (rc_gather < 0 && rc_gather != -ENOMEM)
 		goto out;
 again:
 	nr_pages = 0;
-- 
2.25.1


             reply	other threads:[~2023-01-29  2:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-29  2:54 Chen Wandun [this message]
2023-01-29  3:01 ` Huang, Ying
2023-01-29  3:26   ` Chen Wandun

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=20230129025404.1262745-1-chenwandun@huawei.com \
    --to=chenwandun@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ying.huang@intel.com \
    /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

all inboxes | Powered by JetHome®