Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp424494ybf; Fri, 28 Feb 2020 00:26:52 -0800 (PST) X-Google-Smtp-Source: APXvYqzVG1zUFChI3hNnERHPHDqT+vP98+pa8uYyAvbSRPV7kdAZrrFrsZ1hrijsfWyQF78+jz7g X-Received: by 2002:aca:44d7:: with SMTP id r206mr2321180oia.33.1582878412340; Fri, 28 Feb 2020 00:26:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582878412; cv=none; d=google.com; s=arc-20160816; b=wvrc5K/w8pgCfjZ503S8Eo68S0doTTkxmLU92+CZBZmwDjXEnaPKPKTYSv1S+Gtvd5 lO0N2Br8ngGxloLsMuSQnh0QHWPIDltDbs8kEqHE7xporkSL9AdzRsjtPdQ5nMu42E9L +Zj4jDjGLQzpitAUffEdzUKmvFTpxoUNRnP6KK4tVB0uNtDyOACegaWDJX2bpCfitmhj VT3P5h5SohKyGusMSC2avYUp47Yb/Ksznde49svODBR1i658CYBa6EUpytv8pZ7WF2o4 mHrp87Zm7lxCuCLfqmBv3DA1+zt0HZynbc52QcBm+X0l7O2gtx+R7HnX/FduH5ggaacG 5NCA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject; bh=Ol0q061Sq4oSeGCwJtrouM2lqeW+zkw00cPnhAP8PIw=; b=hpx5t47qw/dWePTjRV2L8b/SiHDiESwf/dlI4HW3WN753iTEMXnJaFFjLMIybDqpX/ 7vXPjix2/1fPprEYeq5zqPLP6gZ+h9X2CS3KPr/jGMJhqBmyXIM+K1dNBFuDxTEUr8q6 nICHSOeGlyqY3Ro8e9N+aPEb3v4WJB7IkibsYRpxXQrHPKpNGAWPWn7AIR2k5daP9oeh uFlUYmR5c+DNdCV6Kxr8YqR7dXqWKwcMA6dpEfxrgaBHJKo/+qQqmIIirS0z+0KnVIuC 6M4Yzk9N/NpKwTmbi4GkWLoal3rm3qtz9EBA9c/gz2DCd9nLLX69TOCKfStQRJqdjqu1 N3uA== 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 t12si1317672oij.179.2020.02.28.00.26.39; Fri, 28 Feb 2020 00:26:52 -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 S1726400AbgB1IZc (ORCPT + 99 others); Fri, 28 Feb 2020 03:25:32 -0500 Received: from mx2.suse.de ([195.135.220.15]:48892 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725877AbgB1IZc (ORCPT ); Fri, 28 Feb 2020 03:25:32 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 730A7AC52; Fri, 28 Feb 2020 08:25:29 +0000 (UTC) Subject: Re: [PATCH v2 2/2] mm,thp,compaction,cma: allow THP migration for CMA allocations To: Rik van Riel , 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 References: <20200227213238.1298752-2-riel@surriel.com> <7800e98e3688c124ac3672284b87d67321e1c29e.camel@surriel.com> From: Vlastimil Babka Autocrypt: addr=vbabka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KBETDCl4mkRVRlxPFl4O/w8dSaE4eczH LrKezaFiZOv6S1MUKVKzHInonrCqCNbXAHIeZa3JcXCYj1wWAjOt9R3NqcWsBGjFbkgoKMGD usiGabetmQjXNlVzyOYdAdrbpVRNVnaL91sB2j8LRD74snKsV0Wzwt90YHxDQ5z3M75YoIdl byTKu3BUuqZxkQ/emEuxZ7aRJ1Zw7cKo/IVqjWaQ1SSBDbZ8FAUPpHJxLdGxPRN8Pfw8blKY 8mvLJKoF6i9T6+EmlyzxqzOFhcc4X5ig5uQoOjTIq6zhLO+nqVZvUDd2Kz9LMOCYb516cwS/ Enpi0TcZ5ZobtLqEaL4rupjcJG418HFQ1qxC95u5FfNki+YTmu6ZLXy+1/9BDsPuZBOKYpUm 3HWSnCS8J5Ny4SSwfYPH/JrtberWTcCP/8BHmoSpS/3oL3RxrZRRVnPHFzQC6L1oKvIuyXYF rkybPXYbmNHN+jTD3X8nRqo+4Qhmu6SHi3Vq Message-ID: <67185d77-87aa-400d-475c-4435d8b7be11@suse.cz> Date: Fri, 28 Feb 2020 09:25:27 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <7800e98e3688c124ac3672284b87d67321e1c29e.camel@surriel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, >>> >>> /* >>> * 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 = compound_head(page); >>> unsigned int skip_pages; >>> >>> - if >>> (!hugepage_migration_supported(page_hstate(head))) >>> + if (PageHuge(page) && >>> + !hugepage_migration_supported(page_hstate(h >>> ead))) >>> + return page; >>> + >>> + if (!PageLRU(head) && !__PageMovable(head)) >> >> 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? Oh right you are. > Does that need to be the following, then? > > if (PageTransHuge(head) && !PageHuge(page) && !PageLRU(head) && > !__PageMovable(head)) > return page; I would instead make it an "else if" to the "if (PageHuge(page)...)" above. > That's an easy one liner I would be happy to send in > if everybody agrees that should fix things :) >