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 X-Spam-Level: X-Spam-Status: No, score=-7.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA3EFC433E0 for ; Mon, 1 Feb 2021 14:55:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 363FB64E9A for ; Mon, 1 Feb 2021 14:55:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 363FB64E9A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 761516B0078; Mon, 1 Feb 2021 09:55:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 712956B007D; Mon, 1 Feb 2021 09:55:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 58C696B0083; Mon, 1 Feb 2021 09:55:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0164.hostedemail.com [216.40.44.164]) by kanga.kvack.org (Postfix) with ESMTP id 3F08F6B0078 for ; Mon, 1 Feb 2021 09:55:48 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id EF6C2824999B for ; Mon, 1 Feb 2021 14:55:47 +0000 (UTC) X-FDA: 77769998334.16.fog87_490f85e275c3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id B16E2100E691B for ; Mon, 1 Feb 2021 14:55:47 +0000 (UTC) X-HE-Tag: fog87_490f85e275c3 X-Filterd-Recvd-Size: 4334 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Mon, 1 Feb 2021 14:55:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612191346; 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: in-reply-to:in-reply-to:references:references; bh=qJNG6049dtvcplJRxISBTNlmlRDAp6ZgnUx5xKnhzAM=; b=WCQoSMoLanOajBfwQ3oX9+hQzM6kO5eibc75O2Lnz8w5YSNVB4xqNds/phqfpMDU/kMlp9 dvh/MOmFdjrPUz6+s+xuHHICLaxWjjiLrIZr3XW1KZm5XquLMXywrQdAqf72q2BEMmtpgg 0SL+gzggOMKQreTc7So9UsffqIftBRk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-286-g-eMEYKTNbGeF6HKF5rRQg-1; Mon, 01 Feb 2021 09:55:42 -0500 X-MC-Unique: g-eMEYKTNbGeF6HKF5rRQg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4B32F802B47; Mon, 1 Feb 2021 14:55:40 +0000 (UTC) Received: from localhost (ovpn-12-141.pek2.redhat.com [10.72.12.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 41ABC6F7E9; Mon, 1 Feb 2021 14:55:36 +0000 (UTC) Date: Mon, 1 Feb 2021 22:55:34 +0800 From: Baoquan He To: Mike Rapoport Cc: David Hildenbrand , Andrew Morton , Andrea Arcangeli , Borislav Petkov , Chris Wilson , "H. Peter Anvin" , Ingo Molnar , Linus Torvalds , =?utf-8?Q?=C5=81ukasz?= Majczak , Mel Gorman , Michal Hocko , Mike Rapoport , Qian Cai , "Sarvela, Tomi P" , Thomas Gleixner , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH v4 1/2] x86/setup: always add the beginning of RAM as memblock.memory Message-ID: <20210201145534.GA9009@MiWiFi-R3L-srv> References: <20210130221035.4169-1-rppt@kernel.org> <20210130221035.4169-2-rppt@kernel.org> <56e2c568-b121-8860-a6b0-274ace46d835@redhat.com> <20210201112605.GA2357@MiWiFi-R3L-srv> <20210201143429.GJ242749@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210201143429.GJ242749@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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/01/21 at 04:34pm, Mike Rapoport wrote: > On Mon, Feb 01, 2021 at 07:26:05PM +0800, Baoquan He wrote: > > On 02/01/21 at 10:32am, David Hildenbrand wrote: > > > > > > 2) In init_zone_unavailable_mem(), similar to round_up(max_pfn, > > > PAGES_PER_SECTION) handling, consider range > > > [round_down(min_pfn, PAGES_PER_SECTION), min_pfn - 1] > > > which would handle in the x86-64 case [0..0] and, therefore, initialize PFN > > > 0. > > > > Sounds reasonable. Maybe we can change to get the real expected lowest > > pfn from find_min_pfn_for_node() by iterating memblock.memory and > > memblock.reserved and comparing. > > As I've found out the hard way [1], reserved memory is not necessary present. > > There could be a system that instead of reserving memory at 0xfe000000 like > in Guillaume's report, could have it reserved at 0x0 and populated only > from the first gigabyte... OK. I thought that we can even compare memblock.memory.regions[0].base with memblock.reserved.regions[0].base and take the smaller one as the lowest pfn and assign it to arch_zone_lowest_possible_pfn[0]. When we try to get the present pages, we still check memblock.memory with for_each_mem_pfn_range(). Since we will consider and take reserved memory into zone anyway, arch_zone_lowest_possible_pfn[] only impact the boundary of zone. Just rough thought, please ignore it if something is missed. Thanks Baoquan