Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp727031ybf; Fri, 28 Feb 2020 06:34:03 -0800 (PST) X-Google-Smtp-Source: APXvYqzRayeFDhOJYUG/RXs26S7zGfwxze03Shp44CbrfgwhoWE1KNNSDugWCVZ9aingKVcwR+Qz X-Received: by 2002:a05:6830:1014:: with SMTP id a20mr3527833otp.302.1582900443116; Fri, 28 Feb 2020 06:34:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582900443; cv=none; d=google.com; s=arc-20160816; b=YgXCPqZIA5m9X2Rmra6IH6XMztOVbmeCFON9zAbfhbtyZfz4keaAnyZnHD0AGHL5vx UBqrgHU78Uz8XPTlJc2IfHNi4zGF3DrqLSBuDfaaFRLTibvUSoTAFwtpi5GwWL178waV /Bh1i79Opam1vbNaWCXPor9rcJs3XjkqMLFgnxXYUyM2RakoTfGwGIwbe9O2oPLg3RuG rLQYWbySF9HlXthejSbxsRaW/uE5HXufihYjxFiCPHlF3uhdCJM4/t9VwVB4m6J8St6h cu0dmtp9av5PFQRMKM8AdxFNcdDqEzBsmKW+WTI6XBF3lJfiwxKsc1tQxDHrQlDnGKE8 +WpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id; bh=Wg3DLpalZUYHF7CnDA4SiAQRXsgIP6qd8/PCqG0b5kg=; b=Oh4X/ksBPXm31Mx2WGHc88xvGID8reLcM5m2za0VTw85QACLtvHDNhfwxHdozXVFCm l4BJJM88owgEoVng+QYBQrWZuZygWcLLAJr1UBDf1xAYD5FwTtZZ7BNzDS9ZTEIt48od 91NUitblAW24XrHovUBEzVwH7eueMDkI4s/n84BixX8OHC1owlq6TZfQFq1gQ7yPmS38 Rdd1EE55j9lCJ6vCn+6VcJfyqysOI9H2xs7MsRW/u43Eh/e7RDyJd0O5gYHEDmEu46VH Jt68Tv1w4uiQhV/dBb+cjJvQOZr61h2NGkdtlta/vLykzdlF3uMgHBYfDi2yWK4o1drJ /I4g== 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 a21si619221oib.166.2020.02.28.06.33.51; Fri, 28 Feb 2020 06:34:03 -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 S1727066AbgB1Oc2 (ORCPT + 99 others); Fri, 28 Feb 2020 09:32:28 -0500 Received: from shelob.surriel.com ([96.67.55.147]:49700 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726694AbgB1Oc1 (ORCPT ); Fri, 28 Feb 2020 09:32:27 -0500 Received: from imladris.surriel.com ([96.67.55.152]) by shelob.surriel.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1j7gge-0006Uf-MS; Fri, 28 Feb 2020 09:32:20 -0500 Message-ID: <47198271414db19cecbfa1a6ea685577dad3a72c.camel@surriel.com> Subject: Re: [PATCH v2 2/2] mm,thp,compaction,cma: allow THP migration for CMA allocations From: Rik van Riel To: Vlastimil Babka , Mike Kravetz , linux-kernel@vger.kernel.org Cc: 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 Date: Fri, 28 Feb 2020 09:32:04 -0500 In-Reply-To: <67185d77-87aa-400d-475c-4435d8b7be11@suse.cz> References: <20200227213238.1298752-2-riel@surriel.com> <7800e98e3688c124ac3672284b87d67321e1c29e.camel@surriel.com> <67185d77-87aa-400d-475c-4435d8b7be11@suse.cz> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-y/7ndlqWhwsZ6DQBptKq" User-Agent: Evolution 3.34.3 (3.34.3-1.fc31) MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-y/7ndlqWhwsZ6DQBptKq Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2020-02-28 at 09:25 +0100, Vlastimil Babka wrote: > On 2/28/20 2:21 AM, Rik van Riel wrote: > > On Thu, 2020-02-27 at 15:41 -0800, Mike Kravetz wrote: > > > On 2/27/20 1:32 PM, Rik van Riel wrote: > > > > +++ b/mm/page_alloc.c > > > > @@ -8253,14 +8253,19 @@ struct page *has_unmovable_pages(struct > > > > zone *zone, struct page *page, > > > > =20 > > > > /* > > > > * Hugepages are not in LRU lists, but they're > > > > movable. > > > > + * THPs are on the LRU, but need to be counted > > > > as > > > > #small pages. > > > > * We need not scan over tail pages because we > > > > don't > > > > * handle each tail page individually in > > > > migration. > > > > */ > > > > - if (PageHuge(page)) { > > > > + if (PageHuge(page) || PageTransCompound(page)) > > > > { > > > > struct page *head =3D > > > > compound_head(page); > > > > unsigned int skip_pages; > > > > =20 > > > > - if > > > > (!hugepage_migration_supported(page_hstate(head))) > > > > + if (PageHuge(page) && > > > > + !hugepage_migration_supported(page_ > > > > hstate(h > > > > ead))) > > > > + return page; > > > > + > > > > + if (!PageLRU(head) && > > > > !__PageMovable(head)) > > >=20 > > > Pretty sure this is going to be true for hugetlb pages. So, this > > > will change > > > behavior and make all hugetlb pages look unmovable. Perhaps, > > > only > > > check this > > > condition for THP pages? >=20 > Oh right you are. >=20 > > Does that need to be the following, then? > >=20 > > if (PageTransHuge(head) && !PageHuge(page) && !PageLRU(head) > > && > > !__PageMovable(head)) > > return page; >=20 > I would instead make it an "else if" to the "if (PageHuge(page)...)" > above. That was my first thought too, but that could break on pages that are PageHuge when hugepage_migration_supported returns true. --=20 All Rights Reversed. --=-y/7ndlqWhwsZ6DQBptKq Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEKR73pCCtJ5Xj3yADznnekoTE3oMFAl5ZJGQACgkQznnekoTE 3oNXLwgAqvXeuLmGzd0RhDnDwPGxGSbF9BXHxPUdd4pkgLQ19YJDy4KjiqJ4Qygn OywW3UgFi9K9FwKZsbA3ZIID8+mm1H9qmTAaTMlzq7ItnexGARXvynJcmiUWt1lb OgLKf4dnLT3k6naB2ebO6S+Qkxro08JwIhKbA3ATCZkJcGRSNZDqIsvL8PPHf0+3 Z+TLUyvEEQnmqRUCVcgrBPXsSig0Uh2zq3V0BmdCSK4q9/UdKgyd9xrxueJtkj3R q4zyOEvB01b0lCR6Wue6FCDPLaEKq3NZ44dw/VYFFy+q6Qs+Poy7g1UGz22vAoWo OnJFOG6XoOg2MbLlKhVuZvkIdDg7uQ== =Lf9E -----END PGP SIGNATURE----- --=-y/7ndlqWhwsZ6DQBptKq--