From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta1.migadu.com (out-252.mta1.migadu.com [95.215.58.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 504413955C1 for ; Tue, 1 Sep 2026 03:05:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.252 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788231938; cv=none; b=LyJb2Iul2QwK96/mLqJxmLclklcoQdKrr1jfjU+YoUZHumrOF0Icfq5A1rWpF09eUPhu+eKG0D3RevfVHQcjKj6ADEAACtaTlxzDixkX0zo+ZO3/whUvEK/JUHbF09pUdJA3CrOtjxB47XkQ+wNXywW0qTGn7F/PybwCtyAsPqs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788231938; c=relaxed/simple; bh=om/9bGBfkYvM+IJmkkqUPDFd/PD2WvlDipw0cZRTGNE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=SdqQp7zxg0sP/uP7gpzBgXuuvLFZSHD7oF/yJKgKsyfcVOLxY4SgLyJo73GjN9sk9HBeAQvC5cxT65t+D6fKz2qhLiTqdOcafl3SKTCSi6PIXzyVmkhhPuE2bSd3Acw2x+JJ3RyWWV9xma9A/VAabLJ2ijQ1TLaFY34FYciFPHA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=RzCg2EyL; arc=none smtp.client-ip=95.215.58.252 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="RzCg2EyL" X-Envelope-To: linux-doc@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=om/9bGBfkYvM+IJmkkqUPDFd/PD2WvlDipw0cZRTGNE=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1788231935; v=1; x=1788836735; b=RzCg2EyLX+DLkWdT5WwAUtyG2TSekpBJmYi40rJg2sjLfJcqww9e3QBg8c5Cw8UhjU6CLPgO lwUTqHb3tHJPHRAzJKi7/uMXWZvcESuAZ0Fj2Mzkzgvg7xOHH3kOgikMZ6PfyRMGj8hB+4dSqhH Y3yyds94CFHfvZGaiiPNDRsU= X-Envelope-To: linux-doc@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 83324dd7b0a9859a; Tue, 01 Sep 2026 03:05:35 +0000 X-Mizu-Trace-ID: 83324dd7b0a9859a X-Migadu-Flow: FLOW_OUT Message-ID: Date: Tue, 1 Sep 2026 11:05:24 +0800 Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 02/11] mm/sparse-vmemmap: factor out shared vmemmap tail page allocation To: Muchun Song , Andrew Morton , David Hildenbrand , Oscar Salvador , Madhavan Srinivasan , Michael Ellerman , Jonathan Corbet Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-doc@vger.kernel.org, Muchun Song , Lorenzo Stoakes , Mike Rapoport , Nicholas Piggin , Christophe Leroy , Randy Dunlap References: <20260831075342.57563-1-songmuchun@bytedance.com> <20260831075342.57563-3-songmuchun@bytedance.com> From: Qi Zheng In-Reply-To: <20260831075342.57563-3-songmuchun@bytedance.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 8/31/26 3:53 PM, Muchun Song wrote: > HugeTLB and sparse-vmemmap each have their own helper to allocate the > shared vmemmap tail page used by vmemmap optimization. > > Factor that logic into a common vmemmap_shared_tail_page() helper. It > allocates the page through vmemmap_alloc_block(), and uses cmpxchg() > to install the per-zone shared page. > > Expose zone->vmemmap_tails under CONFIG_SPARSEMEM_VMEMMAP to match the > shared helper's build condition. This avoids a > !CONFIG_SPARSEMEM_VMEMMAP_OPTIMIZATION stub; when optimization is > disabled, the array has no entries and the compiler folds away the unused > paths, so no storage or runtime overhead is added. > > This removes duplicate allocation logic while still handling both the > early boot and runtime paths through the same helper. > > Signed-off-by: Muchun Song > --- > include/linux/mmzone.h | 2 +- > mm/hugetlb_vmemmap.c | 28 +--------------- > mm/sparse-vmemmap.c | 74 +++++++++++++++++------------------------- > mm/sparse.h | 1 + > 4 files changed, 33 insertions(+), 72 deletions(-) > Acked-by: Qi Zheng Thanks, Qi