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=-12.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham 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 6E246C433DB for ; Fri, 19 Mar 2021 10:20:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F388E64EEC for ; Fri, 19 Mar 2021 10:20:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F388E64EEC 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 873916B0074; Fri, 19 Mar 2021 06:20:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 823E86B0078; Fri, 19 Mar 2021 06:20:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C3F06B007B; Fri, 19 Mar 2021 06:20:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0137.hostedemail.com [216.40.44.137]) by kanga.kvack.org (Postfix) with ESMTP id 50A8D6B0074 for ; Fri, 19 Mar 2021 06:20:29 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 0D89D1E1E for ; Fri, 19 Mar 2021 10:20:29 +0000 (UTC) X-FDA: 77936229378.27.40E7F08 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf23.hostedemail.com (Postfix) with ESMTP id 676BDA0009DD for ; Fri, 19 Mar 2021 10:20:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616149227; 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=C8kAG0vAoEScN6HgfByPE/mJNj1/V2eSrzV6xD3nOfw=; b=T7HGYu8ZVim7okC5M7igAKfl449JcWaqcO9TqXFfqFJu5PQxm4isKG7D12ysRDFvxg0N1P N4MgqRUXKRwm0gbCrEoHEG8Q/kXCogrDb96dt3GopVRsXrPtvwPlqIxzubbgFnew2fEAX7 yQhoOSd7boi5A2vY1eu5zSEzchMFU6s= 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-524-Vi3UI16ZOkCtDWnXKUGS4w-1; Fri, 19 Mar 2021 06:20:23 -0400 X-MC-Unique: Vi3UI16ZOkCtDWnXKUGS4w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5BBA0108BD15; Fri, 19 Mar 2021 10:20:22 +0000 (UTC) Received: from [10.36.112.11] (ovpn-112-11.ams2.redhat.com [10.36.112.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87BCA5D9C6; Fri, 19 Mar 2021 10:20:20 +0000 (UTC) Subject: Re: [PATCH v5 1/5] mm,memory_hotplug: Allocate memmap from the added memory range To: Oscar Salvador , Andrew Morton Cc: Michal Hocko , Anshuman Khandual , Vlastimil Babka , Pavel Tatashin , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20210319092635.6214-1-osalvador@suse.de> <20210319092635.6214-2-osalvador@suse.de> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: Date: Fri, 19 Mar 2021 11:20:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <20210319092635.6214-2-osalvador@suse.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Stat-Signature: om96zemb3j334k4u4bqbys3auykmq4in X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 676BDA0009DD Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf23; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=63.128.21.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616149228-966543 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: Tow NITs > +bool mhp_supports_memmap_on_memory(unsigned long size) > +{ > + unsigned long nr_vmemmap_pages = size / PAGE_SIZE; > + unsigned long vmemmap_size = nr_vmemmap_pages * sizeof(struct page); > + unsigned long remaining_size = size - vmemmap_size; > + > + /* > + * Besides having arch support and the feature enabled at runtime, we > + * need a few more assumptions to hold true: > + * > + * a) We span a single memory block: memory onlining/offlinin;g happens s/offlinin;g/offlining;/ > + * in memory block granularity. We don't want the vmemmap of online > + * memory blocks to reside on offline memory blocks. In the future, > + * we might want to support variable-sized memory blocks to make the > + * feature more versatile. > + * > + * b) The vmemmap pages span complete PMDs: We don't want vmemmap code > + * to populate memory from the altmap for unrelated parts (i.e., > + * other memory blocks) > + * > + * c) The vmemmap pages (and thereby the pages that will be exposed to > + * the buddy) have to cover full pageblocks: memory onlining/offlining > + * code requires applicable ranges to be page-aligned, for example, to > + * set the migratetypes properly. > + * > + * TODO: Although we have a check here to make sure that vmemmap pages > + * fully populate a PMD, it is not the right place to check for > + * this. A much better solution involves improving vmemmap code > + * to fallback to base pages when trying to populate vmemmap using > + * altmap as an alternative source of memory, and we do not exactly > + * populate a single PMD. > + */ > + return memmap_on_memory && > + IS_ENABLED(CONFIG_MHP_MEMMAP_ON_MEMORY) && > + size == memory_block_size_bytes() && > + IS_ALIGNED(vmemmap_size, PMD_SIZE) && > + IS_ALIGNED(remaining_size, (pageblock_nr_pages << PAGE_SHIFT)); IS_ALIGNED(remaining_size, pageblock_nr_pages << PAGE_SHIFT); LGTM, thanks! (another pair of eyes certainly wouldn't hurt :) ) Reviewed-by: David Hildenbrand -- Thanks, David / dhildenb