Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp3106161lqo; Tue, 14 May 2024 22:41:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVDvOzzYBlkCg+7zdbMjKQoIsZ7dLA22jfpU2nGkBlYlhICiP+t2K+0AGlYwW/qpGDVdjaFGV5wiSfEDLTgrSP8qd+JwrVDKCaSK6alNQ== X-Google-Smtp-Source: AGHT+IFDg9mM8CBX2ME9LD3oF5XZYHOPLc238epWfRPcHAs7nhq5ll4NN3q2OTWC7E8BqrWa1yLW X-Received: by 2002:a17:906:37d6:b0:a55:9dec:355f with SMTP id a640c23a62f3a-a5a2d676774mr889349666b.70.1715751719319; Tue, 14 May 2024 22:41:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715751719; cv=pass; d=google.com; s=arc-20160816; b=Cs0rNqY0O0mGfE/Pcj3p0E9f/4++46/NB3AMVvpt/xCDpy0sH693xKee3J2vn28xBz O648yjHn9kMtRyFwNhMoCmZxVBQLuR+9uFXhshfzGmwNvEvfcIgdvsoDKCFF2Y6gU2XW l9Hk1CJdZmWxP+FED0NGoHu3e2EhNiCBidp07UyZQ4A7hYqOHgpTeKekszhVWDzGf60c QvvFelbTxD7XhGG01XpUuIaQupjsMj9iWi2W7qgkyzVe3FRpLs0eg97pzYowDIrEQ8VP 3kQzHDlN+VqHhlNJECpUAPzNvNLuv4Nji7MKY7Rhjqoa0Mi9/r7ML6P9goqJieRHWYSN JP8g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=TNKUNrV79q8bDm3/v/Z/EAKKmqJ57RDlAkQ14BHbbLA=; fh=LRfPxBk2OP+DAuo3YbunrPBRmYFxBo7eeB8ZJxeFdOY=; b=wCahw1gbBGIjSzctacEJVYAUp2KUEEinl3d7oSuYg3C6uRDzx2PvZWMro1KSGlueEU UqsF54t4Y1FC5G2DNKuV6/KF42Ha8yuEOTz/Llt3B/mNUTK/V+G4vpmIn3hyD5vo7NPH b360sQ7Itamj+BEfowoAO2OrZop0fd1yAYaxOUqlnjxdVnL+7eSUC9PN5cSaiy0qOVnb DK/HnT826Le16VzxNJ51d0pnz37F14s8Lq+rUzByZHm/yLDQ/emPLFUekjcMg1PLKstF 5zmw57puAcIAofLwPXkTXmHCpyJNzPyNcBwPN+pVIdt2k4ZxWvmyW9S3wlmWhIdPt94J CtlQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TUVIDYBV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-179465-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179465-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17b373dcsi727985066b.356.2024.05.14.22.41.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 22:41:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179465-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TUVIDYBV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-179465-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179465-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 158F61F21803 for ; Wed, 15 May 2024 05:41:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7FC463A1DC; Wed, 15 May 2024 05:41:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TUVIDYBV" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A391D26ACE for ; Wed, 15 May 2024 05:41:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715751711; cv=none; b=pA2D008wf1W5mKbsMlni3hzK6vQJoX+g1zdPFzxVMWPpdPTly0kPPnturrcVXMbMQ07NseICfNKUo4SSic7QXCCiU152ZB3LQKS61H06hsoSbJ3suP2hwwnlqxAymKrY+Yci+/PjHk81mN/yb7SyGTZb2F7FF1/Ja5ubDkrfWSE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715751711; c=relaxed/simple; bh=mmF1KeXBL7U8C83N3jzFBWR9OlDzinn1tPvhQxIcJoQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=AQ69orNUd7biuCMPNgfdYmyBHGgfpAwSR+cDPJDXUouNwiBwvDxG2ZAq+yDSyDfl8wd76xgLin3MQuRubsRUkUMHDAwkYYxg4MEM+vDZv6OkLtLPIN6x1NTHYBdhr6TkqOn8yFfn23Tj2K8GuEBDdax2uvWhGYMWiUOEhiRTl3o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TUVIDYBV; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5C70C116B1; Wed, 15 May 2024 05:41:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715751711; bh=mmF1KeXBL7U8C83N3jzFBWR9OlDzinn1tPvhQxIcJoQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=TUVIDYBV82kiQ+MFfP94+TJanOMTxDKNqpExsyY9WyUZ6gqtJJodG6QmXkZONJXu6 1aK0ScbFd5P7+OEvorRw1zak3jD3s7josaNFDIOSM+aAHbyC82x0oBfodS6bxHnsMy FPKE6S+7j/+G3Dq8AJw8dGiJaHb175oVUGu0KEjaFR+ZTgHymuInC4OSeDzGTmIKVE kc5kWNkFxUxTTMla+TmklOYF4jdwnWpSAE4BNWIi1Eg7XQX9dgykMF3lx348dpGUf3 91UIiOXPBMy79Wt/kYXkcI+Yx0xixEsVwhv5FjyfPazlBlTv79liNDyERSF+kyo5XH uo2vBxfXbfz/g== From: =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= To: Oscar Salvador Cc: Alexandre Ghiti , Albert Ou , David Hildenbrand , Palmer Dabbelt , Paul Walmsley , linux-riscv@lists.infradead.org, =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= , Andrew Bresticker , Chethan Seshadri , Lorenzo Stoakes , Santosh Mamila , Sivakumar Munnangi , Sunil V L , linux-kernel@vger.kernel.org, linux-mm@kvack.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v2 4/8] riscv: mm: Add memory hotplugging support In-Reply-To: References: <20240514140446.538622-1-bjorn@kernel.org> <20240514140446.538622-5-bjorn@kernel.org> Date: Wed, 15 May 2024 07:41:47 +0200 Message-ID: <87msork4x0.fsf@all.your.base.are.belong.to.us> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Oscar Salvador writes: > On Tue, May 14, 2024 at 04:04:42PM +0200, Bj=C3=B6rn T=C3=B6pel wrote: >> +static void __meminit free_vmemmap_storage(struct page *page, size_t si= ze, >> + struct vmem_altmap *altmap) >> +{ >> + if (altmap) >> + vmem_altmap_free(altmap, size >> PAGE_SHIFT); >> + else >> + free_pages((unsigned long)page_address(page), get_order(size)); > > David already pointed this out, but can check > arch/x86/mm/init_64.c:free_pagetable(). > > You will see that we have to do some magic for bootmem memory (DIMMs > which were not hotplugged but already present) Thank you! >> +#ifdef CONFIG_SPARSEMEM_VMEMMAP >> +void __ref vmemmap_free(unsigned long start, unsigned long end, struct = vmem_altmap *altmap) >> +{ >> + remove_pgd_mapping(start, end, true, altmap); >> +} >> +#endif /* CONFIG_SPARSEMEM_VMEMMAP */ >> +#endif /* CONFIG_MEMORY_HOTPLUG */ > > I will comment on the patch where you add support for hotplug and the > dependency, but on a track in LSFMM today, we decided that most likely > we will drop memory-hotplug support for !CONFIG_SPARSEMEM_VMEMMAP > environments. > So, since you are adding this plain fresh, please consider to tight the > hotplug dependency to CONFIG_SPARSEMEM_VMEMMAP. > As a bonus, you will only have to maintain one flavour of functions. Ah, yeah, I saw it mentioned on the LSF/MM/BPF topics. Less is definitely more -- I'll make the next version depend on SPARSEMEM_VMEMMAP. Bj=C3=B6rn