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=-5.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 DC2EDC433DB for ; Wed, 24 Mar 2021 14:06:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 74C1E619F9 for ; Wed, 24 Mar 2021 14:06:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74C1E619F9 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 A76EA6B02CE; Wed, 24 Mar 2021 10:06:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A27B36B02CF; Wed, 24 Mar 2021 10:06:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A2226B02D0; Wed, 24 Mar 2021 10:06:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0055.hostedemail.com [216.40.44.55]) by kanga.kvack.org (Postfix) with ESMTP id 721AF6B02CE for ; Wed, 24 Mar 2021 10:06:14 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 34E2B8249980 for ; Wed, 24 Mar 2021 14:06:14 +0000 (UTC) X-FDA: 77954942268.24.FC7793F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf13.hostedemail.com (Postfix) with ESMTP id 37B14E005F1C for ; Wed, 24 Mar 2021 14:06:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616594764; 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=yxKMGYIWB97pteYfLN/BCjD+zXG96m+SO6JR3kyE8DA=; b=XlzABvta1BEq3lD72MqALekembbvVHB3WZst8LvA2OcU6g7T0yEpU9GkP/Hma0mFmM7V9d AR9k+mrUlMNFREmCJ4UZiLho3GKKcz2wxC8Us23Nkt8dPaflmPKHTqCffIFy6Q8PaVdSyD +d9eLNlHEfZH34tB4TKqhWmgid75PuQ= 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-101-JCmqapBqNbWTEGUf43xqKA-1; Wed, 24 Mar 2021 10:05:59 -0400 X-MC-Unique: JCmqapBqNbWTEGUf43xqKA-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 1633480BCA6; Wed, 24 Mar 2021 14:05:58 +0000 (UTC) Received: from [10.36.115.66] (ovpn-115-66.ams2.redhat.com [10.36.115.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id 95CDF18A9E; Wed, 24 Mar 2021 14:05:55 +0000 (UTC) To: Michal Hocko Cc: Oscar Salvador , Andrew Morton , 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> <20210324101259.GB16560@linux> <32bc6e31-0200-1e8c-895c-3f60ed072fc2@redhat.com> From: David Hildenbrand Organization: Red Hat GmbH Subject: Re: [PATCH v5 1/5] mm,memory_hotplug: Allocate memmap from the added memory range Message-ID: <0e58dce3-d68f-f8cb-936e-c7ae49c1eeaa@redhat.com> Date: Wed, 24 Mar 2021 15:05:54 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 37B14E005F1C X-Stat-Signature: tup3cyfd9kpfyyre8u4bdd3n9edmyd4a Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf13; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=216.205.24.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616594770-995712 Content-Transfer-Encoding: quoted-printable 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 24.03.21 14:40, Michal Hocko wrote: > On Wed 24-03-21 14:13:31, David Hildenbrand wrote: >> On 24.03.21 13:37, Michal Hocko wrote: >>> On Wed 24-03-21 13:23:47, David Hildenbrand wrote: >>>> On 24.03.21 13:10, Michal Hocko wrote: >>>>> On Wed 24-03-21 13:03:29, Michal Hocko wrote: >>>>>> On Wed 24-03-21 11:12:59, Oscar Salvador wrote: >>>>> [...] >>>>> >>>>> an additional remark >>>>> >>>>>>> - online_pages()->move_pfn_range_to_zone(): Accounts for node/zon= e's spanned pages >>>>>>> - online_pages()->zone->present_pages +=3D nr_pages; >>>>> >>>>> I am pretty sure you shouldn't account vmmemmap pages to the target= zone >>>>> in some cases - e.g. vmemmap cannot be part of the movable zone, ca= n it? >>>>> So this would be yet another special casing. This patch has got it = wrong >>>>> unless I have missed some special casing. >>>>> >>>> >>>> It's a bit unfortunate that we have to discuss the very basic design >>>> decisions again. >>> >>> It would be great to have those basic design decisions layed out in t= he >>> changelog. >>> >>>> @Oscar, maybe you can share the links where we discussed all this an= d add >>>> some of it to the patch description. >>>> >>>> I think what we have right here is good enough for an initial versio= n, from >>>> where on we can improve things without having to modify calling code= . >>> >>> I have to say I really dislike vmemmap proliferation into >>> {on,off}lining. It just doesn't belong there from a layering POV. All >>> this code should care about is to hand over pages to the allocator an= d >>> make them visible. >> >> Well, someone has to initialize the vmemmap of the vmemmap pages ( whi= ch is >> itself :) ), >=20 > Yeah, and I would expect this to be done when the vmemmap space is > reserved. This is at the hotadd time and we do not know the zone but > that shouldn't really matter because their zone can be quite arbitrary > kernel zone. As mentioned previously I do not think associating those > with zone movable is a good idea as they are fundamentally not movable. I don't think that's an issue. Just another special case to keep things=20 simple. (and not completely fragment zones, mess with zone shrinking etc.= ) > It is likely that the zone doesn't really matter for these pages anyway > and the only think we do care about is that they are not poisoned and > there is at least something but again it would be much better to have a > single place where all those details are done (including accounting) > rather than trying to wrap head around different pfns when onlining > pages and grow potential and suble bugs there. Exactly, as you said, the zone doesn't really matter - thus, this patch=20 just handles it as simple as possible: keep them in the same zone as the=20 hole memory block. No fragmented zones. no special casing. simple. Details are actually pretty much all at a single place when=20 onlining/offlining(). >=20 >> and as the vemmap does not span complete sections things can >> get very weird as we can only set whole sections online (there was mor= e to >> that, I think it's buried in previous discussions). >=20 > Yes the section can only online as whole. This is an important "detail" > and it would deserve some more clarification in the changelog as well. Indeed. > You have invested quite some energy into code consolidation and checks > to make sure that hotplugged code doesn't have holes and this work bend= s > those rules. vmemmap is effectivelly a hole in a memblock/section. I > think we should re-evaluate some of those constrains rather than try to > work them around somehow. It's an offset in the beginning, so it's a special case. And the=20 question is if there is a real benefit in handling it differently, for=20 example, messing with online sections, messing with zones .. I am not=20 convinced that the added complexity gives us a real benefit. But I shall=20 be taught otherwise. BTW: I once thought about having=20 online_memory_block(block)/offline_memory_block(block) as separate=20 functions instead of having pretty generic (error prone?)=20 online_pages()/offline_pages(). Then, these details would just go in=20 there and memory blocks + online/offline logic would simply be=20 self-contained. --=20 Thanks, David / dhildenb