Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4276844pxb; Mon, 27 Sep 2021 13:17:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRB0Y7bFGYqgJ3zF2MX+mxm5PPVvf8C2dF+Iaa/bvStnRzMt6Qwu0vFhOc2q4LtG8bJIBQ X-Received: by 2002:a17:90a:928e:: with SMTP id n14mr1044783pjo.57.1632773822554; Mon, 27 Sep 2021 13:17:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632773822; cv=none; d=google.com; s=arc-20160816; b=Ht/ZlUj5R9Ehp4UXVPV5nJJZ6Js6I2o9bFv9qv2wPZtUw81dRperSc8rxbkcq5nmZS hTVpMYnl/6wsXkIMdx7H++8d8HmIIHN96iouSroU8RcewHTxDyXexReee1c3kpcJKjs8 lTlJ4dHa4J0ziFjKa+tg4H1TwJRnGlHQerT28tETc8C9lkCZ/DDZfkZjLvo66Lj8nB6z pR10eJ2pP+EM+qWwgbMt5jMOWpiR7C9Qhh/UVBFir3x8oNwvmrKGDew4gJ1mHYfE2Sm7 3EHPHB5rRFElNiU2vzyYKhcsS/IIrLSVFQ3ShXv7j2W0R2ZE/ucbbSCYu/G08/oUbwTF 3kvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=bvHg/uBwvsvNY/OXqNLlISNWOe/HagnQIQssDsWD3dA=; b=0HMOT1u2cadvH3uJLNL5WB4tyIk9vnlB2oaCo2I3xdA+2Ild0Hbta+IDdTmj/+rIkT c/QtNqERx22jiL0XvLEJnFLKpASLH+Ce4MbCz6Gb5V4seyHz0Y0zsHrC7q0y4+RsV98W Da4cRASeb/PLnEW1HzRt/wCAT0yp6PAq6qw9iNjAtMWqD9Jop12Al8Pg+O7Lo3kths8P RzwopF0vUBNMsx2hwihyPcADOFBEzqp1hXHlaGOKSZ5RF4yGbWHL/JDj8j+2JHTlNWAH bdirSJQwQyKVVYGtP8Uk5UXoMCd/KgKIL6Lt9+7C2izkuyZl5U4YCbSbfD6o6GSHAyd/ TSvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eP062b5m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 129si22273792pfy.191.2021.09.27.13.16.47; Mon, 27 Sep 2021 13:17:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eP062b5m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S236946AbhI0UQH (ORCPT + 99 others); Mon, 27 Sep 2021 16:16:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:35959 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236763AbhI0UQG (ORCPT ); Mon, 27 Sep 2021 16:16:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632773668; 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=bvHg/uBwvsvNY/OXqNLlISNWOe/HagnQIQssDsWD3dA=; b=eP062b5mhij72Si8HOUBM9YnUPhiFEqkb3Ae5lpg9zxf5J4zHpw1pxe6OEFruSD2Snqnom 72KoxECycuVu/6Ojl7KqpSrCqQUYOEzZe0gm9E4zDjZO/X6jPCJoX+Ej6dc2HwmOmR1780 cqY1pPi+veBemHjD76bSdjIuquJI4Mg= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-134-OdCvNAmUNNOUree_qELf7w-1; Mon, 27 Sep 2021 16:14:27 -0400 X-MC-Unique: OdCvNAmUNNOUree_qELf7w-1 Received: by mail-wm1-f71.google.com with SMTP id l42-20020a05600c1d2a00b0030d02f09530so355735wms.0 for ; Mon, 27 Sep 2021 13:14:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=bvHg/uBwvsvNY/OXqNLlISNWOe/HagnQIQssDsWD3dA=; b=KHuM/eg2Lj+albuZ8WmHQ1VaHWgK1JbtGIDq5YeSESU1Q2N6C2QtX6Fd6ueHY2sqjV EZyXZ6SHamcqKIrtIYiDFpBNBKx532v609jUVCovIEUuhfN+cP10wSEiHpHPvUWmBygu eIt77FZ+QPHfdWR1H4yzZBlLaEG7NkoOXOY38FLdto/X1lGjBZ86Q8Clm7/m20Ae50Xe Q63RiiuUmv2mlrsSyrfV77rzb/Nqv+TGHl43RL4oebssz6UHljgiN2kouR2Bnok4Zxqw iSJtCp42La69QA26Sa5BGfIH6xZwI9Nf7tN5WQMl4UlZar9MmliK+tE9yHL73DiPGiam dvvA== X-Gm-Message-State: AOAM530nKZx5jyXSZvFpm73iUAdaVhAOg9GIpRGWOZLt2iqZxXT720jj sT+MO1v8dovqqni6I1f6H4xfsG4CcyZFQexBYtYES3RX9C4lc5/XscoS/KclWVdiEAhQ1XkeFhZ Gnolny5L6Bj8/P236ASWAH4Xf X-Received: by 2002:a05:6000:1a89:: with SMTP id f9mr2082666wry.19.1632773665902; Mon, 27 Sep 2021 13:14:25 -0700 (PDT) X-Received: by 2002:a05:6000:1a89:: with SMTP id f9mr2082654wry.19.1632773665760; Mon, 27 Sep 2021 13:14:25 -0700 (PDT) Received: from [192.168.3.132] (p5b0c654d.dip0.t-ipconnect.de. [91.12.101.77]) by smtp.gmail.com with ESMTPSA id s13sm472595wmc.47.2021.09.27.13.14.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Sep 2021 13:14:25 -0700 (PDT) Subject: Re: [RFC] arm64: mm: update max_pfn after memory hotplug To: Georgi Djakov , Chris Goldsworthy , Catalin Marinas , Will Deacon , Andrew Morton Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sudarshan Rajagopalan References: <595d09279824faf1f54961cef52b745609b05d97.1632437225.git.quic_cgoldswo@quicinc.com> <4f4f6e93-ddc2-c9bb-ef47-4a40f2c3d0d7@quicinc.com> <1b9c4377-0a6b-b7d4-7a6b-a69f9469bb70@redhat.com> From: David Hildenbrand Organization: Red Hat Message-ID: Date: Mon, 27 Sep 2021 22:14:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27.09.21 22:00, Georgi Djakov wrote: > On 9/27/2021 8:34 PM, David Hildenbrand wrote: >> On 27.09.21 19:22, Georgi Djakov wrote: >>> On 9/24/2021 1:54 AM, Chris Goldsworthy wrote: >>>> From: Sudarshan Rajagopalan >>>> >>>> After new memory blocks have been hotplugged, max_pfn and max_low_pfn >>>> needs updating to reflect on new PFNs being hot added to system. >>>> >>>> Signed-off-by: Sudarshan Rajagopalan >>>> Signed-off-by: Chris Goldsworthy >>> >>> Thanks for the patch, Chris! >>> >>> With this patch, the data in /proc/kpageflags appears to be correct and >>> memory tools like procrank work again on arm64 platforms. >>> >>> Tested-by: Georgi Djakov >>> >>> Maybe we should add fixes tag, as it has been broken since the following >>> commit: >>> Fixes: abec749facff ("fs/proc/page.c: allow inspection of last section >>> and fix end detection") >> >> Are you sure that that commit broke it? > > Reverting the above commit also "fixes" kpageflags, otherwise > kpageflags_read() returns 0 in the following check: > if (src >= max_dump_pfn * KPMSIZE) > return 0; > >> I recall that we would naturally run into the limit, because >> >> count = min_t(size_t, count, (max_pfn * KPMSIZE) - src); > > The function returns before we reach this line. That is the old code. I don't see how the behavior of the old code with wrong max_pfn was doing what it's supposed to do. page_idle and page_owner also rely on max_pfn. The root issue is that max_pfn wasn't updated properly. -- Thanks, David / dhildenb