Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp875864rwl; Wed, 12 Apr 2023 05:30:14 -0700 (PDT) X-Google-Smtp-Source: AKy350YEVXPv6Dc7uIuFu2p5lK0dM3cViXitJL4dha+N+7wVzadcKjS+fXYIZdwYk9kZ6vRQGqP+ X-Received: by 2002:a17:90b:4a41:b0:234:e0c:caaa with SMTP id lb1-20020a17090b4a4100b002340e0ccaaamr8508644pjb.6.1681302613716; Wed, 12 Apr 2023 05:30:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681302613; cv=none; d=google.com; s=arc-20160816; b=giUmo6tstEdYJi215Fqb8mJ1SbTwQFwnP43eUb3oCnj5QQSl03dW62N7ehVPnDzIez aeRtHc0+vZ5UsTlL2Ui1Y2r1/l9eqrfyEAHbUKKM5a+WDz0E4oS0+NSa/+BtnQqs3ZLk tR3jNvl2s3bLguK1Eq4Sx8I8H12oT4GffpoB3dSMmlCo1le2T7jpgmaDKMn13IQl6Jd0 U8Xs/n9ajrKXv1P+2iXfp5p6mGfOSMSjzlQTlm5ubynok5kj2xSANLABZ6tW3jVBEmeV TUHRfnWpd/2UMGKiT3SHCEk6UHLMoEs3YJVNQ46uhu81zIOKEMJpEzYjU4qQHpFvWQKf /tYw== 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:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=7j6i+Z3UOEBQtYEhKGXZ7Sclg2wmibYdlf7+SalYn18=; b=DPZ4sQXszyo7PbeznTmj1mogrK3S9hjW9yYrE5nlWrt7ZbJ8YgzhLra5rk5+Rer/FD uODgt1sKJZBhlawolstW9TeHLSVMX/vUOnPh6YKnyq0pNPi+AatxsmsOs1Q0FbOCiGNC khS3sOhDiqEt1xTR9CW6Yq1UAfmBbEauRTXrIzkVPROyx2QTTSbO8Uj8JRe6fS3+f2EK xmvjRjtd2AgbNh0rg4PXHh01OB1tqhutP/YdoCE90hGDJfJwYoWMlPE1eEyN/NfW99bn fZl5xPlforxOmjvl9rkV94XztlyuBWQLDCDgO4tJ8wtKAL1AjQxmDnYGxdi9HQ2eEy3T BLOA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z9-20020a17090a1fc900b0023409b3983fsi1888382pjz.99.2023.04.12.05.30.01; Wed, 12 Apr 2023 05:30:13 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230116AbjDLMYW (ORCPT + 99 others); Wed, 12 Apr 2023 08:24:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229769AbjDLMYU (ORCPT ); Wed, 12 Apr 2023 08:24:20 -0400 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6593B76B4 for ; Wed, 12 Apr 2023 05:24:07 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R261e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VfwS.8H_1681302242; Received: from 30.97.48.75(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VfwS.8H_1681302242) by smtp.aliyun-inc.com; Wed, 12 Apr 2023 20:24:04 +0800 Message-ID: Date: Wed, 12 Apr 2023 20:24:07 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH] mm/page_alloc: consider pfn holes after pfn_valid() in __pageblock_pfn_to_page() To: Michal Hocko Cc: akpm@linux-foundation.org, mgorman@techsingularity.net, vbabka@suse.cz, david@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <62e231a8f2e50c04dcadc7a0cfaa6dea5ce1ec05.1681296022.git.baolin.wang@linux.alibaba.com> From: Baolin Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/12/2023 7:15 PM, Michal Hocko wrote: > On Wed 12-04-23 18:45:31, Baolin Wang wrote: >> Now the __pageblock_pfn_to_page() is used by set_zone_contiguous(), >> which checks whether the given zone contains holes, and uses pfn_valid() >> to check if the end pfn is valid. However pfn_valid() can not make sure >> the end pfn is not a hole if the size of a pageblock is larger than the >> size of a sub-mem_section, since the struct page getting by pfn_to_page() >> may represent a hole or an unusable page frame, which may cause incorrect >> zone contiguous is set. >> >> Though another user of pageblock_pfn_to_page() in compaction seems work >> well now, it is better to avoid scanning or touching these offline pfns. >> So like commit 2d070eab2e82 ("mm: consider zone which is not fully >> populated to have holes"), we should also use pfn_to_online_page() for >> the end pfn to make sure it is a valid pfn with usable page frame. >> Meanwhile the pfn_valid() for end pfn can be dropped now. >> >> Moreover we've already used pfn_to_online_page() for start pfn to make >> sure it is online and valid, so the pfn_valid() for the start pfn is >> unnecessary, drop it. > > Is this a theoretical problem or something you have encountered on a > real machine? Could you provide more details please? As I replied to David, this is just from code inspection when trying to remove the unnecessary pfn_valid() in __pageblock_pfn_to_page().