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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3924C433F5 for ; Wed, 16 Feb 2022 13:47:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3069B6B0071; Wed, 16 Feb 2022 08:47:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B6036B0073; Wed, 16 Feb 2022 08:47:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 156996B0074; Wed, 16 Feb 2022 08:47:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0114.hostedemail.com [216.40.44.114]) by kanga.kvack.org (Postfix) with ESMTP id 002946B0071 for ; Wed, 16 Feb 2022 08:47:03 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id ADAB386E62 for ; Wed, 16 Feb 2022 13:47:03 +0000 (UTC) X-FDA: 79148769126.24.F86E89B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf05.hostedemail.com (Postfix) with ESMTP id 1AFF210000F for ; Wed, 16 Feb 2022 13:47:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645019222; 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=/viJHST1z9zD64KMBaMBA5BOjVQloi17QEdRKdLQtOY=; b=fIp/PYhBfPTjoEcG+mgDUi+Y3QU+b3qHwKRQePMy4pKcbmiTzlUdYx8sahdVWhg43WeFMq seRz+Wl3Jv6rAAlDOag+s1Jj3AkaPA7xTFBvSkXa4zk7EFzM/WNihK4Swqt254l3jjfgl4 t+1UVyAJFtI8IZeSLNgqnnAL5sgl1OU= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-608-9ecmqPl8ONGTetGfzIieAQ-1; Wed, 16 Feb 2022 08:46:59 -0500 X-MC-Unique: 9ecmqPl8ONGTetGfzIieAQ-1 Received: by mail-wm1-f71.google.com with SMTP id r16-20020a05600c2c5000b0037bb20c50b8so475209wmg.3 for ; Wed, 16 Feb 2022 05:46:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=/viJHST1z9zD64KMBaMBA5BOjVQloi17QEdRKdLQtOY=; b=m1GbwZGDK3NKIat8ejQqiCkIr+41mG0khelOIl3teN8y7pe0hKeGf8uE2EJaRjsznv /LlXU4hM2ETvFCujPpOQLxe85QwBkxvjM+75PmKqMDo459dHUkVrCuJcYwxd+xr7fTas JUG29kN2mP85GmF6EOV/SkA6XJuDj+JS9MFUhfPs2QbBDEE32kjDoqc9dh7AYEAzpd9E hFD8Ofj6uYw+17+5M/cLjArYlATtPNqgvoUkY0dRIDDeDNtb3YstKEiaJzPhL+2TuxsS m5O3PjKhNHELkwExhpAVQwPrBauxJGoWP8Sn+t21/1SR8ibi51PH6jeijR57ivyeiFcc 3wyA== X-Gm-Message-State: AOAM531Jy163OOVFJ6iEVinTo7LuNR+X/ix9Sz1dzXi9X+7EpZf+NZPx 9tpNyspp/CabRjC53bK/7dwFZ64QthkF8JdOqv49vp0pBdi9Rj9jb5viZPPjiH6ac9GeQ7Uz6Xd R2er9TZ+L3JA= X-Received: by 2002:adf:b645:0:b0:1e3:bab:7594 with SMTP id i5-20020adfb645000000b001e30bab7594mr2431182wre.346.1645019218056; Wed, 16 Feb 2022 05:46:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXN+PGgiUh4jnY/IHW6kWYB+oyHZfFkJJcHP/ie9LhxwJ94HR5UHGasOFkSazLdIrHd1wXpw== X-Received: by 2002:adf:b645:0:b0:1e3:bab:7594 with SMTP id i5-20020adfb645000000b001e30bab7594mr2431161wre.346.1645019217772; Wed, 16 Feb 2022 05:46:57 -0800 (PST) Received: from ?IPV6:2003:cb:c70b:600:4ff7:25c:5aad:2711? (p200300cbc70b06004ff7025c5aad2711.dip0.t-ipconnect.de. [2003:cb:c70b:600:4ff7:25c:5aad:2711]) by smtp.gmail.com with ESMTPSA id l26sm18554970wms.24.2022.02.16.05.46.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Feb 2022 05:46:57 -0800 (PST) Message-ID: <9738c049-a6a2-19f7-f9be-e7ae98c2c66b@redhat.com> Date: Wed, 16 Feb 2022 14:46:56 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 To: osalvador Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , "Rafael J. Wysocki" , Greg Kroah-Hartman , Michal Hocko , Rafael Parra References: <20220210184359.235565-1-david@redhat.com> <20220210184359.235565-3-david@redhat.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v2 2/2] drivers/base/memory: determine and store zone for single-zone memory blocks In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 1AFF210000F X-Stat-Signature: 9cnm9gcejiph3f3pd4155twa3buggnjq Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="fIp/PYhB"; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf05.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-HE-Tag: 1645019222-986088 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: > Hi David > > Reviewed-by: Oscar Salvador > > One minor thing below: > >> @@ -663,6 +743,17 @@ static int init_memory_block(unsigned long block_id, unsigned long state, >> mem->nr_vmemmap_pages = nr_vmemmap_pages; >> INIT_LIST_HEAD(&mem->group_next); >> >> +#ifndef CONFIG_NUMA >> + if (state == MEM_ONLINE) >> + /* >> + * MEM_ONLINE at this point implies early memory. With NUMA, >> + * we'll determine the zone when setting the node id via >> + * memory_block_add_nid(). Memory hotplug updated the zone >> + * manually when memory onlining/offlining succeeds. >> + */ >> + mem->zone = early_node_zone_for_memory_block(mem, NUMA_NO_NODE); > > I took me a couple of minutes to figure out that MEM_ONLINE implies > early memory at this point because 1) of course early memory must be > online and 2) the only caller that passes MEM_ONLINE to > init_memory_block() is add_memory_block(), which only gets called at > boot time. (btw, add_memory_block() really should use __init, right?) > > I guess what I am saying here is: I really like the comment, but I am not sure > whether other people with a drifting brain like mine will also wonder about > that. Thanks for the review! I originally planned on passing "enum meminit_context context" here, but it just uglifies the function without any real added value. MEM_ONLINE is fully expressive. In general: a) Boot memory always starts out online. b) Hotplugged memory always starts out offline. And yes, add_memory_block() chould __init, that would also make it clearer out of which context init_memory_block() is called with MEM_ONLINE. I can send an addon patch for that! -- Thanks, David / dhildenb