Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4552831pxj; Tue, 8 Jun 2021 17:48:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVMFZgysYm6SaZu4oHK4tX77DOjFrfoRcPo3GbF6v/3gQl7S1f1AlbRUcfzxjbuIU/7VIi X-Received: by 2002:a17:906:b048:: with SMTP id bj8mr26205065ejb.236.1623199681429; Tue, 08 Jun 2021 17:48:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623199681; cv=none; d=google.com; s=arc-20160816; b=OPTl/Whp3iOCsBLocxtgXlER8zGMMNJMA0nxM+jlq4cdIK3t/7wygzIiz8bILBJHqb Y4CX9qkEKBRdCYAzD+eL1+uxPxBbkCpwdv5MkwTRnJvwdSt54X9imm3D3yGvyiDS/6FO cvqC9u8X80/y3xNrK+HRhsksCMZb0pt+srSkXJ7twHwd5e15dnxcUktHfAXh3DlmpQLD bjlRSuFFonfl+NwiF0tD7iuNNcgriiWj8HbcaepcyKozzbgUl0USYWhR8OwSEHr9RfHm YBp4POxnAdQ+kSDgKTV0+WEyUfSoveing9dRKwAGCMEW9JFuYb0bHSMOncp2dPIOs89U GQAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=K5mHEd2JnKwWQyy7Omdj3hQ9Z1RB9FnpaKiTcfs2ZjU=; b=i5alar68WCMRqFJu1fe7fx4nW1r407pLBF8kbnYBSKqRnc9jHwH91AeER2ukIejWAw u13pFKOJQ2NRiYajRy/V2cRdEbojKjkqbMiaQsnaRO4vGzaYvooHjPg2NCnx2dbNkcAI mO4bRpy8eV3Uei47jou+kbTlrhJq6GycMie5zsgjNyYbvaUCDrD/lifgNfFwKCrCIYI3 1llEIUCAB4PBitIwIvdBESZmKK7Fh/r0dmIPUPQQMhbcot6VcvgBcC7LTFqV2be2R5VF PN8sQB4wXzBZT2WQmLfjaznOx/dtCXK9n2DY/srELzP5A2PGZgX4j4YGmxzcVz4lC7Qt OI9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=qaYxKhnt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i11si1309051edb.418.2021.06.08.17.47.38; Tue, 08 Jun 2021 17:48:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=qaYxKhnt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231266AbhFHLN6 (ORCPT + 99 others); Tue, 8 Jun 2021 07:13:58 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:38343 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230190AbhFHLN5 (ORCPT ); Tue, 8 Jun 2021 07:13:57 -0400 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4Fznct061wz9sW7; Tue, 8 Jun 2021 21:11:57 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1623150723; bh=h1pjcx14WED8GV61yyvX+o5nh/QO2vDigglGzaBUaPo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=qaYxKhntxn9domJfTp/b7vZheGgvSG04qAi3oPZszcrG9xJ8L8BtLeFBDdkNbhfRZ X8AJHokX7Us9uk+OIikdyp8VwCVfcmpt0jHbXBsbfQ+HEwfgLRBxW3k7uXH4jT5QAg 8xQpuppzCCGEv/fkG3Q1MEqEdqwDa3GgrXCwBwQ3bGGeK2M1OuWRxuc0qtkEr1keBz fDJQZ6qLeVUxjcpDY8AtdZZU3JvH1MC5Y3w/lLqHwiFCGx13AS18HU2Ir33OkNpg2k 8GyFRxa0K5NYJybxWne97z3ZMcKKDCCW4J0WeaoO69Q+XrReDs4uvXduZSTclQX4ku hnEBus8PGkG1w== From: Michael Ellerman To: David Hildenbrand , linux-kernel@vger.kernel.org Cc: David Hildenbrand , Andrew Morton , Vitaly Kuznetsov , "Michael S. Tsirkin" , Jason Wang , Marek Kedzierski , Hui Zhu , Pankaj Gupta , Wei Yang , Oscar Salvador , Michal Hocko , Dan Williams , Anshuman Khandual , Dave Hansen , Vlastimil Babka , Mike Rapoport , "Rafael J. Wysocki" , Len Brown , Pavel Tatashin , virtualization@lists.linux-foundation.org, linux-mm@kvack.org, linux-acpi@vger.kernel.org, Benjamin Herrenschmidt , Paul Mackerras , Vishal Verma , Dave Jiang , Nathan Lynch , Laurent Dufour , "Aneesh Kumar K.V" , Scott Cheloha , Anton Blanchard , linuxppc-dev@lists.ozlabs.org, nvdimm@lists.linux.dev Subject: Re: [PATCH v1 05/12] mm/memory_hotplug: remove nid parameter from remove_memory() and friends In-Reply-To: <20210607195430.48228-6-david@redhat.com> References: <20210607195430.48228-1-david@redhat.com> <20210607195430.48228-6-david@redhat.com> Date: Tue, 08 Jun 2021 21:11:57 +1000 Message-ID: <87y2bkehky.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org David Hildenbrand writes: > There is only a single user remaining. We can simply try to offline all > online nodes - which is fast, because we usually span pages and can skip > such nodes right away. That makes me slightly nervous, because our big powerpc boxes tend to trip on these scaling issues before others. But the spanned pages check is just: void try_offline_node(int nid) { pg_data_t *pgdat = NODE_DATA(nid); ... if (pgdat->node_spanned_pages) return; So I guess that's pretty cheap, and it's only O(nodes), which should never get that big. > Cc: Michael Ellerman > Cc: Benjamin Herrenschmidt > Cc: Paul Mackerras > Cc: "Rafael J. Wysocki" > Cc: Len Brown > Cc: Dan Williams > Cc: Vishal Verma > Cc: Dave Jiang > Cc: "Michael S. Tsirkin" > Cc: Jason Wang > Cc: Andrew Morton > Cc: Nathan Lynch > Cc: Laurent Dufour > Cc: "Aneesh Kumar K.V" > Cc: Scott Cheloha > Cc: Anton Blanchard > Cc: linuxppc-dev@lists.ozlabs.org > Cc: linux-acpi@vger.kernel.org > Cc: nvdimm@lists.linux.dev > Signed-off-by: David Hildenbrand > --- > .../platforms/pseries/hotplug-memory.c | 9 ++++----- > drivers/acpi/acpi_memhotplug.c | 7 +------ > drivers/dax/kmem.c | 3 +-- > drivers/virtio/virtio_mem.c | 4 ++-- > include/linux/memory_hotplug.h | 10 +++++----- > mm/memory_hotplug.c | 20 +++++++++---------- > 6 files changed, 23 insertions(+), 30 deletions(-) > > diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c > index 8377f1f7c78e..4a9232ddbefe 100644 > --- a/arch/powerpc/platforms/pseries/hotplug-memory.c > +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c > @@ -286,7 +286,7 @@ static int pseries_remove_memblock(unsigned long base, unsigned long memblock_si > { > unsigned long block_sz, start_pfn; > int sections_per_block; > - int i, nid; > + int i; > > start_pfn = base >> PAGE_SHIFT; > > @@ -297,10 +297,9 @@ static int pseries_remove_memblock(unsigned long base, unsigned long memblock_si > > block_sz = pseries_memory_block_size(); > sections_per_block = block_sz / MIN_MEMORY_BLOCK_SIZE; > - nid = memory_add_physaddr_to_nid(base); > > for (i = 0; i < sections_per_block; i++) { > - __remove_memory(nid, base, MIN_MEMORY_BLOCK_SIZE); > + __remove_memory(base, MIN_MEMORY_BLOCK_SIZE); > base += MIN_MEMORY_BLOCK_SIZE; > } > > @@ -386,7 +385,7 @@ static int dlpar_remove_lmb(struct drmem_lmb *lmb) > > block_sz = pseries_memory_block_size(); > > - __remove_memory(mem_block->nid, lmb->base_addr, block_sz); > + __remove_memory(lmb->base_addr, block_sz); > put_device(&mem_block->dev); > > /* Update memory regions for memory remove */ > @@ -638,7 +637,7 @@ static int dlpar_add_lmb(struct drmem_lmb *lmb) > > rc = dlpar_online_lmb(lmb); > if (rc) { > - __remove_memory(nid, lmb->base_addr, block_sz); > + __remove_memory(lmb->base_addr, block_sz); > invalidate_lmb_associativity_index(lmb); > } else { > lmb->flags |= DRCONF_MEM_ASSIGNED; Acked-by: Michael Ellerman (powerpc) cheers