linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rik van Riel <riel@surriel.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Mike Kravetz <mike.kravetz@oracle.com>,
	linux-kernel@vger.kernel.org, kernel-team@fb.com,
	akpm@linux-foundation.org, linux-mm@kvack.org, mhocko@kernel.org,
	mgorman@techsingularity.net, rientjes@google.com,
	aarcange@redhat.com, ziy@nvidia.com
Subject: [PATCH] fix mmthpcompactioncma-allow-thp-migration-for-cma-allocations.patch
Date: Fri, 28 Feb 2020 10:47:00 -0500	[thread overview]
Message-ID: <20200228104700.0af2f18d@imladris.surriel.com> (raw)
In-Reply-To: <ceacd12e-a005-8035-7d88-f79a45a05975@suse.cz>

Thank you Mike & Vlastimil!

---8<---

commit 27f3cd5473d8bbf591b61d8b93b98bc333980d0d
Author: Rik van Riel <riel@surriel.com>
Date:   Fri Feb 28 10:41:48 2020 -0500

Subject: fix mmthpcompactioncma-allow-thp-migration-for-cma-allocations.patch
    
Mike Kravetz pointed out that the second if condition could do the
wrong thing for hugetlbfs pages, and that check really only needs
to run on THPs.
    
Cleanup suggested by Vlastimil.
  
Thank you both!
    
Suggested-by: Mike Kravetz <mike.kravetz@oracle.com>
Suggested-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Rik van Riel <riel@surriel.com>

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 4afa13dd3738..71f78a590236 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -8274,12 +8274,12 @@ struct page *has_unmovable_pages(struct zone *zone, struct page *page,
 			struct page *head = compound_head(page);
 			unsigned int skip_pages;
 
-			if (PageHuge(page) &&
-			    !hugepage_migration_supported(page_hstate(head)))
-				return page;
-
-			if (!PageLRU(head) && !__PageMovable(head))
+			if (PageHuge(page)) {
+				if (!hugepage_migration_supported(page_hstate(head)))
+					return page;
+			} else if (!PageLRU(head) && !__PageMovable(head)) {
 				return page;
+			}
 
 			skip_pages = compound_nr(head) - (page - head);
 			iter += skip_pages - 1;


  reply	other threads:[~2020-02-28 15:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27 21:32 [PATCH v2 0/2] fix THP migration for CMA allocations Rik van Riel
2020-02-27 21:32 ` [PATCH 1/2] mm,compaction,cma: add alloc_contig flag to compact_control Rik van Riel
2020-02-27 21:32 ` [PATCH v2 2/2] mm,thp,compaction,cma: allow THP migration for CMA allocations Rik van Riel
2020-02-27 23:41   ` Mike Kravetz
2020-02-28  1:21     ` Rik van Riel
2020-02-28  4:30       ` Mike Kravetz
2020-02-28  8:25       ` Vlastimil Babka
2020-02-28 14:32         ` Rik van Riel
2020-02-28 14:39           ` Vlastimil Babka
2020-02-28 15:47             ` Rik van Riel [this message]
2020-03-02  9:32   ` Vlastimil Babka

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=20200228104700.0af2f18d@imladris.surriel.com \
    --to=riel@surriel.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=mike.kravetz@oracle.com \
    --cc=rientjes@google.com \
    --cc=vbabka@suse.cz \
    --cc=ziy@nvidia.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;
as well as URLs for NNTP newsgroup(s).