From patchwork Fri Feb 28 15:47:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rik van Riel X-Patchwork-Id: 11412655 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A904B13A4 for ; Fri, 28 Feb 2020 15:47:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7FBBB2469F for ; Fri, 28 Feb 2020 15:47:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7FBBB2469F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=surriel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 937556B0007; Fri, 28 Feb 2020 10:47:09 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8E8E26B0008; Fri, 28 Feb 2020 10:47:09 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7FE406B000A; Fri, 28 Feb 2020 10:47:09 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0144.hostedemail.com [216.40.44.144]) by kanga.kvack.org (Postfix) with ESMTP id 650E76B0007 for ; Fri, 28 Feb 2020 10:47:09 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 10AFD4DA4 for ; Fri, 28 Feb 2020 15:47:09 +0000 (UTC) X-FDA: 76539964578.22.magic17_789c375787e40 X-Spam-Summary: 2,0,0,2ebc4209b8eaab8d,d41d8cd98f00b204,riel@shelob.surriel.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2553:2559:2562:3138:3139:3140:3141:3142:3352:3865:3867:3868:3873:3874:4321:4362:5007:6261:7875:7903:8957:9040:9545:9592:10004:10400:11026:11639:11658:11914:11984:12043:12109:12114:12262:12297:12438:12517:12519:12555:12679:12740:12760:12895:12986:13069:13311:13357:13439:14096:14097:14181:14394:14659:14721:21080:21365:21451:21627:21990:30054:30064:30070:30091,0,RBL:96.67.55.147:@shelob.surriel.com:.lbl8.mailshell.net-62.8.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none X-HE-Tag: magic17_789c375787e40 X-Filterd-Recvd-Size: 2991 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Fri, 28 Feb 2020 15:47:08 +0000 (UTC) Received: from [2603:3005:d05:2b00:6e0b:84ff:fee2:98bb] (helo=imladris.surriel.com) by shelob.surriel.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1j7hqw-0007MR-U8; Fri, 28 Feb 2020 10:47:02 -0500 Date: Fri, 28 Feb 2020 10:47:00 -0500 From: Rik van Riel To: Vlastimil Babka Cc: Mike Kravetz , 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 Message-ID: <20200228104700.0af2f18d@imladris.surriel.com> In-Reply-To: References: <20200227213238.1298752-2-riel@surriel.com> <7800e98e3688c124ac3672284b87d67321e1c29e.camel@surriel.com> <67185d77-87aa-400d-475c-4435d8b7be11@suse.cz> <47198271414db19cecbfa1a6ea685577dad3a72c.camel@surriel.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Thank you Mike & Vlastimil! ---8<--- commit 27f3cd5473d8bbf591b61d8b93b98bc333980d0d Author: Rik van Riel 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 Suggested-by: Vlastimil Babka Signed-off-by: Rik van Riel 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;