Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp770311ybf; Fri, 28 Feb 2020 07:19:32 -0800 (PST) X-Google-Smtp-Source: APXvYqxm7myEePPhsfLCLMRH1Fn0hL79qGNEkbhtJn5FuxLktYJYZE8Jzr6UEN8S4ncoU8loMG5Q X-Received: by 2002:a05:6830:1e76:: with SMTP id m22mr3916057otr.295.1582903172189; Fri, 28 Feb 2020 07:19:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582903172; cv=none; d=google.com; s=arc-20160816; b=dhxo6R29NCi6hhxgsLW17YMwXnYdpUAjRz0y/DULRh5gv3+7d6hEKPnn60ou8X/4XV qNXKoYnERC53Y6z3/vCD5k2bHf76z4d8IzkqKeZDMS7E97MkzyDahL64QR5UKeNi1zJa VOQsvsnyeabJx3mFBOLnD3wUPRzmiCA+N2kJu456oguCigSmy6TrwELuZlRZataT3hIb UqB8qnX0AaRvbBjpLSF1uZtoeBN6uUZPgJTY+KCKVy6tLUMjPQPaUH/BossLdBZ53ey5 IAio83N29mgSW866NPPls5hIxw9Aevhl4MofRdRY2+ujno8sVLycKDsrcoI6XBwmRAel HXIQ== 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=ngH4+ssrElyC/0bJ/h7SRAwW4SXP41dfLGYR+oAeE5s=; b=ZHX+nItljMRMKTlQ7k3ziBZu8HBmI9YWaEWLgHCJTlxZAMhPgjJH72pM6aifaguak+ yocURrJjPhwE4Chrt0CJXzc7iMX5sJ7g5EyzjUXj+6jqisfd/7nkgAyPvNrSXztOLviE on/C7yIISfcOn2N5IOeiNh6rhwwSnc48PgodCbp6K53aEqxdyifBdDjah3o/D1UVL+IB tXG2fPvcgcqVO9r+VyPGH09b/YBJHH+K36BGfYVkgifzMEpruRwsJqySxNZzl/b2JACx 0QYA63dLJoiiO3ajdzxBazh2sxkqv5VwY7aGU30cmGlv+4PFIQvvlUcrKcLUb3qy2VNB eDMQ== 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 s70si799356oie.178.2020.02.28.07.19.19; Fri, 28 Feb 2020 07:19:32 -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 S1726979AbgB1PRV (ORCPT + 99 others); Fri, 28 Feb 2020 10:17:21 -0500 Received: from mx2.suse.de ([195.135.220.15]:53750 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726650AbgB1PRU (ORCPT ); Fri, 28 Feb 2020 10:17:20 -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 03ABBAF55; Fri, 28 Feb 2020 15:17:17 +0000 (UTC) Subject: Re: [PATCH 2/2] mm,thp,compaction,cma: allow THP migration for CMA allocations To: Rik van Riel , 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 References: <3289dc5e6c4c3174999598d8293adf8ed3e93b57.1582321645.git.riel@surriel.com> <05027092-a43e-756f-4fee-78f29a048ca1@suse.cz> <81c8d2fa-a8ae-82b8-f359-bba055fbff68@suse.cz> From: Vlastimil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E/Zo2x0Ikk98sSIKBETDCl4mkRVRlxPFl4O/w8dSaE4eczH LrKezaFiZOv6S1MUKVKzHInonrCqCNbXAHIeZa3JcXCYj1wWAjOt9R3NqcWsBGjFbkgoKMGD usiGabetmQjXNlVzyOYdAdrbpVRNVnaL91sB2j8LRD74snKsV0Wzwt90YHxDQ5z3M75YoIdl byTKu3BUuqZxkQ/emEuxZ7aRJ1Zw7cKo/IVqjWaQ1SSBDbZ8FAUPpHJxLdGxPRN8Pfw8blKY 8mvLJKoF6i9T6+EmlyzxqzOFhcc4X5ig5uQoOjTIq6zhLO+nqVZvUDd2Kz9LMOCYb516cwS/ Enpi0TcZ5ZobtLqEaL4rupjcJG418HFQ1qxC95u5FfNki+YTmu6ZLXy+1/9BDsPuZBOKYpUm 3HWSnCS8J5Ny4SSwfYPH/JrtberWTcCP/8BHmoSpS/3oL3RxrZRRVnPHFzQC6L1oKvIuyXYF rkybPXYbmNHN+jTD3X8nRqo+4Qhmu6SHi3Vq Message-ID: <1094fc21-9104-1410-bc03-f1934dbfcd66@suse.cz> Date: Fri, 28 Feb 2020 16:17:17 +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: 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/26/20 6:53 PM, Rik van Riel wrote: > On Wed, 2020-02-26 at 10:48 +0100, Vlastimil Babka wrote: >> On 2/25/20 7:44 PM, Rik van Riel wrote: >> >> Uh, is it any different from base pages which have to pass the same >> check? I >> guess the caller could do e.g. lru_add_drain_all() first. > > You are right, it is not different. > > As for lru_add_drain_all(), I wonder at what point that > should happen? Right now it seems to be done in alloc_contig_range(), but rather late. > It appears that the order in which things are done does > not really provide a good moment: > 1) decide to attempt allocating a range of memory > 2) scan each page block for unmovable pages > 3) if no unmovable pages are found, mark the page block > MIGRATE_ISOLATE > > I wonder if we should do things the opposite way, first > marking the page block MIGRATE_ISOLATE (to prevent new > allocations), then scanning it, and calling lru_add_drain_all > if we encounter a page that looks like it could benefit from > that. > > If we still see unmovable pages after that, it is cheap > enough to set the page block back to its previous state. Yeah seems like the whole has_unmovable_pages() thing isn't much useful here. It might prevent some unnecessary action like isolating something, then finding non-movable page and rolling back the isolation. But maybe it's not worth the savings, and also has_unmovable_pages() being false doesn't guarantee succeed in the actual isolate+migrate attempt. And if it can cause a false negative due to lru pages not drained, then it's actually worse than if it wasn't called at all.