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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC0CEC433EF for ; Wed, 12 Jan 2022 11:01:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352683AbiALLBq (ORCPT ); Wed, 12 Jan 2022 06:01:46 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51186 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352711AbiALLBm (ORCPT ); Wed, 12 Jan 2022 06:01:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641985301; 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=8/XZEAdk6QhvWrbmCBXkp2EEmuq+KMqsHqxGoGIR2UA=; b=gDKZgegZNFgx+n0cfX0mkQlNnH7cGccrxGMkLGvVBKDcR1fLslh/6vpvGhvIuxth4Hi4fg z3QQuXp8CxKi+yJg1j2eu/kDo0Zjz9qVQzV0iV5UFNBcxOare7VozVwmqKCz2KWwQfCVWw M3rOJl5XITk6jqK16aYeeT4CwQwB2uQ= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-194-_6pklw1jNLSo8mDEh8_8Yg-1; Wed, 12 Jan 2022 06:01:40 -0500 X-MC-Unique: _6pklw1jNLSo8mDEh8_8Yg-1 Received: by mail-ed1-f70.google.com with SMTP id y18-20020a056402271200b003fa16a5debcso1927625edd.14 for ; Wed, 12 Jan 2022 03:01:39 -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:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=8/XZEAdk6QhvWrbmCBXkp2EEmuq+KMqsHqxGoGIR2UA=; b=FgUKgnyy7thdYCwIJUFAqWxCkAhVPHJh8kYsNRodVHRV4+dbxGtSb9tba4lyCLZe1b f3wMMsQtZGDNMljvLMumW5SIb/aDaBLok6QZKENEqN1v3GhuAH4Q9pGoYk2TRzxfVfc0 Wy6qs9jTUlfQekcJgpRVy7brOFFAqnS3lR4Oj5Du5mlhqRzR+8Qredj20TS+4gAB29Tz V/eko0sJXySrxBdjRuFdz4lM7I+y+/n6sEyTu0h6ZWMWTU5PHWxFmI90W4g9sfBbXwQO y+U4T5tzt7m2/cYvs5kjSj4ctnRKNZpLBNvUVlac4BtWKMFYQjD2v4CL8SWTTz00X5tD lzFg== X-Gm-Message-State: AOAM533Ian3DvC9H9jTV6sUoF5ukGX4MNWDCIX4/dZbuxbFd8WD8OI0u vNK01Q9FfAvqY1sHMCp7C11JDIy1gguFBKANQZFVxIj7ky/c28lWATr8hKIuxEDbM/jfrOTXW1N +CwQSOWRBGJWC4yLBpQFE10+O X-Received: by 2002:a05:6402:4405:: with SMTP id y5mr8374669eda.179.1641985298938; Wed, 12 Jan 2022 03:01:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWWf+6A4h9fD+VcApry/1ctZSaWE5x9A2DNgQ1rynCwOFlVNP1wLYNq0HbTcp/3NUGR7KzoA== X-Received: by 2002:a05:6402:4405:: with SMTP id y5mr8374660eda.179.1641985298747; Wed, 12 Jan 2022 03:01:38 -0800 (PST) Received: from ?IPV6:2003:cb:c702:4700:e25f:39eb:3cb8:1dec? (p200300cbc7024700e25f39eb3cb81dec.dip0.t-ipconnect.de. [2003:cb:c702:4700:e25f:39eb:3cb8:1dec]) by smtp.gmail.com with ESMTPSA id 13sm4394200ejh.225.2022.01.12.03.01.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Jan 2022 03:01:38 -0800 (PST) Message-ID: Date: Wed, 12 Jan 2022 12:01:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [RFC PATCH v3 2/8] mm: compaction: handle non-lru compound pages properly in isolate_migratepages_block(). Content-Language: en-US To: Zi Yan , linux-mm@kvack.org Cc: 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: <20220105214756.91065-1-zi.yan@sent.com> <20220105214756.91065-3-zi.yan@sent.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220105214756.91065-3-zi.yan@sent.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05.01.22 22:47, Zi Yan wrote: > From: Zi Yan > > In isolate_migratepages_block(), a !PageLRU tail page can be encountered > when the page is larger than a pageblock. Use compound head page for the > checks inside and skip the entire compound page when isolation succeeds. > This will currently never happen, due to the way we always isolate MAX_ORDER -1 ranges, correct? Better note that in the patch description, because currently it reads like it's an actual fix "can be encountered". > Signed-off-by: Zi Yan > --- > mm/compaction.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/mm/compaction.c b/mm/compaction.c > index b4e94cda3019..ad9053fbbe06 100644 > --- a/mm/compaction.c > +++ b/mm/compaction.c > @@ -979,19 +979,23 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, > * Skip any other type of page > */ > if (!PageLRU(page)) { > + struct page *head = compound_head(page); > /* > * __PageMovable can return false positive so we need > * to verify it under page_lock. > */ > - if (unlikely(__PageMovable(page)) && > - !PageIsolated(page)) { > + if (unlikely(__PageMovable(head)) && > + !PageIsolated(head)) { > if (locked) { > unlock_page_lruvec_irqrestore(locked, flags); > locked = NULL; > } > > - if (!isolate_movable_page(page, isolate_mode)) > + if (!isolate_movable_page(head, isolate_mode)) { > + low_pfn += (1 << compound_order(head)) - 1 - (page - head); > + page = head; > goto isolate_success; > + } > } > > goto isolate_fail; -- Thanks, David / dhildenb 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 smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7367AC433FE for ; Wed, 12 Jan 2022 11:01:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 29791409D2; Wed, 12 Jan 2022 11:01:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bA17X-vQ50xl; Wed, 12 Jan 2022 11:01:47 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id B7C9B4019B; Wed, 12 Jan 2022 11:01:46 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 89A17C0030; Wed, 12 Jan 2022 11:01:46 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 53D2AC0030 for ; Wed, 12 Jan 2022 11:01:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 30FE06FB8B for ; Wed, 12 Jan 2022 11:01:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qfRegDm7BS60 for ; Wed, 12 Jan 2022 11:01:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 7F8486FB8F for ; Wed, 12 Jan 2022 11:01:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641985303; 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=8/XZEAdk6QhvWrbmCBXkp2EEmuq+KMqsHqxGoGIR2UA=; b=DK1+lKg2UaD3bNk8Dy8HUxN36HXmHiZQ2CxVywgzFn+l4sE5C0QlCEH0blT7WCCngTkOv0 LJS9JjB7pRa+Mt8sb4VgSpnsNnAC4I+OqB/K0oEPHQKAY7Vfosm9cSJQwnrGjdo1YBNZzL RE9MYJPUnAp2JiZeYIJ66hN/ajZm3m0= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-583-_XrIcovKOJygLCaQTo0D9w-1; Wed, 12 Jan 2022 06:01:40 -0500 X-MC-Unique: _XrIcovKOJygLCaQTo0D9w-1 Received: by mail-ed1-f72.google.com with SMTP id ec25-20020a0564020d5900b003fc074c5d21so1895862edb.19 for ; Wed, 12 Jan 2022 03:01:39 -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:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=8/XZEAdk6QhvWrbmCBXkp2EEmuq+KMqsHqxGoGIR2UA=; b=MN7HifqYN3Ckc5X9iVm3HceLGwfJ9Y97MmhS01nCm3Ra+/bQ6pZWNNm7TZQPVkDQiU Ee3ItSHM2txhktk2d0cyALZbelB/Hlhdu4JcaEX24ZhUclOMZ0gCiNHC08yw0iNszIPG 02D7CbEkVrL5orxZQ0kMFkEh1aDQ+LvE/1zDns8x9Xg9wnefsQ1clZL9O3Zl7PNNX/uj lUlZlbPMsUc8FhfT8vIiYsZz14RsyNDUNQef9oN9/7Wjap+XWfH0HU0ZSYVAvCyNADYz XtEAhROeShKznNsdlRnq1REee173lB7UuJoaU3dsa9gSf0+Ld8jSglXGTeWMhKKPBW7a HrUQ== X-Gm-Message-State: AOAM53001iLmPoGI4z51L9mY8xJ7KGiPQD0I1meE5pYOtUzwwVT8hHZ+ +WKQVZW1wkLsNQSXY+lbnSSleQEW17J1TCJaQEYpZyV5Xi4m/0CCglskJE5tn37QcT1ST4esNaO fZCTdDv4clExckVEJHU2GIuC/nQKz9g== X-Received: by 2002:a05:6402:4405:: with SMTP id y5mr8374681eda.179.1641985298979; Wed, 12 Jan 2022 03:01:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWWf+6A4h9fD+VcApry/1ctZSaWE5x9A2DNgQ1rynCwOFlVNP1wLYNq0HbTcp/3NUGR7KzoA== X-Received: by 2002:a05:6402:4405:: with SMTP id y5mr8374660eda.179.1641985298747; Wed, 12 Jan 2022 03:01:38 -0800 (PST) Received: from ?IPV6:2003:cb:c702:4700:e25f:39eb:3cb8:1dec? (p200300cbc7024700e25f39eb3cb81dec.dip0.t-ipconnect.de. [2003:cb:c702:4700:e25f:39eb:3cb8:1dec]) by smtp.gmail.com with ESMTPSA id 13sm4394200ejh.225.2022.01.12.03.01.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Jan 2022 03:01:38 -0800 (PST) Message-ID: Date: Wed, 12 Jan 2022 12:01:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [RFC PATCH v3 2/8] mm: compaction: handle non-lru compound pages properly in isolate_migratepages_block(). To: Zi Yan , linux-mm@kvack.org References: <20220105214756.91065-1-zi.yan@sent.com> <20220105214756.91065-3-zi.yan@sent.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220105214756.91065-3-zi.yan@sent.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Cc: Mel Gorman , Michael Ellerman , Robin Murphy , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Eric Ren , virtualization@lists.linux-foundation.org, linuxppc-dev@lists.ozlabs.org, Christoph Hellwig , Vlastimil Babka X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On 05.01.22 22:47, Zi Yan wrote: > From: Zi Yan > > In isolate_migratepages_block(), a !PageLRU tail page can be encountered > when the page is larger than a pageblock. Use compound head page for the > checks inside and skip the entire compound page when isolation succeeds. > This will currently never happen, due to the way we always isolate MAX_ORDER -1 ranges, correct? Better note that in the patch description, because currently it reads like it's an actual fix "can be encountered". > Signed-off-by: Zi Yan > --- > mm/compaction.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/mm/compaction.c b/mm/compaction.c > index b4e94cda3019..ad9053fbbe06 100644 > --- a/mm/compaction.c > +++ b/mm/compaction.c > @@ -979,19 +979,23 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, > * Skip any other type of page > */ > if (!PageLRU(page)) { > + struct page *head = compound_head(page); > /* > * __PageMovable can return false positive so we need > * to verify it under page_lock. > */ > - if (unlikely(__PageMovable(page)) && > - !PageIsolated(page)) { > + if (unlikely(__PageMovable(head)) && > + !PageIsolated(head)) { > if (locked) { > unlock_page_lruvec_irqrestore(locked, flags); > locked = NULL; > } > > - if (!isolate_movable_page(page, isolate_mode)) > + if (!isolate_movable_page(head, isolate_mode)) { > + low_pfn += (1 << compound_order(head)) - 1 - (page - head); > + page = head; > goto isolate_success; > + } > } > > goto isolate_fail; -- Thanks, David / dhildenb _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu 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 smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A85D8C433F5 for ; Wed, 12 Jan 2022 11:01:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 5D34C409A9; Wed, 12 Jan 2022 11:01:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GJOGYToK1ZRP; Wed, 12 Jan 2022 11:01:45 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 8676140169; Wed, 12 Jan 2022 11:01:44 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 52F10C0030; Wed, 12 Jan 2022 11:01:44 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1165EC001E for ; Wed, 12 Jan 2022 11:01:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id F36EB428E8 for ; Wed, 12 Jan 2022 11:01:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Avq0r1UezZoY for ; Wed, 12 Jan 2022 11:01:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 4F9A7428A6 for ; Wed, 12 Jan 2022 11:01:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641985301; 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=8/XZEAdk6QhvWrbmCBXkp2EEmuq+KMqsHqxGoGIR2UA=; b=gDKZgegZNFgx+n0cfX0mkQlNnH7cGccrxGMkLGvVBKDcR1fLslh/6vpvGhvIuxth4Hi4fg z3QQuXp8CxKi+yJg1j2eu/kDo0Zjz9qVQzV0iV5UFNBcxOare7VozVwmqKCz2KWwQfCVWw M3rOJl5XITk6jqK16aYeeT4CwQwB2uQ= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-573-aZMqF7aPOIGd-6bbs99Ezg-1; Wed, 12 Jan 2022 06:01:40 -0500 X-MC-Unique: aZMqF7aPOIGd-6bbs99Ezg-1 Received: by mail-ed1-f70.google.com with SMTP id b8-20020a056402350800b003f8f42a883dso1921565edd.16 for ; Wed, 12 Jan 2022 03:01:39 -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:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=8/XZEAdk6QhvWrbmCBXkp2EEmuq+KMqsHqxGoGIR2UA=; b=1LU8Tr/2abeckBwGSbj5nL1AaXW2r9heGlLtMgR6tCm5dTyEma9hHDAkb17bk0m2xV t1IiDejGdKnejPalF9yYdybC6E23GCg3MvyVAceIMzN2428YRvrMM4fKV9sDHicA5bZy ddMeQ6Z/zek9yGuAW0OoAQCelTSmlSnYsnnJ0gGcj//b0T+EaGw+YFx0Pz5ZHG/SPdi6 PcqJFYRNvjO+y8ZgwN0tN3irI5uXJpOgeOZlhqmoSbu+V9lpMJABfJenAus00hVu5wqg qFPRHOLrFrCMoPhvLKigHvnaWz8C4cYFuYJxnyrTMROgdIkwvc+rm0InVwatNeHyHX6P 7szA== X-Gm-Message-State: AOAM531c1YGhrprIfC0XwiDCzjkO2nPSaUVMDlaOfRooVm/+kzgXve3F 6An+8X1dqt5DK+xMO6qgiCZhHhf9aIHwdD0svDahaY4RyrbMByCWlTNRNHT8XbYv2NzrKIBLayG pesROUD4QvkK8klDlbjWUHNygKFii0rpqRP2T4dTYSA== X-Received: by 2002:a05:6402:4405:: with SMTP id y5mr8374676eda.179.1641985298941; Wed, 12 Jan 2022 03:01:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWWf+6A4h9fD+VcApry/1ctZSaWE5x9A2DNgQ1rynCwOFlVNP1wLYNq0HbTcp/3NUGR7KzoA== X-Received: by 2002:a05:6402:4405:: with SMTP id y5mr8374660eda.179.1641985298747; Wed, 12 Jan 2022 03:01:38 -0800 (PST) Received: from ?IPV6:2003:cb:c702:4700:e25f:39eb:3cb8:1dec? (p200300cbc7024700e25f39eb3cb81dec.dip0.t-ipconnect.de. [2003:cb:c702:4700:e25f:39eb:3cb8:1dec]) by smtp.gmail.com with ESMTPSA id 13sm4394200ejh.225.2022.01.12.03.01.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Jan 2022 03:01:38 -0800 (PST) Message-ID: Date: Wed, 12 Jan 2022 12:01:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [RFC PATCH v3 2/8] mm: compaction: handle non-lru compound pages properly in isolate_migratepages_block(). To: Zi Yan , linux-mm@kvack.org References: <20220105214756.91065-1-zi.yan@sent.com> <20220105214756.91065-3-zi.yan@sent.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220105214756.91065-3-zi.yan@sent.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Cc: Mel Gorman , Michael Ellerman , Robin Murphy , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Eric Ren , virtualization@lists.linux-foundation.org, linuxppc-dev@lists.ozlabs.org, Christoph Hellwig , Vlastimil Babka , Marek Szyprowski X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" On 05.01.22 22:47, Zi Yan wrote: > From: Zi Yan > > In isolate_migratepages_block(), a !PageLRU tail page can be encountered > when the page is larger than a pageblock. Use compound head page for the > checks inside and skip the entire compound page when isolation succeeds. > This will currently never happen, due to the way we always isolate MAX_ORDER -1 ranges, correct? Better note that in the patch description, because currently it reads like it's an actual fix "can be encountered". > Signed-off-by: Zi Yan > --- > mm/compaction.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/mm/compaction.c b/mm/compaction.c > index b4e94cda3019..ad9053fbbe06 100644 > --- a/mm/compaction.c > +++ b/mm/compaction.c > @@ -979,19 +979,23 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, > * Skip any other type of page > */ > if (!PageLRU(page)) { > + struct page *head = compound_head(page); > /* > * __PageMovable can return false positive so we need > * to verify it under page_lock. > */ > - if (unlikely(__PageMovable(page)) && > - !PageIsolated(page)) { > + if (unlikely(__PageMovable(head)) && > + !PageIsolated(head)) { > if (locked) { > unlock_page_lruvec_irqrestore(locked, flags); > locked = NULL; > } > > - if (!isolate_movable_page(page, isolate_mode)) > + if (!isolate_movable_page(head, isolate_mode)) { > + low_pfn += (1 << compound_order(head)) - 1 - (page - head); > + page = head; > goto isolate_success; > + } > } > > goto isolate_fail; -- Thanks, David / dhildenb _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3DD0DC433F5 for ; Wed, 12 Jan 2022 11:02:27 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4JYl5F4kclz2yxm for ; Wed, 12 Jan 2022 22:02:25 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gDKZgegZ; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gDKZgegZ; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=david@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gDKZgegZ; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gDKZgegZ; dkim-atps=neutral X-Greylist: delayed 405 seconds by postgrey-1.36 at boromir; Wed, 12 Jan 2022 22:01:46 AEDT Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4JYl4V0mkZz2x9p for ; Wed, 12 Jan 2022 22:01:45 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641985301; 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=8/XZEAdk6QhvWrbmCBXkp2EEmuq+KMqsHqxGoGIR2UA=; b=gDKZgegZNFgx+n0cfX0mkQlNnH7cGccrxGMkLGvVBKDcR1fLslh/6vpvGhvIuxth4Hi4fg z3QQuXp8CxKi+yJg1j2eu/kDo0Zjz9qVQzV0iV5UFNBcxOare7VozVwmqKCz2KWwQfCVWw M3rOJl5XITk6jqK16aYeeT4CwQwB2uQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641985301; 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=8/XZEAdk6QhvWrbmCBXkp2EEmuq+KMqsHqxGoGIR2UA=; b=gDKZgegZNFgx+n0cfX0mkQlNnH7cGccrxGMkLGvVBKDcR1fLslh/6vpvGhvIuxth4Hi4fg z3QQuXp8CxKi+yJg1j2eu/kDo0Zjz9qVQzV0iV5UFNBcxOare7VozVwmqKCz2KWwQfCVWw M3rOJl5XITk6jqK16aYeeT4CwQwB2uQ= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-179-vG5ZIrTCN4-Jm3SCVTQqYw-1; Wed, 12 Jan 2022 06:01:40 -0500 X-MC-Unique: vG5ZIrTCN4-Jm3SCVTQqYw-1 Received: by mail-ed1-f72.google.com with SMTP id g11-20020a056402090b00b003f8fd1ac475so1971542edz.1 for ; Wed, 12 Jan 2022 03:01:40 -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:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=8/XZEAdk6QhvWrbmCBXkp2EEmuq+KMqsHqxGoGIR2UA=; b=LtGqgMpCKXGJqXquIX+AmwnqaInMoxyKsfpzBErmogD6IwKdYGpTEKDFRuSe0hRZYO g7yWGVurom8AgKt1u5HLFvMv0/8Q8rFZ7XPeHCwJquK0TAXtKYxaLh4vb+ges1gGV3ZK 612k7tuZnnpFF4ig/e5fjepuvGlRl/P4lkjTVldX9TIUPPi57T10s04G3BV4p/4jNeB3 EuRxuQ4iaA4WDIuOuMkXsngZ2RIPYbRAnhF/ckdPXz0PIELOd73kAtNKMQ91f+cXW5nP AKE/999Q5UsKtgeWirWNIRovpjhZoVFpItuNtwCEPeK72vafT6EXJz7q0HkJlXQK9nzm ynAQ== X-Gm-Message-State: AOAM531wjOXK8nDdqMrAAGaTYUMunAGbDqD/yhywgoMSZhjZwZ6u3VFn uIxc21FcVuD5FKqFd7/fTW5YWLZbq3jyE9Zi0hoGsO3lGr/eKjxGdEeM8Hc5jT2m74M2l3rHuLW xcDup5kJ6MgQ6HtyDM4VhLisAsQ== X-Received: by 2002:a05:6402:4405:: with SMTP id y5mr8374677eda.179.1641985298941; Wed, 12 Jan 2022 03:01:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWWf+6A4h9fD+VcApry/1ctZSaWE5x9A2DNgQ1rynCwOFlVNP1wLYNq0HbTcp/3NUGR7KzoA== X-Received: by 2002:a05:6402:4405:: with SMTP id y5mr8374660eda.179.1641985298747; Wed, 12 Jan 2022 03:01:38 -0800 (PST) Received: from ?IPV6:2003:cb:c702:4700:e25f:39eb:3cb8:1dec? (p200300cbc7024700e25f39eb3cb81dec.dip0.t-ipconnect.de. [2003:cb:c702:4700:e25f:39eb:3cb8:1dec]) by smtp.gmail.com with ESMTPSA id 13sm4394200ejh.225.2022.01.12.03.01.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Jan 2022 03:01:38 -0800 (PST) Message-ID: Date: Wed, 12 Jan 2022 12:01:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [RFC PATCH v3 2/8] mm: compaction: handle non-lru compound pages properly in isolate_migratepages_block(). To: Zi Yan , linux-mm@kvack.org References: <20220105214756.91065-1-zi.yan@sent.com> <20220105214756.91065-3-zi.yan@sent.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220105214756.91065-3-zi.yan@sent.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com 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-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mel Gorman , Robin Murphy , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Eric Ren , virtualization@lists.linux-foundation.org, linuxppc-dev@lists.ozlabs.org, Christoph Hellwig , Vlastimil Babka , Marek Szyprowski Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 05.01.22 22:47, Zi Yan wrote: > From: Zi Yan > > In isolate_migratepages_block(), a !PageLRU tail page can be encountered > when the page is larger than a pageblock. Use compound head page for the > checks inside and skip the entire compound page when isolation succeeds. > This will currently never happen, due to the way we always isolate MAX_ORDER -1 ranges, correct? Better note that in the patch description, because currently it reads like it's an actual fix "can be encountered". > Signed-off-by: Zi Yan > --- > mm/compaction.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/mm/compaction.c b/mm/compaction.c > index b4e94cda3019..ad9053fbbe06 100644 > --- a/mm/compaction.c > +++ b/mm/compaction.c > @@ -979,19 +979,23 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, > * Skip any other type of page > */ > if (!PageLRU(page)) { > + struct page *head = compound_head(page); > /* > * __PageMovable can return false positive so we need > * to verify it under page_lock. > */ > - if (unlikely(__PageMovable(page)) && > - !PageIsolated(page)) { > + if (unlikely(__PageMovable(head)) && > + !PageIsolated(head)) { > if (locked) { > unlock_page_lruvec_irqrestore(locked, flags); > locked = NULL; > } > > - if (!isolate_movable_page(page, isolate_mode)) > + if (!isolate_movable_page(head, isolate_mode)) { > + low_pfn += (1 << compound_order(head)) - 1 - (page - head); > + page = head; > goto isolate_success; > + } > } > > goto isolate_fail; -- Thanks, David / dhildenb