Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp795042ybf; Fri, 28 Feb 2020 07:47:36 -0800 (PST) X-Google-Smtp-Source: APXvYqzrWxPdEXoATrTpgdka+ILe2iTpeYOxw2TvE7chM1JXzktbGylKjjqLZsuMiVJefeFKFsqT X-Received: by 2002:a05:6830:4cd:: with SMTP id s13mr3734351otd.181.1582904856042; Fri, 28 Feb 2020 07:47:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582904856; cv=none; d=google.com; s=arc-20160816; b=QPX1JZ9xFG1UJr9GbIDPERdhG6ddqRv8Iz/sCZD2cz1+RxCPHq1xDeVmoI34+PFQRb IldcSItoLtsXA3wjrUfeXWrZd4leHjzwffJheOF7nKKE6J5Q8a2i/EZ1cNAiKBzYI3p9 SFL9lfzbMWw8cqjXcrxOyY2CyAYDs+GsJtT6CUsC8wk+ZeuI3r/8MAWjauWe6gruJs2w k5pUoAE74Ob905GB226yPiIlA5u7qIzMnj/b+R6PZEkEdpra5ZkkV7maDLNW+osGImET wsXi8Sr0L2yRdn+L89IZ2Kmv+nlmC2xOkLoEeuENgs9NYJt3rgRx748tXaPG+DbYp/v0 fioA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=5+CWffGG4sGm0cB9H7JmTvDhhfSAZgq1GM4eC6i097k=; b=Wkuhvc51eZhomKgUrbYIcuZGVFErms1BfCwEmdi+qzrEPNIjzGmpEVo/f93GU+635j yFUSmfNIYl6renczafROAoB57zSmdZpobohKqEf8KRf898prJYrI963fUTUx/Ms36Hsu r9APwpFr1DNo6bhAwKO07AACjSxJc2kFHYEiKd7xAgk1zfFM8MyvZKfdpMxfFYPxwXLK FxwkNYYouDgjg4Us+kFyJJFdoO8Ajz5psBgQGht8xyuVzF0sE9HDXUvmPeT6H4AnGX/+ NBmcRftxxYUX3iJcR0cCBtehz42VP3mUt2bgeYDgV3dpTvKHGxkzDUheisIT3JiKwZqO 2CGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z73si2122859oia.40.2020.02.28.07.47.23; Fri, 28 Feb 2020 07:47:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727061AbgB1PrJ (ORCPT + 99 others); Fri, 28 Feb 2020 10:47:09 -0500 Received: from shelob.surriel.com ([96.67.55.147]:49878 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726796AbgB1PrJ (ORCPT ); Fri, 28 Feb 2020 10:47:09 -0500 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 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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;