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.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,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 B6A99C433B4 for ; Fri, 16 Apr 2021 08:32:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 653216115B for ; Fri, 16 Apr 2021 08:32:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 653216115B 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 EDCA86B0036; Fri, 16 Apr 2021 04:32:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E8CB26B0070; Fri, 16 Apr 2021 04:32:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D39AF6B0036; Fri, 16 Apr 2021 04:32:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id B80736B0036 for ; Fri, 16 Apr 2021 04:32:06 -0400 (EDT) Received: from smtpin40.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 817EF363C for ; Fri, 16 Apr 2021 08:32:06 +0000 (UTC) X-FDA: 78037562652.40.6C83EF7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf01.hostedemail.com (Postfix) with ESMTP id 22159500152E for ; Fri, 16 Apr 2021 08:32:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618561925; 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=PnvDMIypdcGLNbXmi4rAPqjfFVmEXq6bGxFDBf16NtQ=; b=a39YY3oaiz7raklx/6I/DMr7ImdZPzmsDVFo3AHS5lTnxtGVPoRXjJw5hBeUyW7rSiBRVd Kly4qBKdL1bEmEDPPbGrCmvfBeC36e/Y9/i8fcE5ZZERhy2kiK9zvrcj0YCVlWeNRWGPJg nbnlR3KY51XApmGehF7aPZSFWx4bGx0= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-328-Uol1t35kNUWVlrbN1q97GA-1; Fri, 16 Apr 2021 04:32:03 -0400 X-MC-Unique: Uol1t35kNUWVlrbN1q97GA-1 Received: by mail-ed1-f70.google.com with SMTP id l7-20020aa7c3070000b029038502ffe9f2so857682edq.16 for ; Fri, 16 Apr 2021 01:32:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; 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=PnvDMIypdcGLNbXmi4rAPqjfFVmEXq6bGxFDBf16NtQ=; b=UzKA+bGzgU2Z0bTnvuK0YWboaPeQWHtROBLFRqWu5jsT0VCJIN6SgvIGDS/QunHJBw s2PYxZEFjT+RdGS/s0fifWIOAzGdP9sZ19vGiaacTcpPnX6ZlefslBf7cXt+MjnOsx78 tBDKVQx6/dJQo6C1VCLjlD3CxnExc0nEWiWasiP0zyavMZ9QZIoEMgKghXSbngbkbPoa G0rd2mX4htleFFJ44P2oniNV3lYPP5NMY3gaxxEYg6Qu7VFBnsMWlcj7ttVdP+8dfogJ ta4ucOYfvioS1FOmyPtafEQkJ/2rncKQVpe5y1Lhc0/Ld1/8bAkMtXu0KnfBxl9A0Aaz /AOg== X-Gm-Message-State: AOAM5317kiK2q/WaoFWZZEpeVJ5LfFDVOUV498m7jRsaRlgVZZwgnGyk /y/7yMn5j3PCjymMzdVWDE4p+LVGdh1LJvVwl+mHCLaUxbV0Vo6TGKcjRzJ6SBueWLiUcpcvxBx IJDyJaKPXEnc= X-Received: by 2002:a17:906:4112:: with SMTP id j18mr7149230ejk.171.1618561922740; Fri, 16 Apr 2021 01:32:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbCEbHQ25q3nrM4jI9jnOBm6c3k/sea4Ew+V1cPdL0HilM1GqRLImZhT+YkjAYJzZb6U7aaQ== X-Received: by 2002:a17:906:4112:: with SMTP id j18mr7149220ejk.171.1618561922542; Fri, 16 Apr 2021 01:32:02 -0700 (PDT) Received: from [192.168.3.132] (p5b0c64fb.dip0.t-ipconnect.de. [91.12.100.251]) by smtp.gmail.com with ESMTPSA id s5sm3730829ejq.52.2021.04.16.01.32.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Apr 2021 01:32:02 -0700 (PDT) Subject: Re: [PATCH v7 4/8] mm,memory_hotplug: Allocate memmap from the added memory range To: Oscar Salvador Cc: Andrew Morton , Michal Hocko , Anshuman Khandual , Pavel Tatashin , Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20210408121804.10440-1-osalvador@suse.de> <20210408121804.10440-5-osalvador@suse.de> <54bed4d3-631f-7d30-aa2c-f8dd2f2c6804@redhat.com> From: David Hildenbrand Organization: Red Hat Message-ID: Date: Fri, 16 Apr 2021 10:32:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: 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-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Stat-Signature: xuawzt1hdanyfwwp5s6x8nz76a3b8jab X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 22159500152E Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf01; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=170.10.133.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1618561924-200664 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 16.04.21 09:25, Oscar Salvador wrote: > On Thu, Apr 15, 2021 at 01:19:59PM +0200, David Hildenbrand wrote: >>> Implementation wise we will reuse vmem_altmap infrastructure to override >>> the default allocator used by __populate_section_memmap. >>> Part of the implementation also relies on memory_block structure gaining >>> a new field which specifies the number of vmemmap_pages at the beginning. >>> This patch also introduces the following functions: >>> >>> - vmemmap_init_space: Initializes vmemmap pages by calling move_pfn_range_to_zone(), >>> calls kasan_add_zero_shadow() or the vmemmap range and marks >>> online as many sections as vmemmap pages fully span. >>> - vmemmap_adjust_pages: Accounts/substract vmemmap_pages to node and zone >>> present_pages >>> - vmemmap_deinit_space: Undoes what vmemmap_init_space does. >>> >> >> This is a bit asynchronous; and the function names are not really expressing what is being done :) I'll try to come up with better names below. > > Yeah, was not happy either with the names but at that time I could not > come up with anything better. > >> It is worth mentioning that the real "mess" is that we want offline_pages() to properly handle zone->present_pages going to 0. Therefore, we want to manually mess with the present page count. > > This should be explained by this: > > "On offline, memory_block_offline() calls vmemmap_adjust_pages() prior to calling > offline_pages(), because offline_pages() performs the tearing-down of kthreads > and the rebuilding of the zonelists if the node/zone become empty." > > Is not that clear? Ehm, it is; for some reason my eyes ignored it -- sorry. -- Thanks, David / dhildenb