Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1530970rdb; Mon, 2 Oct 2023 12:26:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGnE6ZcAqny05fs+MZ+XD+k3MhKjSzpBX9SA2LSmID17BeORKsW/WSSDIYQxizXPP1xIf1w X-Received: by 2002:a05:6808:a10:b0:3a5:a78b:f773 with SMTP id n16-20020a0568080a1000b003a5a78bf773mr11135596oij.6.1696274781950; Mon, 02 Oct 2023 12:26:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696274781; cv=none; d=google.com; s=arc-20160816; b=NwZkbsy/4ieb6f1+ACW2nW57KJsQco8BJ7inAY6ZLVTs3eiwo5FJgOrRK6ZXboAqxj PB9OOfJ9cjU/m0DiqhHX97BkMo8MXPBNY4iWdj5T+rGmV3mq6Wcibc+Grsv/g0MveErc YUa4nXcrIW95oGJsue47P50OBTp1wQY5gbgbQg2ZaCO0j7bU67JHwA4M6m8E9BaGmHUE F/RdsADJIZRSa8+cR4ZobXwRxMOQmDTCS4UYd1z8zhpJW8uugpwDSnhTbh7SgjlgYB8o r53ZjZiPg3WjPh1sPdDH+OdqTyIenRRaSXxQ8na8mT1aS7PbnEcnfPdDRGRYS4UwZNCA Qp0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=AJJ/7KPwaOb8i7teRUVDmyTyd/EZIX0vx+LShsb9z+w=; fh=1y1w3Z2I2TvbAb3XHQdUPt2+yXy/gePQGCzeWbR7iKg=; b=BxlIkOPDD97S+FgbOQhYXb5qDyssvlzs31wTmNa4A9HDCsD0mlF3zk1DDBZ2uGLjOT +ToUesAPJEBMCgWZjQyNTHQzsFoTj46NnU6/zLVpQa1+zAPe8/WROgGRyK3b/fPrhoRL hFW/SzpeycbLOg7hy27vm/tYkqUDo2KmMj60wJIH7IKZjwh0x4QfPdbL3pUVcH2syj+7 NlXVhk/Du/nKQCs4ZuED165lvchqL7Te9x7lp8ifo3XKUg6Vyrbg9fOGzRCSZtGof8wI VFVHt86IGcQXKMvNBWbNdsPe5YK7HTaFI8I8hDM1s/akSkyp5ESGuab/hTyDVkPkX7Bp 6CkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=a+dSmxnG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id lr3-20020a17090b4b8300b00277630078f9si8995621pjb.12.2023.10.02.12.26.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 12:26:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=a+dSmxnG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 09543802419A; Mon, 2 Oct 2023 02:29:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236097AbjJBJ3f (ORCPT + 99 others); Mon, 2 Oct 2023 05:29:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236074AbjJBJ3e (ORCPT ); Mon, 2 Oct 2023 05:29:34 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63C9EA7 for ; Mon, 2 Oct 2023 02:28:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696238929; 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=AJJ/7KPwaOb8i7teRUVDmyTyd/EZIX0vx+LShsb9z+w=; b=a+dSmxnG21gSW3Ax1FZg4quhY5IOr7PANjy6SuHaAoJX9bk6TeWyU7wGRR2dlYMmmb6xen /aVRcig3zrBcyLGt0g6KwFVmPqWFcDnynEUvCNRj1kLQAX0KvOvKmZZapZEy3eTFjD/9E2 Xucs6FXIlcdi5uH4SRnuEM+b2XJwHMs= 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.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-29-3muGqdNxP6Gy4hdul09A2A-1; Mon, 02 Oct 2023 05:28:48 -0400 X-MC-Unique: 3muGqdNxP6Gy4hdul09A2A-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4065ca278b3so20452275e9.3 for ; Mon, 02 Oct 2023 02:28:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696238927; x=1696843727; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=AJJ/7KPwaOb8i7teRUVDmyTyd/EZIX0vx+LShsb9z+w=; b=Bt+t8Rv6OHYHAlTPL+8jeanWsvnhX0ybnYpHRxMqfL7hQ2IGZVqoY0GeYIltzazczu 2zBOrbdSrOKcYmTOooa5JeBU/WJeRCAEI3ywPvXxJmD/noRK8glTz97Gcb20+ba5/bMj aj019830yJqKxogUeM/rgmH+tWxOgl175jH7y39pcjRSV2G/bWFx87Uu1h9aa1/l0HT3 LhCqdfw6hrvz2BYC1/T5CuoeBAwexwB/4OgMCKJA+HUgixj+6pUROb1vzyWrddqd7ndv +d0xh4hQAvKI5Q6xL9lnJUAoim4/H+Z8OrATslgv/9Uvy2iQwh93iKT75WuwPidJQ4vq BVUQ== X-Gm-Message-State: AOJu0YxZuLuKoyzB0Ao/yuGjc8JF8m/8KkV2qR7z53g3OudJTaJwRNck xeZy9niHvMuUVgJSVwckmZkc08lF1lt8jdn0rngKXwTmMP6UaYobKTiHWCG4CnKi6juWxoZiKqS A2YNe4ttOPCcjEMTy+jBYQmi9 X-Received: by 2002:a7b:cbc8:0:b0:3ff:ca80:eda3 with SMTP id n8-20020a7bcbc8000000b003ffca80eda3mr8982374wmi.10.1696238927141; Mon, 02 Oct 2023 02:28:47 -0700 (PDT) X-Received: by 2002:a7b:cbc8:0:b0:3ff:ca80:eda3 with SMTP id n8-20020a7bcbc8000000b003ffca80eda3mr8982347wmi.10.1696238926766; Mon, 02 Oct 2023 02:28:46 -0700 (PDT) Received: from ?IPV6:2003:cb:c735:f200:cb49:cb8f:88fc:9446? (p200300cbc735f200cb49cb8f88fc9446.dip0.t-ipconnect.de. [2003:cb:c735:f200:cb49:cb8f:88fc:9446]) by smtp.gmail.com with ESMTPSA id j17-20020a05600c489100b003fc16ee2864sm6835636wmp.48.2023.10.02.02.28.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 Oct 2023 02:28:46 -0700 (PDT) Message-ID: Date: Mon, 2 Oct 2023 11:28:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v4 1/2] mm/memory_hotplug: split memmap_on_memory requests across memblocks Content-Language: en-US To: Vishal Verma , Andrew Morton , Oscar Salvador , Dan Williams , Dave Jiang Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, Huang Ying , Dave Hansen , "Aneesh Kumar K.V" , Michal Hocko , Jonathan Cameron , Jeff Moyer References: <20230928-vv-kmem_memmap-v4-0-6ff73fec519a@intel.com> <20230928-vv-kmem_memmap-v4-1-6ff73fec519a@intel.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20230928-vv-kmem_memmap-v4-1-6ff73fec519a@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 02 Oct 2023 02:29:41 -0700 (PDT) > + > +static int __ref try_remove_memory(u64 start, u64 size) > +{ > + int rc, nid = NUMA_NO_NODE; > + > + BUG_ON(check_hotplug_memory_range(start, size)); > + > + /* > + * All memory blocks must be offlined before removing memory. Check > + * whether all memory blocks in question are offline and return error > + * if this is not the case. > + * > + * While at it, determine the nid. Note that if we'd have mixed nodes, > + * we'd only try to offline the last determined one -- which is good > + * enough for the cases we care about. > + */ > + rc = walk_memory_blocks(start, size, &nid, check_memblock_offlined_cb); > + if (rc) > + return rc; > + > + /* > + * For memmap_on_memory, the altmaps could have been added on > + * a per-memblock basis. Loop through the entire range if so, > + * and remove each memblock and its altmap. > + */ > + if (mhp_memmap_on_memory()) { > + unsigned long memblock_size = memory_block_size_bytes(); > + u64 cur_start; > + > + for (cur_start = start; cur_start < start + size; > + cur_start += memblock_size) > + __try_remove_memory(nid, cur_start, memblock_size); > + } else { > + __try_remove_memory(nid, start, size); > + } > + > return 0; > } Why is the firmware, memblock and nid handling not kept in this outer function? We really shouldn't be doing per memory block what needs to be done per memblock: remove_memory_block_devices() and arch_remove_memory(). -- Cheers, David / dhildenb