Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1542306pxb; Wed, 2 Feb 2022 07:17:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJwgkSS9XdjH2DDTp5DTRONKJ1JQKLB+MJkCOeFbE2dfO/2hjIb6SgsnmK/ObTwXlYEhHYPl X-Received: by 2002:a05:6a00:2394:: with SMTP id f20mr29460414pfc.43.1643815072797; Wed, 02 Feb 2022 07:17:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643815072; cv=none; d=google.com; s=arc-20160816; b=sOkk1+WVAC351VBj7NEM8QenfKKkcxtmqXwwkl8t6AaZ4DYOjyTdHq3fr0wTjO1kcw fRGmh8ZW4cZG1PjBgSL1/7vghFx+fzKfPbD189kZvvJaZZfTr7o5ta+rzsdGsvpO1jQ0 dz0lwZa/37PJIOpZElvzEin+FQV4ZpGrsd4islXosoQpkrdPGoFX9t199BX1o1YsGifL DzNqAJ66A98pVP89JXDCM4pzA7SAl4bwXqr7wPwyWQgn1G3VYVLrnm4RGUxriaNUeXmP oZWiuRJr4v35S36n6PduE3d5Mc5U4ympvgyT/irDOXVk5cwGd3/tCBpw3Rug/+scshaR LjKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :organization:from:references:cc:to:content-language:user-agent :mime-version:date:message-id:dkim-signature; bh=Riry/Ie+x1sinW7wNxc+GkihNaf8lfeZqesrgvEVnb0=; b=IDWYRjr0svyzPDzojkXgn156FISDvEvEcvvlY1Jy0r7J8U7azaFXEKHDjpp1Jnj1Lv KJF7uPxEt2uycKe4kgZiy7dBbDPGcg8d8cI4M+Gsl9WPF8bGa/394UqToUSL7g7eDxhj huA72/jpl7vKTODiMUU9Z4SdOKS6Uz3lG8t7IZIF7boeFvb1QGi9R9YIzEC0OuBnDnZd SIl/72IusefSkFfqGW7CeZFsaBxGesoHN9tJkHUYIIplQ/IKw2YXLGH5eXAYcVnUrpTw oNTfRTTiq3Fd6NWRsMZKY2R/brRRqpjBS3CvazhfAeuWmWDZ1d84KljdkiU7IQYRpeoO X4LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dlqaYtvc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x10si22786698plg.314.2022.02.02.07.17.38; Wed, 02 Feb 2022 07:17:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dlqaYtvc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344133AbiBBMZd (ORCPT + 99 others); Wed, 2 Feb 2022 07:25:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:37813 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232638AbiBBMZd (ORCPT ); Wed, 2 Feb 2022 07:25:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643804732; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Riry/Ie+x1sinW7wNxc+GkihNaf8lfeZqesrgvEVnb0=; b=dlqaYtvc2xTYWwZ+3y4jfY0FVRa8u3sny5EPVuwyN8eim1Z9URElNx7aCnx75u49gXIGxm y+X3cjBNXUxQF5FPppWSw5esxaCBG2Nu9U32ZNyCS0oGhGJ2QPepisJPfWZKZ6k+b9ykyC VwI1r+0ZAVZctCUWJxqUAbNvu/5RY0Y= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-587-MaAOzQIyN52JCqc01KDquA-1; Wed, 02 Feb 2022 07:25:31 -0500 X-MC-Unique: MaAOzQIyN52JCqc01KDquA-1 Received: by mail-ej1-f71.google.com with SMTP id fx12-20020a170906b74c00b006bbeab42f06so4425973ejb.3 for ; Wed, 02 Feb 2022 04:25:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=Riry/Ie+x1sinW7wNxc+GkihNaf8lfeZqesrgvEVnb0=; b=0jsOS+0vRNb5K8y24Jp1izEi2ULty1nQ7jhfnEu+Fumzx7VQyCW7+4u7nv/dt2pUDZ tdhIFMfotSch4ex30tUSk4jXKAG0uIiyKoKbbzRsdXXkN//S7eACUAoh5cOgjJ739Xg9 /5oOzVPli4tg+PrTZE/kQxg3xQ6zR83Tp/llh4De1BbeFwl9pRP3gtUABGK96YYo8MlR oVKn0Ms2pUmt3faAJ0NytUGIK67/PgyeVLZtVxCmoxlikusQIuMlNSWLH5uOVsA7V3qY g4DWf8zCpF+yo5r0Hf2KedzQpepkbt8g+Ku/Ns/liUyqr7CzxeqUxdpiSGwuSZGLI8+3 U79w== X-Gm-Message-State: AOAM532Pnujfvr7SokPUKaHJEGqEo/F6jRAraUvTS7Ehp6U9arhCQbnt EIoMLI0Qg3/SvQ9qEgVG+b12bUGjM3ED9AIS6T8PoGEgWpUwx/BwPzAxuQIXZQ4fGFlgu+TgMEn J5xkgTRn67ZCg5Oot8g4lk5cf X-Received: by 2002:a05:6402:7d0:: with SMTP id u16mr30060270edy.9.1643804730535; Wed, 02 Feb 2022 04:25:30 -0800 (PST) X-Received: by 2002:a05:6402:7d0:: with SMTP id u16mr30060236edy.9.1643804730176; Wed, 02 Feb 2022 04:25:30 -0800 (PST) Received: from ?IPV6:2003:cb:c709:f800:a55c:e484:3cd9:3632? (p200300cbc709f800a55ce4843cd93632.dip0.t-ipconnect.de. [2003:cb:c709:f800:a55c:e484:3cd9:3632]) by smtp.gmail.com with ESMTPSA id f6sm20889436edy.18.2022.02.02.04.25.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Feb 2022 04:25:29 -0800 (PST) Message-ID: <21c196f8-18ca-d720-4241-00c9461854d3@redhat.com> Date: Wed, 2 Feb 2022 13:25:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Content-Language: en-US To: Oscar Salvador , Zi Yan Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Michael Ellerman , Christoph Hellwig , Marek Szyprowski , Robin Murphy , linuxppc-dev@lists.ozlabs.org, virtualization@lists.linux-foundation.org, iommu@lists.linux-foundation.org, Vlastimil Babka , Mel Gorman , Eric Ren References: <20220119190623.1029355-1-zi.yan@sent.com> <20220119190623.1029355-4-zi.yan@sent.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v4 3/7] mm: page_isolation: check specified range for unmovable pages In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02.02.22 13:18, Oscar Salvador wrote: > On Wed, Jan 19, 2022 at 02:06:19PM -0500, Zi Yan wrote: >> From: Zi Yan >> >> Enable set_migratetype_isolate() to check specified sub-range for >> unmovable pages during isolation. Page isolation is done >> at max(MAX_ORDER_NR_PAEGS, pageblock_nr_pages) granularity, but not all >> pages within that granularity are intended to be isolated. For example, >> alloc_contig_range(), which uses page isolation, allows ranges without >> alignment. This commit makes unmovable page check only look for >> interesting pages, so that page isolation can succeed for any >> non-overlapping ranges. > > Another thing that came to my mind. > Prior to this patch, has_unmovable_pages() was checking on pageblock > granularity, starting at pfn#0 of the pageblock. > With this patch, you no longer check on pageblock granularity, which > means you might isolate a pageblock, but some pages that sneaked in > might actually be unmovable. > > E.g: > > Let's say you have a pageblock that spans (pfn#512,pfn#1024), > and you pass alloc_contig_range() (pfn#514,pfn#1024). > has_unmovable_pages() will start checking the pageblock at pfn#514, > and so it will mis pfn#512 and pfn#513. Isn't that a problem, if those > pfn turn out to be actually unmovable? That's the whole idea for being able to allocate parts of an unmovable pageblock that are movable. If the first part is unmovable but the second part is movable, nothing should stop us from trying to allocate the second part. Of course, we want to remember the original migratetype of the pageblock, to restore that after isolation -- otherwise we'll end up converting all such pageblocks to MIGRATE_MOVABLE. The next patch does that IIRC. However, devil is in the detail, and I still have to review those parts of this series. Note that there are no current users of alloc_contig_range() that allocate < MAX_ORDER - 1 -- except CMA, but for CMA we immediately exit has_unmovable_pages() either way. -- Thanks, David / dhildenb