From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD4C6C433F5 for ; Wed, 2 Feb 2022 12:25:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 380028D00F8; Wed, 2 Feb 2022 07:25:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 330186B01A4; Wed, 2 Feb 2022 07:25:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1D0458D00F8; Wed, 2 Feb 2022 07:25:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 0B4A26B01A3 for ; Wed, 2 Feb 2022 07:25:34 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A560F603C0 for ; Wed, 2 Feb 2022 12:25:33 +0000 (UTC) X-FDA: 79097760546.03.5F6104F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf07.hostedemail.com (Postfix) with ESMTP id 373BB4000E for ; Wed, 2 Feb 2022 12:25:33 +0000 (UTC) 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-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-201-jm3Lm6mfM_CxyzZ7rUG2gQ-1; Wed, 02 Feb 2022 07:25:31 -0500 X-MC-Unique: jm3Lm6mfM_CxyzZ7rUG2gQ-1 Received: by mail-ej1-f69.google.com with SMTP id 13-20020a170906328d00b006982d0888a4so7992443ejw.9 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=u0woKki089zbg0p0A99MeTG3E7IdMbES17tAIy7xs8Pz/k7GwdRiSxCxtkfoWDvUFf uuUo5fUgqhciaFmx3IYpr9UzywzQ23YqybIC0IGiSgNT5iV85bxQ06HxoIv9t43pmrRP Pv7pobj5gzRttwJa+NO7YQBvGxxrxMpnkDQSBjNdx3tK3yFjaqsDZqfX8M8NipuT4UiH KABsDyk0bS+8O5tyMMRNku9TCZNCGhWgxnnDP/5BYqUpAosk8JwNpHNdxRCGIxgG9Wfi 0FgrdzWM9Tgf3gCN5y3ryYT5C7HcoSJbgIsvgsohwnydXS/MWUWlDvOuGbqShQgcf8h3 Ir9w== X-Gm-Message-State: AOAM532BRWag8rHVVXsg321PwS8+fALZ26gkd0IbTUZiavfBCCFvEft8 uIbZMdiwm130mMknGpaYtbPW+A7B+DiSAqzYrb/4xA+sebPgIvbmbu1MJwutGPyc8uDKtr2R8xD TkYcytoDkojs= X-Received: by 2002:a05:6402:7d0:: with SMTP id u16mr30060273edy.9.1643804730536; Wed, 02 Feb 2022 04:25:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJxgTNVg4PsKEjgBZhYvXrFMFKGRSAUL0S3jbEcFB9ylZ3e4FOsTEFQdbkPIWl6zZX7rsjy0bA== 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 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: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 373BB4000E X-Stat-Signature: 5wn51mcsrt4q315wxtu84nttyim7317p Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dlqaYtvc; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf07.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=david@redhat.com X-Rspam-User: nil X-HE-Tag: 1643804733-92122 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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